I believe I’m having a similar issue with my FOSCAM 9803 and 9831 cameras. I had both of them working fine in OH2. Now that I’ve migrated to OH3 I can get motion detection working using the ONVIF capabilities of the cameras. However it doesn’t persist a restart of OH. Here are the details:
- I’ve installed the cameras by adding the camera things manually using the “FOSCAM with API” thing
- Other than setting the Username, Password, and Server port settings, I’ve left everything as default
- ffmpeg is installed using “apt”
- Video feeds work fine
- I’ve set up the motion detection settings on the camera’s setup pages with detection area and schedule
- ONVIF port is 888 on camera and OH settings
Here’s some excerpt from the logs on initial setup. Everything seems OK:
2021-01-27 08:57:49.015 [DEBUG] [era.internal.handler.IpCameraHandler] - File server for camera at 192.168.50.83 has started on port 8063 for all NIC's.
2021-01-27 08:57:49.021 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:GetSystemDateAndTime
2021-01-27 08:57:49.441 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsdd="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:chan="http://schemas.microsoft.com/ws/2005/02/duplex" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:wsc="http://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:xmime="http://tempuri.org/xmime.xsd" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tdn="http://www.onvif.org/ver10/network/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl"><SOAP-ENV:Body><tds:GetSystemDateAndTimeResponse><tds:SystemDateAndTime xsi:type="tt:SystemDateTime"><tt:DateTimeType>NTP</tt:DateTimeType><tt:DaylightSavings>true</tt:DaylightSavings><tt:TimeZone xsi:type="tt:TimeZone"><tt:TZ>CST5:00:00DST1:00:00,M1.1.0/2,M12.5.0/2</tt:TZ></tt:TimeZone><tt:UTCDateTime xsi:type="tt:DateTime"><tt:Time xsi:type="tt:Time"><tt:Hour>12</tt:Hour><tt:Minute>57</tt:Minute><tt:Second>47</tt:Second></tt:Time><tt:Date xsi:type="tt:Date"><tt:Year>2021</tt:Year><tt:Month>1</tt:Month><tt:Day>27</tt:Day></tt:Date></tt:UTCDateTime><tt:LocalDateTime xsi:type="tt:DateTime"><tt:Time xsi:type="tt:Time"><tt:Hour>8</tt:Hour><tt:Minute>57</tt:Minute><tt:Second>47</tt:Second></tt:Time><tt:Date xsi:type="tt:Date"><tt:Year>2021</tt:Year><tt:Month>1</tt:Month><tt:Day>27</tt:Day></tt:Date></tt:LocalDateTime></tds:SystemDateAndTime></tds:GetSystemDateAndTimeResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
Other that this little blip, which doesn’t seem to be concerning:
2021-01-27 08:57:49.826 [DEBUG] [amera.internal.onvif.OnvifConnection] - deviceXAddr:/onvif/device_service
2021-01-27 08:57:49.827 [DEBUG] [amera.internal.onvif.OnvifConnection] - We hit an issue parsing url:/
2021-01-27 08:57:49.827 [DEBUG] [amera.internal.onvif.OnvifConnection] - mediaXAddr:/onvif/device_service
2021-01-27 08:57:49.827 [DEBUG] [amera.internal.onvif.OnvifConnection] - ptzXAddr:/onvif/device_service
2021-01-27 08:57:49.828 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:GetProfiles
2021-01-27 08:57:50.313 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
After a bit more initialization I just get a continuous stream of this:
2021-01-27 08:57:53.117 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.50.83:88/cgi-bin/CGIProxy.fcgi?usr=openhab&pwd=OpenHAB3&cmd=snapPicture2
However, motion detection doesn’t work, even though “enableMotionAlarm” is ON (by default). In order to get motion detection to work, I have to do this:
-
Turn “enableMotionAlarm” OFF, then back ON
-
This starts showing up in the logs:
2021-01-27 09:21:31.355 [DEBUG] [era.internal.handler.IpCameraHandler] - End of FOSCAM handler reached, so closing the channel to the camera now
2021-01-27 09:21:31.355 [DEBUG] [era.internal.handler.IpCameraHandler] - Reply is chunked.
2021-01-27 09:21:31.355 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is :
The XML data seems to indicate that the motion alarm is enabled: <motionDetectAlarm>1</motionDetectAlarm>
But the motion detection STILL doesn’t work. The reason is that the detection area and schedule have been reset in the settings of the cameras. Finally, if I go in and change these settings in the camera setup, motion detection will work.
But, if and when I restart OH, I have to repeat the above process. I’ve even put the “enableMotionAlarm” in persistance as “restoreOnStartup”, but that doesn’t seem to help.
Any thoughts?
Thanks again for the great work and help!
EDIT: Additional info: If I try to add the cameras using the auto-discover, it discovers them as “ONVIF”, not “FOSCAM with API”. Should I use the autodiscover instead of the “FOSCAM with API”? I can’t find any definitive documentation whether these cameras have an API but it seems to me that they should.