viseron icon indicating copy to clipboard operation
viseron copied to clipboard

Recorder error when used only with motion detection

Open jramsgz opened this issue 2 years ago • 8 comments

I'm trying to configure viseron to record whenever it detects motion, however it seems to be broken in the latest modularize release (Docker ARM64). Here is the log when motion is detected:

[2022-04-16 18:17:04] [DEBUG   ] [viseron.states] - Setting state of binary_sensor.front_door_motion_detected to state: on, attributes {}
[2022-04-16 18:17:04] [ERROR   ] [root] - Uncaught thread exception
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/src/viseron/components/nvr/nvr.py", line 547, in run
    self.process_recorder(shared_frame)
  File "/src/viseron/components/nvr/nvr.py", line 511, in process_recorder
    self.start_recorder(shared_frame)
  File "/src/viseron/components/nvr/nvr.py", line 460, in start_recorder
    self._camera.start_recorder(shared_frame, self._object_detector.objects_in_fov)
AttributeError: 'bool' object has no attribute 'objects_in_fov'
[2022-04-16 18:17:08] [DEBUG   ] [viseron.watchdog.thread_watchdog] - Thread <viseron.components.nvr.nvr.NVR object at 0x7f8463e490> is dead, restarting
[2022-04-16 18:17:08] [DEBUG   ] [viseron.components.nvr.nvr.front_doorl] - Waiting for first frame
[2022-04-16 18:17:08] [DEBUG   ] [viseron.components.nvr.nvr.front_door] - First frame received
[2022-04-16 18:17:08] [DEBUG   ] [viseron.components.nvr.nvr.front_door] - Frame is 2.9600419998168945 seconds old. Discarding
[2022-04-16 18:17:08] [DEBUG   ] [viseron.components.nvr.nvr.front_door] - Frame is 2.4881720542907715 seconds old. Discarding
[2022-04-16 18:17:08] [DEBUG   ] [viseron.components.nvr.nvr.front_door] - Frame is 1.9679265022277832 seconds old. Discarding
[2022-04-16 18:17:08] [DEBUG   ] [viseron.components.nvr.nvr.front_door] - Frame is 1.5028295516967773 seconds old. Discarding
[2022-04-16 18:17:08] [DEBUG   ] [viseron.states] - Setting state of binary_sensor.front_door_motion_detected to state: off, attributes {}
[2022-04-16 18:17:08] [ERROR   ] [root] - Uncaught thread exception
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/src/viseron/components/nvr/nvr.py", line 547, in run
    self.process_recorder(shared_frame)
  File "/src/viseron/components/nvr/nvr.py", line 511, in process_recorder
    self.start_recorder(shared_frame)
  File "/src/viseron/components/nvr/nvr.py", line 460, in start_recorder
    self._camera.start_recorder(shared_frame, self._object_detector.objects_in_fov)
AttributeError: 'bool' object has no attribute 'objects_in_fov'
[2022-04-16 18:17:23] [DEBUG   ] [viseron.watchdog.thread_watchdog] - Thread <viseron.components.nvr.nvr.NVR object at 0x7f8463e490> is dead, restarting

Here is my config:

ffmpeg: # <-- component
  camera: # <-- domain
    front_door: # <-- camera identifier
       name: Front Door
       host: 192.168.1.113
       path: /stream1
       port: 8554
       stream_format: rtsp
       fps: 6
       rtsp_transport: udp
       recorder:
          idle_timeout: 10
          lookback: 10
          retain: 7
          folder: /recordings
          codec: h264

background_subtractor: # <-- component
  motion_detector: # <-- domain
    cameras:
      front_door: # <-- camera identifier
        trigger_recorder: true
        fps: 2
        mask:
          - coordinates:
              - x: 0
                y: 1080
              - x: 0
                y: 0
              - x: 1225
                y: 0
              - x: 605
                y: 1080
          - coordinates:
              - x: 1826
                y: 1080
              - x: 1640
                y: 0
              - x: 1920
                y: 0
              - x: 1920
                y: 1080


nvr: # <-- component
  front_door: # <-- camera identifier

webserver:

mqtt:
  broker: 192.168.1.123
  port: 1883
  username: ***
  password: ***
  client_id: viseron
  home_assistant:

logger:
  default_level: debug
  logs:
    viseron.components.data_stream: info
    viseron.components.background_subtractor: info
    viseron.components.mog2: info

Another thing I found is that you have to specify trigger_recorder: true, for it to record whereas in the documentation it says that it defaults to true

jramsgz avatar Apr 16 '22 17:04 jramsgz

Will look into it later today.

Sorry for the issues!

roflcoopter avatar Apr 18 '22 11:04 roflcoopter

Fixed now in latest roflcoopter/viseron:modularize.

The docs are still wrong tho, the default is false for trigger_recorder for motion detectors. Will fix it when i get to the documentation part of #306

roflcoopter avatar Apr 18 '22 18:04 roflcoopter

No need to say sorry, you're doing an amazing job. I just tested the latest build and it works perfectly, thank you so much.

jramsgz avatar Apr 20 '22 10:04 jramsgz

Great!

roflcoopter avatar Apr 20 '22 17:04 roflcoopter

This seems to be broken again in the latest V2 build with a very similar error Commit a36eb3a78f688f99b4d23d5449940592de92b039 might be the cause

jramsgz avatar Jun 20 '22 17:06 jramsgz

Sorry about that, will investigate and fix. Do you get any error message?

roflcoopter avatar Jun 21 '22 08:06 roflcoopter

Fixed (again)! I tested it out and it seemed to work fine. Could you verify for me?

roflcoopter avatar Jun 21 '22 20:06 roflcoopter

It works perfectly now. Thank you very much!

jramsgz avatar Jun 22 '22 16:06 jramsgz

Closed in v2

roflcoopter avatar Dec 19 '22 14:12 roflcoopter