dahua
dahua copied to clipboard
Home Assistant Sensors not showing state
Version of the custom_component
Latest
Describe the bug
Home Assistant entity does not update state. Always shown as off.
This issue is for all sensors generated
I have had limited success in the past with it detection state changes, some times.
Tried deleting and reinstating camera, no changes
Also created automations for event steams
Looking at the logs it is also disconecting for event steam sometimes
Debug log
2022-01-29 16:19:28 DEBUG (MainThread) [custom_components.dahua] Cam Data received from channel 6: {'name': 'Garage', 'Code': 'VideoMotion', 'action': 'Start', 'index': '6', 'DeviceName': 'Garage'},
2022-01-29 16:19:02 INFO (MainThread) [homeassistant.components.switch] Setting up switch.dahua,
2022-01-29 16:19:28 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=binary_sensor.garage_motion_alarm, old_state=<state binary_sensor.garage_motion_alarm=off; attribution=Data provided by https://ronnieroller.com, id=None, integration=dahua, device_class=motion, friendly_name=Garage Motion Alarm @ 2022-01-29T16:19:02.628381+11:00>, new_state=<state binary_sensor.garage_motion_alarm=on; attribution=Data provided by https://ronnieroller.com, id=None, integration=dahua, device_class=motion, friendly_name=Garage Motion Alarm @ 2022-01-29T16:19:28.620010+11:00>>
2022-01-29 18:13:01 DEBUG (MainThread) [custom_components.dahua] Finished fetching dahua data in 0.136 seconds (success: True)
2022-01-29 18:13:31 DEBUG (MainThread) [custom_components.dahua] Finished fetching dahua data in 0.115 seconds (success: True)
2022-01-29 18:14:01 DEBUG (MainThread) [custom_components.dahua] Finished fetching dahua data in 0.129 seconds (success: True)
2022-01-29 18:14:31 DEBUG (MainThread) [custom_components.dahua] Finished fetching dahua data in 0.119 seconds (success: True)
2022-01-29 18:14:43 DEBUG (Thread-2454) [custom_components.dahua]
2022-01-29 18:14:43 DEBUG (Thread-2454) [custom_components.dahua] Exiting DahuaEventThread
2022-01-29 18:15:01 DEBUG (MainThread) [custom_components.dahua] Finished fetching dahua data in 0.138 seconds (success: True)
2022-01-29 18:15:31 DEBUG (MainThread) [custom_components.dahua] Finished fetching dahua data in 0.128 seconds (success: True)
2022-01-29 18:15:31 DEBUG (Thread-3374) [custom_components.dahua]
2022-01-29 18:15:31 DEBUG (Thread-3374) [custom_components.dahua] reconnecting to camera's event stream...
2022-01-29 18:16:01 DEBUG (MainThread) [custom_components.dahua] Finished fetching dahua data in 0.348 seconds (success: True)
2022-01-29 18:16:16 DEBUG (MainThread) [custom_components.dahua] Cam Data received from channel 6: {'name': 'Garage', 'Code': 'VideoMotion', 'action': 'Start', 'index': '6', 'DeviceName': 'Garage'}
2022-01-29 18:16:16 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=binary_sensor.garage_motion_alarm, old_state=<state binary_sensor.garage_motion_alarm=off; attribution=Data provided by https://ronnieroller.com, id=None, integration=dahua, device_class=motion, friendly_name=Garage Motion Alarm @ 2022-01-29T18:10:31.035845+11:00>, new_state=<state binary_sensor.garage_motion_alarm=on; attribution=Data provided by https://ronnieroller.com, id=None, integration=dahua, device_class=motion, friendly_name=Garage Motion Alarm @ 2022-01-29T18:16:16.644105+11:00>>
2022-01-29 18:16:16 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event dahua_event_received[L]: name=Garage, Code=VideoMotion, action=Start, index=6, DeviceName=Garage>
2022-01-29 18:16:16 DEBUG (MainThread) [homeassistant.components.automation.new_automation_2] Automation triggered by event 'dahua_event_received'
2022-01-29 18:16:16 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event automation_triggered[L]: name=New Automation, entity_id=automation.new_automation_2, source=event 'dahua_event_received'>
2022-01-29 18:16:29 DEBUG (MainThread) [custom_components.dahua] Cam Data received from channel 6: {'name': 'Garage', 'Code': 'VideoMotion', 'action': 'Stop', 'index': '6', 'DeviceName': 'Garage'}
2022-01-29 18:16:29 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=binary_sensor.garage_motion_alarm, old_state=<state binary_sensor.garage_motion_alarm=on; attribution=Data provided by https://ronnieroller.com, id=None, integration=dahua, device_class=motion, friendly_name=Garage Motion Alarm @ 2022-01-29T18:16:16.644105+11:00>, new_state=<state binary_sensor.garage_motion_alarm=off; attribution=Data provided by https://ronnieroller.com, id=None, integration=dahua, device_class=motion, friendly_name=Garage Motion Alarm @ 2022-01-29T18:16:29.732729+11:00>>
2022-01-29 18:16:29 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event dahua_event_received[L]: name=Garage, Code=VideoMotion, action=Stop, index=6, DeviceName=Garage>
2022-01-29 18:16:31 DEBUG (MainThread) [custom_components.dahua] Finished fetching dahua data in 0.114 seconds (success: True)
Any ideas?
It will always disconnect and then reconnect, that's normal... What camera are you using?