[APP][Pro] Support for ONVIF compatible cameras (Release 2.0.41)

Hmm, it seem the token is missing from each device. That should have been setup during the pairing.
I have looked through the previous logs but I don’t think I got one from the ‘successful’ pairing.
When you get time, can you delete all the cameras and add them again with logging switched on and send me the log.
If you look in the advanced setting of each camera the token should be reported. The first camera should be “00000”, the second one should be “00100”, the third should be “00200” and the fourth should be “00300”. You can manually set them in there to see if the events get routed correctly then but I would like to make sure the pairing is working properly.

I nuked everything and added all the channels back after app update.

Had to manually enter tokens, but now it seems to be working :slight_smile:

6ab4a20f-fb74-580b-2a37-5b88a5b77f00

Excellent. So I still need to work out why the tokens are not being setup during pairing and unfortunately the logs have captured that part. Maybe it overflowed with so much going on now.

Sorry to be a pain but any chance you can delete the cameras, clear the log, add the cameras, and send the log before turning on motion detection. Hopefully that should capture the pair in process so i can see where the tokens are located in the structure relative to the start of the object being past in.

Once you have sent that log could you then clear it again and go through the process of enabling motion detection on 2 cameras and then disabling them both again. Then send me that log of that so I can verify that the new event queue is being setup and cleared correctly.

Thanks for your help.

Log after re adding cameras

d1cc7694-d07c-287f-84e8-d04557204b82

Log after enabling motion detection

8b363bdd-6626-8365-16b4-fa02569faef7

Btw I tried to trigger motion events again this morning just to see if it still works, but got no response. Just thought I should let you know.

That’s great, thank you.
I think I have spotted the error, I used a ‘for(var in)’ loop instead of ‘for(var of)’ loop.
I will fix that tonight and upload another version.

I have publish a new test version. Could you check if it adds the token in correctly during pairing please?

Yes, tokens are good now.

Excellent. Thank you for checking.
I hope it’s all OK for you now now.
Now I just need someone with a single camera to make sure the push events are still OK for them :grin:

Everything seems to work, but as I said yesterday, after the initial setup everything works fine, but yesterday and today I checked to see if the motion events are being triggered, and they were not for some reason. But if I delete and add cameras back in, it works again and stops working after a while.

Ahh, so almost there but not quite :slight_smile:
After it stops detecting, if you switch off the motion detection in all the cameras and then turn it back on again does it start working?
Any idea how long before it stops?
Can you turn off all motion capture, clear the log and enable logging, turn on motion capture, then as soon as you notice it has stopped, send me the logs.

A motion subscription has a short time period and then expires so it needs to be renewed. When the subscription is requested the lease time is returned and the code should setup a timer that just a bit shorter so it request for an extension before it runs out. If that request fails then it will create a new request. I am guessing that something in the re-write has broken that. I will stare at the code for a while but often the logs pinpoint errors very quickly.

I will get on it after I get home :slight_smile:

When I tried ti switch motion detection off and back on, I would still not get any motion triggers from any cameras. I know there is some kind of “cooldown” for the motion detection, but it just doesn’t work at all.

I tried to delete all cameras, add them back in, then turn the motion detection. For some reason now it doesn’t works at all even from the start.

04fcff11-8244-71b1-6afc-10c824d68c3


I just reinstalled the app and added everything back and enabled motion events and it works for now.

a3399b4d-6f6e-5729-44b2-3f65b74066d1

I will wait for a bit to see if they stop working again and will send you the log.


Ok just checked. It seems like all channels get triggered once or twice after initial setup but then stop working right away. I literally went back to see if they still work a few minutes later and got no response. I then disabled and re enabled motion senors for all 4 channels and tried triggering them again without luck.

9cb039aa-f49b-4113-b662-59baf92ec2f9

I can see that something is going wrong when the motion is turned off so it looks like it is not clearing down the queue. That probably prevents them being enabled again. I’m not sure why they are stopping by themselves yet but I will have a good look.
At the moment it’s too hot to think properly so hopefully it will cool down soon :hot_face:

Used the IMOU IPC-G26EP and this worked with your app. Could update the screenshot. Updating the screenshot takes 4-5 seconds. I do not see the motion icon being detected when motion is trigged. will test further again.

I have pushed a new test version. Fixed the issue when turning off motion so hopefully that should clean up properly now. It might solve the problem with the motion stopping but if not I have added more logging so I can see what the subscription time is just to make sure that is setting the timer that has to renew the subscription correctly. So hopefully we should see message that say “Renew previous events…”

This is normal as it depends on how busy Homey is. Mine can sometimes refresh in about 1 second but 3 - 5 seconds is not uncommon.

If you are not getting motion detection then could you enable logging in the ONVIF app - Configure App page and then go back to the device and switch Motion Detection on, try to trigger motion and then send me the log from the Configure page.

Ok, I will give it a shot tomorrow, had a busy day today. Will report as soon as I can.

1 Like

I did fresh install again and logged everything. Unfortunately motion stops triggering again after a few times.

fb973712-9599-e5fb-370e-0b7d8add084e

Hmm, Everything seems to be working nicely and then (what appears to be) the first subscription renewal comes along which apparently doesn’t complete. But it is followed by a barrage of NOW image updates. I can understand there being an error in the code that stops the renewal form completing but I am stumped by the image refreshes.

Did you manually keep refreshing the image when it stopped detecting?
Do you have a flow setup to capture a new now image?

I’m not saying you are doing something wrong, I am just trying to understand what is happening. Is this a bug in the code that I need to look for or is it just something you are doing.

I have a hunch about the possible renew error that ‘this’ is not valid when the function is invoked by the timer.

Another version is ready.