dbuezas/icsee-ptz

Motion sensor shows unavailable all the time

cgraf opened this issue · 13 comments

cgraf commented

Trying this out for the first time, but get unavailable. Camera are not PTZs. I'm just try to get motion detection. Firmware and hardware version recognized, Smart Alarms enabled. Not sure what else to try.

Device info
IPC_GK7205V200_G4F
Firmware: V5.00.R02.263739N7.10010.140d17.0000000
Hardware: IPC_GK7205V200_G4F

Sensors
Motion Alarm
Unknown

Do you get notifications in icsee or XMEye?
Unknown means that everything is working but no motion start or motion en event was received yet

cgraf commented

Thanks for the tip. It turns out one camera was detecting motion fine and it was showing up in the integration, but the one that I was actually looking at was not. Everything appeared set correctly, but I toggled the settings off and back on again, and everything works fine now. Sorry about the false alarm. Great job with this! I'm really happy to have this functionality without burning RPi CPU. I just got some bird box cameras from Green Backyard, and this will help me to integrate NAS recording of baby owlet activity. Thanks again!!@

Cool, happy to hear!
I'm also giving it good use. Are you taking pictures when the baby birds move or just tracking them?

Maybe I could try exposing a switch entity to turn the alarm on.

I implemented discovery for this cameras in go2rtc, maybe I should try to do it for this one too

cgraf commented

Well I'm just building the boxes and placing the cameras right now. Owl season starts in Oct/Nov here when the parents will find the box. Hatchlings don't occur until Jan/Feb. I'm planning on setting up a template that counts the time since the last recording, and maybe resets every 5 minutes or so. Once it resets, I'll do a record on motion again. I notice the sensor is very sensitive, and the integration will trigger on every one. I've seen the integration detect motion at least 2 times per second.

If it were possible, it might be cool to have that be a configurable part of the integration, Like Clear -> Detected -> Recent, and have a configurable number of seconds for "Recent". That way automations such as recording on state change from Clear to Detected wouldn't need external limiters that prevent constant recording for things like bird movement, trees/plants blowing in the wind, etc.

You can set the sensitivity with XMEye (at least with the mac program)

The cameras send an even for "started motion" and "stop motion". What I do to reduce false positives is to set the trigger to require motion longer than 2 seconds.

cgraf commented

Yeah it doesn't appear to be so much a sensitivity issue, but more of a frequency issue. I want to be sensitive to small motion when it occurs, but when it occurs a lot, I don't necessarily want an unmanageable amount of recordings.

I guess now that you mention it, the "two per second" are actually the detection and clear. If I move my hand slowly inside the box, it will fire every two seconds though.

It is fine though. I can set an external timer in HA if I only want one recording every five minutes or 15 minutes or whatever. Just thought it might be interesting to have the integration have a configurable "sleep" period between detections.

Box 1 Motion Alarm cleared (no motion detected)
9:32:06 AM - 16 minutes ago
Box 1 Motion Alarm detected motion
9:32:05 AM - 16 minutes ago
Box 1 Motion Alarm cleared (no motion detected)
9:32:03 AM - 16 minutes ago
Box 1 Motion Alarm detected motion
9:32:03 AM - 16 minutes ago
Box 1 Motion Alarm cleared (no motion detected)
9:32:01 AM - 16 minutes ago
Box 1 Motion Alarm detected motion
9:32:01 AM - 16 minutes ago

No, I mean movement for longer than 2 seconds. It will trigger once only if there is continuous movement for 2 seconds. If movement never stops, then it won't trigger again (not saying this is better, just stating what I did with a standard home assistant state automation)

cgraf commented

You've definitely done great work, and it will work perfectly for my need. When I have time, I'd like to look through the source to see how the camera software is exposing this. Did you find any other interesting stuff while you were in there? Like maybe how to custom configure the AlarmServer?

Thanks!
I'm using a library called python-dvrip. It had a couple of bugs in the alarms code so i put the fixed file for now (until they release the fix).
I suggest you take a look to their docs, there are some interesting tricks there :)
What I did quite a bit too was analysing ip traffic with Wireshark

cgraf commented

Is it expected that DVRIP logs in twice and logs out twice every 20 seconds?

**
image
**

Yes, it is expected.
There is a keepalive mechanism but it doesn't work well in the named library. To mitigate the issue, every 20 seconds I'm making a new connection and then discarding the old one (new and old overlap to ensure no alarms are lost)