Closed cadwizzard closed 1 year ago
Hey there @mezz64, mind taking a look at this issue as it has been labeled with an integration (hikvision
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
hikvision documentation hikvision source (message by IssueLinks)
Can you enable debug logging for the hikvision component and post logs here for a normal startup?
logs:
pyhik.hikvision: debug
homeassistant.components.binary_sensor.hikvision: debug
Thanks for coming back so amazingly quickly... but I think i've just found the issue. after looking into this on and off for 18 hours.... I was troubleshooting also on the DVR and decided to factory reset a camera to see if that had any effect (PoE plug n play hikvision) and as such I had to go back into the camera settings to rename, it and turn on motion etc/notify surveillance centre. I went to basic event and before I could select cam 14, I noticed cam1 was unselected (despite motion being enabled and also line crossing still). After checking every camera, somehow very weirdly, every camera for line cross and motion was unselected to notify - but all other settings were still set.
I've used alerts in the Hik app for a long time so notify was always on. I've really no clue what caused this issue, but the reason why the integration stopped working is pretty clear now.
Is there any way the integration could have glitched and done that? (the homeassistant account on the NVR has operator role defaults and only the extra surveillance station permission enabled). I made no changes on the NVR between it working and it not after the update (with exception to reboot from the UI when I noticed the entities were unavailable).
I do have a request/question on this integration (apologies if in wrong place). I understand the delay variable and why, but for line crossing etc with automations (like lights) it needs to be set lower than 5 seconds to work well. (i'm assuming i read it correctly that the alert is sent x seconds after being detected to avoid multiple trips. As security breach detection, long wait/delays are problematic before the state goes true) What would be amazing to be able to configure (like on motion sensors) is the trigger time, so the condition goes true (as soon as detected) and stays true for a configurable time. This would make linking lighting based on detected or not super easy to configure for set times. It would also allow a useful conditional card setup where the picture entity with camera snapshot appears for long enough to glance at it on a dashboard. Especially true on line crossing as it seems to stay in a triggered state for a very short time compared to motion. Is that possible/implemented/planned?
There isn't a way the integration would have changed any camera settings. All interactions are GET requests against the API with no new information being inputted.
The delay variable does not delay the start of the trip, it extends it duration so that two trips in a 5sec period can be combined into one long event rather than two small ones. If you're getting a delay in the initial trigger it's likely related to a bug in the requests library iter_line processing that sometimes has trouble processing one event until another comes in. On older cameras this isn't a problem because video loss events are constantly generated, but newer models seem to do this much less frequently leading to the delays it sounds like you're seeing. Unfortunately, there isn't a good way to fix this at the moment with the current code base since reading in every byte individually from the event stream (one workaround option) utilizes way too many resources.
Thanks for clarifying. The delay as is is then really useful, it read (to me at least) that the delay is an actual delay from the first trip to capture other trips rather than more of a mute/silence of subsequent trips after the first one. A few people discussing the delay option on forums seem to have it confused the way i did too. Makes more sense to extend that to 30s rather than reduce it.
But for my other question, when a trip (line crossing as an example happens), its detected only for a real short period in Home Assistant and then clears. It would be so useful to be able to set a trigger time, i.e from the point of detection for x seconds which keeps the binary sensor in HA 'detected' before going back to clear. The example being a conditional card that shows the camera while the binary sensor is in detected state. (Or is the detected time as you see in the ui also linked to the delay time in the configuration?)
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
The problem
Hikvision motion and line crossing integration shows all cameras/channels 'unavailable' since update. I had a 16ch NVR reporting motion and line crossing perfectly before update. Since update there is no triggering from any of the cameras/sensors.
The NVR has been rebooted Home Assistant has been rebooted The user has the surveillance station permissions the NVR is set to basic/digest security all the cameras have the report to surveillance station option checked in motion and line crossing settings. I see in the NVR logs the login from homeassistant with alarm arming and disarming messages are working (as below) Host (Pi) and the NVR are on the same subnet (wired connection to the same switch too)
I do have generic camera view cards set up from the same NVR system using the same username and password and they are all working as normal, also ruling out a connectivity issue to the NVR from the host.
What version of Home Assistant Core has the issue?
Home Assistant 2022.11.3
What was the last working version of Home Assistant Core?
Home Assistant 2022.11.2
What type of installation are you running?
Home Assistant Supervised
Integration causing the issue
hikvision
Link to integration documentation on our website
https://www.home-assistant.io/integrations/hikvision/
Diagnostics information
I see no entries in the logs for this (if there is a specific method to grab more data, let me know and I will). The integration is native hikvision enabled in configuration.yaml only and doesn't appear in integrations
Example YAML snippet
Anything in the logs that might be useful for us?
No response
Additional information
I have updated the NVR (DS-7716NI-I4) to the very latest firmware (4.61.025 available – 220905) but for some reason, the integration is still not working.
I see the integration logging into the NVR as here like before:
This is the status (6hrs ago was last updated - reboot of HA)
I used to have the credentials in the secrets.yaml and referenced them like this, but have reverted to the basic config for troubleshooting and put back into configuration.yaml as above, to rule as much out as possible: binary_sensor:
Of course all my automations relating to motion are now also not working.