Closed Oooklart closed 2 years ago
Log ID: 2020-09-13T06:41:03.563Z App version 1.1.4
+0:0:0.000: Fetching (192.168.68.151) NOW image with Digest Auth. From: http://192.168.68.151:82/cgi-bin/api.cgi?cmd=onvifSnapPic&channel=1 +0:0:3.962: Now Image Updated (192.168.68.151)
And motion detection won't work. In reolink app the motion detection works.
Can you enable the log in the app configuration page and then restart the ONVIF app. When it has completed the startup, send me the log. This will hopefully show which motion detection methods are supported. As far as the image is concerned, do you know what format the file is in? The ONVIF app expects a JPEG file.
No I don't know what file format it is 😔 If I change to channel 0 here, I get a picture but motion still won't work.
Here's the log.
Log ID: 2020-09-13T09:48:14.927Z App version 1.1.4
+0:0:0.000: Initialising CameraDevice (192.168.68.151) +0:0:0.015: -------------------------- +0:0:0.006: Connect to Camera 192.168.68.151:8000 - admin +0:0:1.834: getServices: Started +0:0:0.264: getServices: Finished ----- +0:0:0.011: callUpstartFunctions: Started +0:0:0.307: VideoSources: [ { "$": { "token": "000" }, "framerate": 15, "resolution": { "width": 2560, "height": 1440 }, "imaging": { "brightness": 128, "colorSaturation": 128, "contrast": 128, "irCutFilter": "ON", "sharpness": 128 } } ] +0:0:0.007: ActiveSource [0] = { "$": { "token": "000" }, "name": "VideoE_000", "useCount": 1, "encoding": "H264", "resolution": { "width": 2560, "height": 1440 }, "quality": 0, "rateControl": { "frameRateLimit": 15, "encodingInterval": 1, "bitrateLimit": 2048 }, "H264": { "govLength": 10, "H264Profile": "Main" }, "multicast": { "address": { "type": "IPv4", "IPv4Address": "239.0.1.0" }, "port": 4000, "TTL": 64, "autoStart": false }, "sessionTimeout": "PT10S" } +0:0:0.001: VideoSource [0] = { "$": { "token": "000" }, "framerate": 15, "resolution": { "width": 2560, "height": 1440 }, "imaging": { "brightness": 128, "colorSaturation": 128, "contrast": 128, "irCutFilter": "ON", "sharpness": 128 } } +0:0:0.002: callUpstartFunctions: Finished ----- +0:0:0.033: CONNECTED to 192.168.68.151 +0:0:0.008: getServices: Started +0:0:0.168: getServices: Finished ----- +0:0:0.147: Camera Information (192.168.68.151): { "manufacturer": "Manufacturer", "model": "IPC_51316M", "firmwareVersion": "v3.0.0.65_20071002", "serialNumber": "00000000065536", "hardwareId": "IPC" } +0:0:0.003: getCapabilities: Started +0:0:0.206: getCapabilities: Finished ----- +0:0:0.003: Camera (192.168.68.151) supports PullPoint +0:0:0.224: Supported Events(192.168.68.151): MOTION +0:0:0.817: Snapshot URL: http://192.168.68.151:82/cgi-bin/api.cgi?cmd=onvifSnapPic&channel=1 +0:0:0.012: Registering Now image (192.168.68.151) +0:0:0.019: SnapShot save file (192.168.68.151) = eventimage192_168_68_151.jpg +0:0:0.009: Registering event image (192.168.68.151) +0:0:0.015: Camera (192.168.68.151) is ready +0:0:0.024: registered Now image (192.168.68.151) +0:0:0.084: registered event image (192.168.68.151)
Good catch on the channel number. I have made an adjustment to the code to prevent the snapshot channel being overridden when there is only one channel. The current code sets a default channel of 1, which seems to have worked until now but with so many different cameras around I guess it was bound to fail at some point.
The log shows the camera supports Pull events and MOTION so it should be working. Could you check further down in the device settings to make sure it has picked those up correctly.
One thing I don't see in the log is a line saying 'Switch motion detection On...' so can you verify that the button on the MOTION DETECTION screen is filled white.
Also, with the logging enabled, can you trigger motion on the camera. This should hopefully log the event data so I can check the format.
If possible could you go to https://developer.athom.com/tools/devices, type the camera IP address into the search field, copy the contents of the panel and paste into a reply. Make sure you delete any password text from the message before you send it.
This?
192.168.68.151
Property Value
ID e003a0f5-3a60-4764-9d91-241054b75437
Class sensor
Driver homey:app:com.onvif — camera
Ready Yes
Available Yes
Warning No
Custom icon No
Images
camera — Now — 02e2363a-4c40-41bf-96ed-3f26fb43a53a
camera — Event — 1089cebc-68d8-472a-ba43-8d320632a37f
Data Key Value id "192.168.68.151" port "8000"
Settings Key Value username "admin" password "0" ip "192.168.68.151" port "8000" urn "urn:uuid:2419d68a-2dd2-21b2-a205-44:ef:bf:9f:ff:3d" channel 0 classType "sensor" single true delay 0.5 token "" preferPullEvents false timeFormat "mm_dd" manufacturer "Manufacturer" model "IPC_51316M" serialNumber "00000000065536" firmwareVersion "v3.0.0.65_20071002" url "http://192.168.68.151:82/cgi-bin/api.cgi?cmd=onvifSnapPic&channel=0" notificationMethods "Only Pull supported" notificationTypes "MOTION" energy_value_constant null hasMotion true
Capabilities
Capability Type Value Edit value Last Updated
motion_enabled boolean null
alarm_motion boolean false 2 hours ago
alarm_tamper boolean false 2 hours ago
event_time string null
tamper_time string null
date_time string 13:30 13-09 49 seconds ago
button.syncTime boolean null
It looks like the motion detection is not switched on 'motion_enabled boolean null'. Could you either set it to true from the same screen you captured the data from or in the app, goto the 'MOTION DETECTION' screen and tap the button so it turns white.
I turned it on, the the app get paused. I restart the app and now I don't get any snapshot.
192.168.68.151 Property Value ID e003a0f5-3a60-4764-9d91-241054b75437 Class sensor Driver homey:app:com.onvif — camera Ready No Available No (No unavailable message) Warning No Custom icon No
Data Key Value id "192.168.68.151" port "8000"
Settings Key Value username "admin" password "0" ip "192.168.68.151" port "8000" urn "urn:uuid:2419d68a-2dd2-21b2-a205-44:ef:bf:9f:ff:3d" channel 0 classType "sensor" single true delay 0.5 token "" preferPullEvents false timeFormat "mm_dd" manufacturer "Manufacturer" model "IPC_51316M" serialNumber "00000000065536" firmwareVersion "v3.0.0.65_20071002" url "http://192.168.68.151:82/cgi-bin/api.cgi?cmd=onvifSnapPic&channel=0" notificationMethods "Only Pull supported" notificationTypes "MOTION" energy_value_constant null hasMotion true
Capabilities Capability Type Value Edit value Last Updated
Homey get unresponsive and shows offline, when it starts up a couple of apps is paused including yours. I can't activate the app, then Homey crashes. If I remove the camera and add it again it works until I activate motion
Memory use when active motion in the app 😱
Not good. Can you send the log with motion on. Once you have sent the log, switch it off and clear it as it could be the log data consuming the memory.
The log is sent but it seems to be empty, the log gets empty when I turn on motion. Homey crashed before I got to turn motion off again, it crashed more or less immediately when I turn on motion
Also sent a diagnostic report f51a0dd7-efcc-48ea-a3b4-fd482f308b55
I got the logs and hey are full of failed attempts to connect to IP 255.255.255.255. I have no idea why the app should be trying to connected to that IP but because the log resets when it is full the important information has long gone. I have been looking over and over the code for hours but I can see nothing that could do this.
So, I have published a new test version https://homey.app/a/com.onvif/test/
This switches off the log when it is full instead of clearing it. Can you install the new test version and capture the log again. Preferably, make sure the log is cleared, switch the log on, then restart the app so it captures the full startup information. Allow a few minutes for the startup to complete and then switch the motion on for about 2 seconds. Finally send the log.
Alright, I have sent the log. Immediately when I hit send button homey crashed so I hope you got it. One thing I noticed in this version is that I had to change the channel to 1 and save and then back to channel 0 and save, or else I got no picture. This I must do after every restart of the app.
Edit : Now when homey has booted i hit the send button again.
Yep, I got the log. Everything looks fine until the motion is enabled and then chaos. I will need to add more logging inside the ONVIF library to find out why it is not working, so there will be another update this evening. Sorry it's being a pain but hopefully we can resolve this as it all looks like it should work.
Sounds good 👍
I have published another test version.
Now I have done the same procedure and sent the log.
Another test version is ready. It seems the reply from the pull subscription is suspect so I have added it to the log. Hopefully, it is something I can repair once I see what is coming back.
Sent you the new log. I really hope that's something you can fix 👍
Well, the good news is that it seems it is just the IP address that is crazy so I can try replacing that with the correct one and see if it behaves properly after that. I have not seen a camera return its IP address as 255.255.255.255 before so I don't know if it's a bug in the camera or a strange attempt to add extra security. Hopefully it is the only problem and doesn't just move to another problem down the line.
I will add a 'fix' and post a new version when I get home from work this evening.
Awesome! Hope it works.
I have published a new test version. Fingers crossed this fixes the problem.
Hands down. It seems to be working, I even got motion in the app without any crash. I will test it for a while and get back to you? How about that I need to set channel to 1 from 0 and back to 0 after a reboot of homey or the app? Once again, awesome work!
Happy the motion is working. I thought I had solved the issue with the channel. So the setting is stable at 0? But you get no image until you change it to 1 and back to 0?
Exactly. I'm using channel 0. When for example reboot homey and when I go to your app it is on right channel (0) but it says "invalid image buffer" so I have to set it to channel 1 and save, then set it to channel 0 and save, then it works.
I have published a new version. This should keep the channel setting of 0. You can also set the channel to -1 so the app just keeps the returned URL.
Yes that could I have done 🙂 I have tested the new version and channel problem are fixed. New problem is that motion detection stops working after a while even though it is turned on. I still have a picture though.
Sent log..
Log ID: 2020-09-16T02:16:40.422Z App version 1.1.9
+0:0:0.000: Event STILL Processing last image (192.168.68.151)
+0:9:1.524: Request error: {
"code": "ECONNRESET"
}
+1:27:53.512: Request error: {
"code": "ECONNRESET"
}
+0:23:12.292: Request error: {
"code": "ECONNRESET"
}
+0:14:36.409: Request error: {
"code": "ECONNRESET"
}
+0:56:40.905: Request error: {
"code": "ECONNRESET"
}
+0:0:0.042: Request error: {
"code": "ECONNRESET"
}
+0:43:37.439: Sending log
+0:0:2.078:
_request: {
"hostname": "192.168.68.151",
"port": 8000,
"agent": false,
"path": "/onvif/device_service",
"timeout": 70000,
"headers": {
"Content-Type": "application/soap+xml",
"Content-Length": 261,
"charset": "utf-8"
},
"method": "POST"
}
Body:
+0:0:0.108: Message sent: 5e56babc-d3e6-ecdf-5e61-fd4aa2efc474@ady.duckdns.org
+0:0:10.045:
_request: {
"hostname": "192.168.68.151",
"port": 8000,
"agent": false,
"path": "/onvif/device_service",
"timeout": 70000,
"headers": {
"Content-Type": "application/soap+xml",
"Content-Length": 261,
"charset": "utf-8"
},
"method": "POST"
}
Body:
The numbers at the start of each line are the hours : minutes : seconds since the last log message so the ECONNRESET message are not too frequent. Network errors are not uncommon so to see some connection resets every so often it to be expected.
However, what I don't see are the subscription renewal message that should be popping up every few minutes. Was the logging turned on? (Errors are still logged even when it is off) If you turn motion off and back on does it come back to life?
Yes logging was turned on but when I went into the App it was turned off. When the motion stopped working it still worked on the cameras own app. After a restart of your app the motion work again. I can try turn motion off/on next time it happens.
Today the motion sensor stopped working again. This time I disabled motion and turned it on again, then it worked. Sent a log to you.
New log. The camera disappeared. I have tried to restart the app, restart my routers, restart the camera. Non of that worked. The only thing that worked was a reboot of homey. Is this a homey problem or app?
I honestly don't know if the problem is the app or Homey. Unfortunately I didn't get the last log.
I have published a new version that logs every error trap I can find. The errors are written to the log even when logging is switched off.
The only thing I can think of why the motion stops is if an error occurs that breaks the library out of it's loop. Unfortunately the library uses callbacks everywhere which makes it very difficult to follow (like spaghetti). One day when i get time I would like to rewrite it using modern asynchronous methods so it is more predictable and easier to debug.
If the camera disappears again, can you try the repair option in the device settings page. Is the camera IP address fixed?
Yes the cameras ip address is fixed. I tried the repair function but that didn't help. I have now installed the new version. Should I send the log right away when a problem appears or should I restart the app before I send it?
This app is my favorite and I have 35 apps so I really hope it well be stable (if the problem isn't homey)
Yes, send it when the problem appears please.
Motion stopped working. Sent log. Did you get it?
Yep, got the log thanks. As suspected there was an error. Now I have a starting place to find out why it doesn't try to create the pull point again after a failed attempt. I will investigate further this evening and either find a solution or add more logging to trace the route.
Thank you. Disable and enable the motion button through Flows is not working either (the button is not turning on/off) , I have tried this because after a reboot of the app I need to disable and enable motion to get motion to work.
Edit 1: Motion stopped working again and there is no way I can get it to work again. I have turned off/on motion, restarted the app. Picture is still working. Only thing that solved it was a reboot of Homey.
Edit 2: Sent a new log. Rebooted my router, rebooted your app, tried to fix it by the repair function but camera is not available. The camera is still on my network with the same ip address and working with reolink app.
I have published a new version. This fixes the flow actions. For some reason I had rem'd out the code. I think I am losing the plot. Hopefully I have also found the path through the code where the network error stops the pull events from renewing.
However, I am not sure what, if anything, I can do about the problem in second / third logs. The EHOSTUNREACH error means Homey couldn't find a way to connect to the camera. The ONVIF app uses the node.js http library, more specifically the http.request method to communicate. This is a standard library so it should be robust. I will ask around to see if anyone else knows if Homey has a specific issue. All I can say is my Homey / H.View camera work with motion detection active for days without issue. I am running Homey V5 firmware which has updated node.js so not sure if that has fixed any issues.
Sent a new log. What is eventpull error 1? Got a bunch of them and I can't get motion to work at all on this version. I have now connected my camera with cable instead of wifi and moved homey 2 meters from my router to see if this helps. I'm also running homey on v5 (rc26) maby there is something wrong on my Homey because sometimes I also lose connection to some of my shelly devices, then I have to restart my router or homey to fix it.
The createPullPointSubscription error is saying the http request to create the pull point has failed. This error is passed back down the chain and caught by the event pull method, which displays the _eventPull error 1 before Repeating the new create pull point request. So _eventPull error 1 is a good sign as it shows the system is now retrying after the error.
I'm still a bit mystified why the error message is just {} as that is not showing why the error occurred so I will investigate that further.
I noticed that the camera changed ip address when I contacted the came with cable. Errors seem to be gone now when I added the camera again but motion is still not working at all. Also seems like the app don't receive motion image. Now Image works
Sent a log.
I have published another version. The only way I can see that the create pull point can get an error without http._request posting an error message is if the error is generated in the soap parser. So this one has more logging in the parser to see why it fails to decode the message that must be coming back.
Installed it, restart the app, turned motion on off, sent a new log. The app won't register motion and no motion image are received.
I have published another version. The camera is returning an error message but it's not very helpful. So this new version goes back to logging what is sent.
Allright 🙂 sent you a new log.
Sorry I should have asked you to turn on logging.
I tried again, but when I turn on logging it turns off automatically within seconds. Sent a log, did you get it?
Sorry, the log hasn't come through.
I have tried to add the camera a bunch of times but still no picture. Invalid_picture_buffer