dahua icon indicating copy to clipboard operation
dahua copied to clipboard

Enable / Disable Motion detecion always update channel 0 on xvr

Open jjscarafia opened this issue 3 years ago • 1 comments

Version of the custom_component

0.9.39

Configuration


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
ffmpeg:
logger:
  default: info
  logs:
    custom_components.dahua: debug

Describe the bug

I'm using the integration with an xvr adding multiple channels (one for each camara)

  • let say I add channel 0 (camara 1) and channel 1 (Camara 2)
  • I disable smart motion detection (or motion detecion) for channel 1 (Camara 2) on HA
  • Checking on the NVR, the disabled camara is "Camara 1"
  • No matter for wich camara I disable / enable motion detecion, the one that is disabled is channel 0 (Camara 1)

Debug log

No log changes when changing this option, still I copy the log


2022-03-06 22:09:41 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 1: [{'Code': 'VideoMotion', 'action': 'Start', 'index': '1', 'data': {'SmartMotionEnable': False}}]
2022-03-06 22:09:41 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 0: [{'Code': 'VideoMotion', 'action': 'Start', 'index': '1', 'data': {'SmartMotionEnable': False}}]
2022-03-06 22:09:51 WARNING (Thread-8) [pychromecast.socket_client] [Galería(192.168.0.234):8009] Heartbeat timeout, resetting connection
2022-03-06 22:09:51 INFO (Thread-8) [pychromecast.controllers] Receiver:channel_disconnected
2022-03-06 22:09:52 DEBUG (MainThread) [custom_components.dahua] ClientError fetching information from https://192.168.0.167:443/cgi-bin/configManager.cgi?action=getConfig&name=Lighting[0][0]
2022-03-06 22:09:52 DEBUG (MainThread) [custom_components.dahua] Finished fetching dahua data in 1.562 seconds (success: True)
2022-03-06 22:09:55 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 1: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '2', 'data': {'SmartMotionEnable': True}}]
2022-03-06 22:09:55 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 0: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '2', 'data': {'SmartMotionEnable': True}}]
2022-03-06 22:09:56 ERROR (Thread-8) [pychromecast.socket_client] [Galería([::ffff:c0a8:ea]):8009] Failed to connect to service ServiceInfo(type='host', data=('[::ffff:c0a8:ea]', 8009)), retrying in 5.0s
2022-03-06 22:09:57 INFO (Thread-8) [pychromecast.socket_client] [Galería(192.168.0.234):8009] Connection reestablished!
2022-03-06 22:10:02 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 1: [{'Code': 'VideoMotion', 'action': 'Start', 'index': '4', 'data': {'SmartMotionEnable': False}}]
2022-03-06 22:10:02 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 0: [{'Code': 'VideoMotion', 'action': 'Start', 'index': '4', 'data': {'SmartMotionEnable': False}}]
2022-03-06 22:10:06 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 1: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '2', 'data': {'SmartMotionEnable': True}}]
2022-03-06 22:10:06 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 0: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '2', 'data': {'SmartMotionEnable': True}}]
2022-03-06 22:10:09 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 1: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '4', 'data': {'SmartMotionEnable': False}}]
2022-03-06 22:10:09 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 0: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '4', 'data': {'SmartMotionEnable': False}}]
2022-03-06 22:10:09 DEBUG (MainThread) [custom_components.dahua] ClientError fetching information from https://192.168.0.167:443/cgi-bin/configManager.cgi?action=getConfig&name=Lighting[1][0]
2022-03-06 22:10:09 DEBUG (MainThread) [custom_components.dahua] Finished fetching dahua data in 0.706 seconds (success: True)
2022-03-06 22:10:10 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 1: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '1', 'data': {'SmartMotionEnable': False}}]
2022-03-06 22:10:10 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 0: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '1', 'data': {'SmartMotionEnable': False}}]
2022-03-06 22:10:10 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 1: [{'Code': 'VideoMotion', 'action': 'Start', 'index': '1', 'data': {'SmartMotionEnable': False}}]
2022-03-06 22:10:10 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 0: [{'Code': 'VideoMotion', 'action': 'Start', 'index': '1', 'data': {'SmartMotionEnable': False}}]

jjscarafia avatar Mar 07 '22 01:03 jjscarafia

I too have this issue.

The code was never made to support camera indexes more than 0. I'm trying to work through the code to make this work, but I'm not a good coder, so not having lots of luck.

@rroller I know you don't have much time, but would you be able to have a look at the smart motion detection part. What do you make of it never being designed to support camera indexes.

takenalias avatar Apr 16 '23 00:04 takenalias