IpCamera: New IP Camera Binding

This is the log when camera is running normally, then I turn its power OFF then back ON:

==> /var/log/openhab/events.log <==
2022-09-05 20:18:52.792 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Nam_Lastseen' changed from 2022-09-05T20:18:22.502+0700 to 2022-09-05T20:18:52.786+0700
2022-09-05 20:18:53.940 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Today_Consumption' changed from 6.307 to 6.308
2022-09-05 20:18:53.949 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Current' changed from 1.46 to 1.459
2022-09-05 20:18:53.951 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Total_Consumption' changed from 250.47 to 250.471
2022-09-05 20:18:53.984 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'This_Month_Power_Cost' changed from 539991.2736 to 539994.01248
2022-09-05 20:18:58.666 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Linh_Lastseen' changed from 2022-09-05T20:18:28.541+0700 to 2022-09-05T20:18:58.661+0700
2022-09-05 20:19:03.883 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Today_Consumption' changed from 6.308 to 6.309
2022-09-05 20:19:03.890 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Total_Consumption' changed from 250.471 to 250.472
2022-09-05 20:19:03.925 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'This_Month_Power_Cost' changed from 539994.01248 to 539996.75136
2022-09-05 20:19:13.897 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Current' changed from 1.459 to 1.457

==> /var/log/openhab/openhab.log <==
2022-09-05 20:18:59.126 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing"><s:Header><wsa5:Action>http://docs.oasis-open.org/wsn/bw-2/SubscriptionManager/RenewResponse</wsa5:Action></s:Header><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-05T13:19:58Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-05T13:18:58Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-05 20:18:59.127 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2022-09-05 20:19:07.142 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header><wsa5:Action>http://www.onvif.org/ver10/events/wsdl/PullPointSubscription/PullMessagesResponse</wsa5:Action></s:Header><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-05T13:19:06Z</tev:CurrentTime><tev:TerminationTime>2022-09-05T13:19:58Z</tev:TerminationTime></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-05 20:19:07.144 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2022-09-05 20:19:07.195 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing"><s:Header><wsa5:Action>http://docs.oasis-open.org/wsn/bw-2/SubscriptionManager/RenewResponse</wsa5:Action></s:Header><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-05T13:20:06Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-05T13:19:06Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-05 20:19:07.197 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2022-09-05 20:19:15.198 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header><wsa5:Action>http://www.onvif.org/ver10/events/wsdl/PullPointSubscription/PullMessagesResponse</wsa5:Action></s:Header><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-05T13:19:14Z</tev:CurrentTime><tev:TerminationTime>2022-09-05T13:20:06Z</tev:TerminationTime></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-05 20:19:15.200 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2022-09-05 20:19:15.266 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing"><s:Header><wsa5:Action>http://docs.oasis-open.org/wsn/bw-2/SubscriptionManager/RenewResponse</wsa5:Action></s:Header><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-05T13:20:14Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-05T13:19:14Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-05 20:19:15.268 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages

==> /var/log/openhab/events.log <==
2022-09-05 20:19:16.649 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'LivingroomLightsSwitch_Humidity' changed from 55.9 to 55.8
2022-09-05 20:19:16.651 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Livingroom_Humidity' changed from 55.9 to 55.8
2022-09-05 20:19:19.419 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Binh_Lastseen' changed from 2022-09-05T20:18:49.306+0700 to 2022-09-05T20:19:19.378+0700
2022-09-05 20:19:23.029 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Nam_Lastseen' changed from 2022-09-05T20:18:52.786+0700 to 2022-09-05T20:19:23.023+0700

==> /var/log/openhab/openhab.log <==
2022-09-05 20:19:23.277 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header><wsa5:Action>http://www.onvif.org/ver10/events/wsdl/PullPointSubscription/PullMessagesResponse</wsa5:Action></s:Header><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-05T13:19:22Z</tev:CurrentTime><tev:TerminationTime>2022-09-05T13:20:14Z</tev:TerminationTime></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-05 20:19:23.281 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2022-09-05 20:19:23.353 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing"><s:Header><wsa5:Action>http://docs.oasis-open.org/wsn/bw-2/SubscriptionManager/RenewResponse</wsa5:Action></s:Header><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-05T13:20:22Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-05T13:19:22Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-05 20:19:23.355 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages

==> /var/log/openhab/events.log <==
2022-09-05 20:19:23.906 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Current' changed from 1.457 to 1.459
2022-09-05 20:19:23.909 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Today_Consumption' changed from 6.309 to 6.31
2022-09-05 20:19:23.912 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Total_Consumption' changed from 250.472 to 250.473
2022-09-05 20:19:23.942 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'This_Month_Power_Cost' changed from 539996.75136 to 539999.49024
2022-09-05 20:19:28.960 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Linh_Lastseen' changed from 2022-09-05T20:18:58.661+0700 to 2022-09-05T20:19:28.953+0700
2022-09-05 20:19:29.789 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Bathroom_Humidity' changed from 69 to 68
2022-09-05 20:19:31.202 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Kitchen_Humidity' changed from 50.7 to 50.8

==> /var/log/openhab/openhab.log <==
2022-09-05 20:19:31.390 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header><wsa5:Action>http://www.onvif.org/ver10/events/wsdl/PullPointSubscription/PullMessagesResponse</wsa5:Action></s:Header><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-05T13:19:30Z</tev:CurrentTime><tev:TerminationTime>2022-09-05T13:20:22Z</tev:TerminationTime></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-05 20:19:31.391 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2022-09-05 20:19:31.447 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing"><s:Header><wsa5:Action>http://docs.oasis-open.org/wsn/bw-2/SubscriptionManager/RenewResponse</wsa5:Action></s:Header><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-05T13:20:30Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-05T13:19:30Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-05 20:19:31.450 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages

==> /var/log/openhab/events.log <==
2022-09-05 20:19:33.911 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Today_Consumption' changed from 6.31 to 6.311
2022-09-05 20:19:33.926 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Power' changed from 301 to 300
2022-09-05 20:19:33.932 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Current' changed from 1.459 to 1.456
2022-09-05 20:19:33.934 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Total_Consumption' changed from 250.473 to 250.474
2022-09-05 20:19:33.962 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'This_Month_Power_Cost' changed from 539999.49024 to 540002.22912

==> /var/log/openhab/openhab.log <==
2022-09-05 20:19:39.476 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header><wsa5:Action>http://www.onvif.org/ver10/events/wsdl/PullPointSubscription/PullMessagesResponse</wsa5:Action></s:Header><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-05T13:19:38Z</tev:CurrentTime><tev:TerminationTime>2022-09-05T13:20:30Z</tev:TerminationTime></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-05 20:19:39.478 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2022-09-05 20:19:39.543 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing"><s:Header><wsa5:Action>http://docs.oasis-open.org/wsn/bw-2/SubscriptionManager/RenewResponse</wsa5:Action></s:Header><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-05T13:20:38Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-05T13:19:38Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-05 20:19:39.545 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages

==> /var/log/openhab/events.log <==
2022-09-05 20:19:43.879 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Total_Consumption' changed from 250.474 to 250.475
2022-09-05 20:19:43.883 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Power' changed from 300 to 301
2022-09-05 20:19:43.884 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Today_Consumption' changed from 6.311 to 6.312
2022-09-05 20:19:43.886 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Current' changed from 1.456 to 1.46
2022-09-05 20:19:43.911 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'This_Month_Power_Cost' changed from 540002.22912 to 540004.96800

==> /var/log/openhab/openhab.log <==
2022-09-05 20:19:45.537 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header><wsa5:Action>http://www.onvif.org/ver10/events/wsdl/PullPointSubscription/PullMessagesResponse</wsa5:Action></s:Header><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-05T13:19:44Z</tev:CurrentTime><tev:TerminationTime>2022-09-05T13:20:38Z</tev:TerminationTime><wsnt:NotificationMessage><wsnt:Topic Dialect="http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet">tns1:VideoSource/MotionAlarm</wsnt:Topic><wsnt:Message><tt:Message UtcTime="2022-09-05T13:19:44Z" PropertyOperation="Changed"><tt:Source><tt:SimpleItem Name="Source" Value="VideoSource000"></tt:SimpleItem></tt:Source><tt:Data><tt:SimpleItem Name="State" Value="true"></tt:SimpleItem></tt:Data></tt:Message></wsnt:Message></wsnt:NotificationMessage></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-05 20:19:45.539 [DEBUG] [amera.internal.onvif.OnvifConnection] - Onvif Event Topic:VideoSource/MotionAlarm, Data:State, Value:true
2022-09-05 20:19:45.541 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew

==> /var/log/openhab/events.log <==
2022-09-05 20:19:45.544 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'CameraMotionAlarm' changed from OFF to ON

==> /var/log/openhab/openhab.log <==
2022-09-05 20:19:45.562 [DEBUG] [ng.ipcamera.internal.IpCameraActions] - Recording ipcamera.gif for 5 seconds.
2022-09-05 20:19:45.564 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-y -t 5 -hide_banner -loglevel warning -rtsp_transport tcp -i rtsp://admin:********@192.168.0.214:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif -r 2 -filter_complex scale=-2:360:flags=lanczos,setpts=0.5*PTS,split[o1][o2];[o1]palettegen[p];[o2]fifo[o3];[o3][p]paletteuse /var/lib/openhab/ipcamera/Livingroom_Imou/ipcamera.gif

==> /var/log/openhab/events.log <==
2022-09-05 20:19:45.569 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'CameraRecordingGif' changed from 0 to 5

==> /var/log/openhab/openhab.log <==
2022-09-05 20:19:45.739 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing"><s:Header><wsa5:Action>http://docs.oasis-open.org/wsn/bw-2/SubscriptionManager/RenewResponse</wsa5:Action></s:Header><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-05T13:20:45Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-05T13:19:45Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-05 20:19:45.740 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2022-09-05 20:19:47.430 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [swscaler @ 0x1cc20b0] deprecated pixel format used, make sure you did set range correctly

==> /var/log/openhab/events.log <==
2022-09-05 20:19:49.525 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Binh_Lastseen' changed from 2022-09-05T20:19:19.378+0700 to 2022-09-05T20:19:49.519+0700
2022-09-05 20:19:53.846 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Nam_Lastseen' changed from 2022-09-05T20:19:23.023+0700 to 2022-09-05T20:19:53.841+0700
2022-09-05 20:19:53.889 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Today_Consumption' changed from 6.312 to 6.313
2022-09-05 20:19:53.891 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Power' changed from 301 to 344
2022-09-05 20:19:53.892 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Power_Factor' changed from 0.95 to 0.92
2022-09-05 20:19:53.895 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Total_Consumption' changed from 250.475 to 250.476
2022-09-05 20:19:53.896 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Current' changed from 1.46 to 1.73
2022-09-05 20:19:53.923 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'This_Month_Power_Cost' changed from 540004.96800 to 540007.70688
2022-09-05 20:19:59.266 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Linh_Lastseen' changed from 2022-09-05T20:19:28.953+0700 to 2022-09-05T20:19:59.258+0700
2022-09-05 20:20:03.902 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Today_Consumption' changed from 6.313 to 6.314
2022-09-05 20:20:03.910 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Power' changed from 344 to 325
2022-09-05 20:20:03.913 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Power_Factor' changed from 0.92 to 0.93
2022-09-05 20:20:03.914 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Current' changed from 1.73 to 1.62
2022-09-05 20:20:03.915 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Total_Consumption' changed from 250.476 to 250.477
2022-09-05 20:20:03.917 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Voltage' changed from 217 to 216
2022-09-05 20:20:03.942 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'This_Month_Power_Cost' changed from 540007.70688 to 540010.44576
2022-09-05 20:20:13.910 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Power' changed from 325 to 324
2022-09-05 20:20:13.914 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Today_Consumption' changed from 6.314 to 6.315
2022-09-05 20:20:13.918 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Current' changed from 1.62 to 1.618

Try with the Alpha build as it has extra logging in it that will be useful, also please tell me when the camera was rebooted as by looking at the logs it is not clear when you do that. If the logs just stop when you reboot, I can not know this info unless you give some extra detail.

That one is important to know as an ONVIF camera defined by the ONVIF spec should have a snapshot url, I would get a camera that follows the spec fully. If I need to re-run tests to see if I can reproduce the issue I would need to emmulate this condition to see what happens. If you use gear that is similar to what the dev/maintainer uses then you will have less issues as you stay in the area that is well tested.

1 Like

This Imou Ranger 2 has no snapshot URL. I’ve searched everywhere on the Internet and see many people have the same issue with this model.
You told me earlier that cameras those not fully ONVIF compliant may cause the problem. I will get another camera that has snapshot URL and fully ONVIF compliant to test and report later

I would try the build I just uploaded as I was able to reproduce an issue and it seems fixed, it has the extra logging removed. The fact that a restart of the binding was fixing it for you, this indicates that it was a bug and not the camera locking up. I would recommend a camera that has a snapshot ability regardless and even better if it has a good reputation.

EDIT:
@downloadme4free
I read through the code of the binding and my guess is that the snapshot generation from the rtsp stream will not restart automatically if your setting up as ONVIF thing type. If you setup as GENERIC thing type it should restart this feature, but not when the binding sees an onvif camera, as all ONVIF cameras should have this feature as the onvif spec states it is mandatory to get onvif compliance. So I would have to change the binding to allow this special use case and run some tests. If your camera does not have motion alarms that onvif gives you, then just setup as generic and you will have a better experience. If I do change the binding, you will still be using it in a way that I do not test any changes against, so bugs can slip through easier. Upgrading the camera is a small amount to get into an area that is better tested and supported.

Finally, I borrowed a Dahua camera DH-IPC-HDW2431TP-AS-S2 to test. As manufacturer said it’s an Onvif Profile S/Profile G/Profile T compliant device. In the binding this camera can be recognized and work as both Onvif and Dahua thing types, and I tried both.

In the things file I have:

Thing ipcamera:dahua:Dahua_Test @ "Livingroom" [ 
 ipAddress="192.168.0.234", 
 username="admin", 
 password="secret",
 snapshotUrl="http://192.168.0.234/cgi-bin/snapshot.cgi?Channel=1"
]

I switch between “dahua” and “onvif” thing, with each thing I test the camera alarm, record GIF, unplug then re-plug the power, and the results are:

With Onvif thing: When camera is working, if connection is lost (at 2022-09-08 21:27:40 in the log) then binding will try to re-connect and camera will go alive again (at 2022-09-08 21:28:48), but camera cannot trigger alarm and recording anymore.

==> /var/log/openhab/openhab.log <==
2022-09-08 21:26:38.028 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2022-09-08 21:26:44.526 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-08T13:26:34Z</tev:CurrentTime><tev:TerminationTime>2022-09-08T13:27:29Z</tev:TerminationTime></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-08 21:26:44.527 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2022-09-08 21:26:44.542 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-08T13:27:35Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-08T13:26:35Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-08 21:26:44.543 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2022-09-08 21:26:49.776 [DEBUG] [ipcamera.internal.MyNettyAuthHandler] - Camera at IP:192.168.0.234 gave a reply with a response code of :500
2022-09-08 21:26:51.036 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-08T13:26:41Z</tev:CurrentTime><tev:TerminationTime>2022-09-08T13:27:35Z</tev:TerminationTime></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-08 21:26:51.037 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2022-09-08 21:26:51.049 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-08T13:27:42Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-08T13:26:42Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-08 21:26:51.051 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages

==> /var/log/openhab/openhab.log <==
2022-09-08 21:26:57.546 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-08T13:26:47Z</tev:CurrentTime><tev:TerminationTime>2022-09-08T13:27:42Z</tev:TerminationTime></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-08 21:26:57.548 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2022-09-08 21:26:57.561 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-08T13:27:48Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-08T13:26:48Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-08 21:26:57.563 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2022-09-08 21:26:58.396 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-08T13:26:49Z</tev:CurrentTime><tev:TerminationTime>2022-09-08T13:27:48Z</tev:TerminationTime><wsnt:NotificationMessage><wsnt:Topic Dialect="http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet">tns1:RuleEngine/CellMotionDetector/Motion</wsnt:Topic><wsnt:Message><tt:Message UtcTime="2022-09-08T13:26:49Z" PropertyOperation="Changed"><tt:Source><tt:SimpleItem Name="VideoSourceConfigurationToken" Value="00000"/><tt:SimpleItem Name="VideoAnalyticsConfigurationToken" Value="00000"/><tt:SimpleItem Name="Rule" Value="00000"/></tt:Source><tt:Data><tt:SimpleItem Name="IsMotion" Value="true"/></tt:Data></tt:Message></wsnt:Message></wsnt:NotificationMessage></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-08 21:26:58.397 [DEBUG] [amera.internal.onvif.OnvifConnection] - Onvif Event Topic:RuleEngine/CellMotionDetector/Motion, Data:IsMotion, Value:true
2022-09-08 21:26:58.399 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2022-09-08 21:26:58.412 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-08T13:27:49Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-08T13:26:49Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-08 21:26:58.415 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2022-09-08 21:26:58.429 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-08T13:26:49Z</tev:CurrentTime><tev:TerminationTime>2022-09-08T13:27:49Z</tev:TerminationTime><wsnt:NotificationMessage><wsnt:Topic Dialect="http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet">tns1:VideoSource/MotionAlarm</wsnt:Topic><wsnt:Message><tt:Message UtcTime="2022-09-08T13:26:49Z" PropertyOperation="Changed"><tt:Source><tt:SimpleItem Name="Source" Value="00000"/></tt:Source><tt:Data><tt:SimpleItem Name="State" Value="true"/></tt:Data></tt:Message></wsnt:Message></wsnt:NotificationMessage></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-08 21:26:58.431 [DEBUG] [amera.internal.onvif.OnvifConnection] - Onvif Event Topic:VideoSource/MotionAlarm, Data:State, Value:true
2022-09-08 21:26:58.432 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew

==> /var/log/openhab/events.log <==
2022-09-08 21:26:58.438 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'DahuaMotionAlarm' changed from OFF to ON

==> /var/log/openhab/openhab.log <==
2022-09-08 21:26:58.447 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-08T13:27:49Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-08T13:26:49Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-08 21:26:58.449 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2022-09-08 21:26:59.024 [DEBUG] [ng.ipcamera.internal.IpCameraActions] - Recording ipcamera.gif for 5 seconds.
2022-09-08 21:26:59.026 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-y -t 5 -hide_banner -loglevel warning -rtsp_transport tcp -i rtsp://admin:********@192.168.0.234:554/cam/realmonitor?channel=1&amp;subtype=0&amp;unicast=true&amp;proto=Onvif -r 2 -filter_complex scale=-2:360:flags=lanczos,setpts=0.5*PTS,split[o1][o2];[o1]palettegen[p];[o2]fifo[o3];[o3][p]paletteuse /var/lib/openhab/ipcamera/Dahua_Test/ipcamera.gif

==> /var/log/openhab/events.log <==
2022-09-08 21:26:59.033 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'DahuaRecordingGif' changed from 0 to 5
==> /var/log/openhab/openhab.log <==
2022-09-08 21:27:00.735 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Guessed Channel Layout for Input Stream #0.1 : mono
2022-09-08 21:27:01.010 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [swscaler @ 0x1e778e0] deprecated pixel format used, make sure you did set range correctly
2022-09-08 21:27:04.944 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-08T13:26:55Z</tev:CurrentTime><tev:TerminationTime>2022-09-08T13:27:49Z</tev:TerminationTime></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-08 21:27:04.947 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2022-09-08 21:27:04.970 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-08T13:27:55Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-08T13:26:55Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-08 21:27:04.972 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2022-09-08 21:27:04.998 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-08T13:26:55Z</tev:CurrentTime><tev:TerminationTime>2022-09-08T13:27:55Z</tev:TerminationTime><wsnt:NotificationMessage><wsnt:Topic Dialect="http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet">tns1:RuleEngine/CellMotionDetector/Motion</wsnt:Topic><wsnt:Message><tt:Message UtcTime="2022-09-08T13:26:55Z" PropertyOperation="Changed"><tt:Source><tt:SimpleItem Name="VideoSourceConfigurationToken" Value="00000"/><tt:SimpleItem Name="VideoAnalyticsConfigurationToken" Value="00000"/><tt:SimpleItem Name="Rule" Value="00000"/></tt:Source><tt:Data><tt:SimpleItem Name="IsMotion" Value="false"/></tt:Data></tt:Message></wsnt:Message></wsnt:NotificationMessage></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-08 21:27:05.000 [DEBUG] [amera.internal.onvif.OnvifConnection] - Onvif Event Topic:RuleEngine/CellMotionDetector/Motion, Data:IsMotion, Value:false
2022-09-08 21:27:05.002 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2022-09-08 21:27:05.041 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-08T13:27:56Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-08T13:26:56Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-08 21:27:05.043 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2022-09-08 21:27:05.072 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-08T13:26:56Z</tev:CurrentTime><tev:TerminationTime>2022-09-08T13:27:56Z</tev:TerminationTime><wsnt:NotificationMessage><wsnt:Topic Dialect="http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet">tns1:VideoSource/MotionAlarm</wsnt:Topic><wsnt:Message><tt:Message UtcTime="2022-09-08T13:26:55Z" PropertyOperation="Changed"><tt:Source><tt:SimpleItem Name="Source" Value="00000"/></tt:Source><tt:Data><tt:SimpleItem Name="State" Value="false"/></tt:Data></tt:Message></wsnt:Message></wsnt:NotificationMessage></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-08 21:27:05.075 [DEBUG] [amera.internal.onvif.OnvifConnection] - Onvif Event Topic:VideoSource/MotionAlarm, Data:State, Value:false
2022-09-08 21:27:05.078 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew

==> /var/log/openhab/events.log <==
2022-09-08 21:27:05.080 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'DahuaMotionAlarm' changed from ON to OFF

==> /var/log/openhab/openhab.log <==
2022-09-08 21:27:05.106 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-08T13:27:56Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-08T13:26:56Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-08 21:27:05.108 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages

==> /var/log/openhab/openhab.log <==
2022-09-08 21:27:11.615 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-08T13:27:01Z</tev:CurrentTime><tev:TerminationTime>2022-09-08T13:27:56Z</tev:TerminationTime></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-08 21:27:11.617 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2022-09-08 21:27:11.630 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-08T13:28:02Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-08T13:27:02Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-08 21:27:11.632 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages

==> /var/log/openhab/openhab.log <==
2022-09-08 21:27:16.163 [DEBUG] [amera.internal.servlet.CameraServlet] - GET:/ipcamera.gif, received from 192.168.0.206
2022-09-08 21:27:16.173 [DEBUG] [amera.internal.servlet.CameraServlet] - GET:/ipcamera.gif, received from 192.168.0.206
2022-09-08 21:27:18.125 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-08T13:27:08Z</tev:CurrentTime><tev:TerminationTime>2022-09-08T13:28:02Z</tev:TerminationTime></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-08 21:27:18.128 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2022-09-08 21:27:18.147 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-08T13:28:09Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-08T13:27:09Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-08 21:27:18.149 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages

==> /var/log/openhab/openhab.log <==
2022-09-08 21:27:24.644 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-08T13:27:14Z</tev:CurrentTime><tev:TerminationTime>2022-09-08T13:28:09Z</tev:TerminationTime></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-08 21:27:24.648 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2022-09-08 21:27:24.661 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-08T13:28:15Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-08T13:27:15Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-08 21:27:24.664 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages

==> /var/log/openhab/openhab.log <==
2022-09-08 21:27:28.559 [DEBUG] [amera.internal.servlet.CameraServlet] - GET:/ipcamera.gif, received from 192.168.0.206
2022-09-08 21:27:28.559 [DEBUG] [amera.internal.servlet.CameraServlet] - GET:/ipcamera.gif, received from 192.168.0.206

==> /var/log/openhab/openhab.log <==
2022-09-08 21:27:31.167 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><tev:PullMessagesResponse><tev:CurrentTime>2022-09-08T13:27:21Z</tev:CurrentTime><tev:TerminationTime>2022-09-08T13:28:15Z</tev:TerminationTime></tev:PullMessagesResponse></s:Body></s:Envelope>
2022-09-08 21:27:31.169 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2022-09-08 21:27:31.182 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics"><s:Header/><s:Body><wsnt:RenewResponse><wsnt:TerminationTime>2022-09-08T13:28:22Z</wsnt:TerminationTime><wsnt:CurrentTime>2022-09-08T13:27:22Z</wsnt:CurrentTime></wsnt:RenewResponse></s:Body></s:Envelope>
2022-09-08 21:27:31.184 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages

==> /var/log/openhab/openhab.log <==
2022-09-08 21:27:40.227 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Unsubscribe
2022-09-08 21:27:40.233 [DEBUG] [amera.internal.onvif.OnvifConnection] - Connecting 192.168.0.234 to ONVIF
2022-09-08 21:27:40.235 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:GetSystemDateAndTime

==> /var/log/openhab/events.log <==
2022-09-08 21:27:40.241 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'ipcamera:onvif:Dahua_Test' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Connection Timeout: Check your IP and PORT are correct and the camera can be reached.

==> /var/log/openhab/openhab.log <==
2022-09-08 21:27:40.282 [DEBUG] [amera.internal.onvif.OnvifConnection] - Camera is not reachable on ONVIF port:80 or the port may be wrong.
2022-09-08 21:27:42.301 [DEBUG] [amera.internal.onvif.OnvifConnection] - Eventloop is shutdown:true
2022-09-08 21:27:44.240 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:27:50.264 [DEBUG] [amera.internal.onvif.OnvifConnection] - Camera is not reachable on ONVIF port:80 or the port may be wrong.

==> /var/log/openhab/openhab.log <==
2022-09-08 21:27:52.243 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:28:00.245 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:28:08.248 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:28:16.251 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:28:24.252 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:28:32.254 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:28:40.255 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80
2022-09-08 21:28:48.257 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80
2022-09-08 21:28:48.268 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.0.234:80/cgi-bin/snapshot.cgi?Channel=1

==> /var/log/openhab/events.log <==
2022-09-08 21:28:48.269 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'ipcamera:onvif:Dahua_Test' changed from OFFLINE (COMMUNICATION_ERROR): Connection Timeout: Check your IP and PORT are correct and the camera can be reached. to ONLINE

==> /var/log/openhab/openhab.log <==
2022-09-08 21:28:48.870 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.0.234:80/cgi-bin/snapshot.cgi?Channel=1

==> /var/log/openhab/openhab.log <==
2022-09-08 21:29:03.919 [DEBUG] [ipcamera.internal.MyNettyAuthHandler] - Camera at IP:192.168.0.234 gave a reply with a response code of :500

==> /var/log/openhab/openhab.log <==
2022-09-08 21:29:25.517 [DEBUG] [amera.internal.servlet.CameraServlet] - GET:/ipcamera.gif, received from 192.168.0.206
2022-09-08 21:29:25.521 [DEBUG] [amera.internal.servlet.CameraServlet] - GET:/ipcamera.gif, received from 192.168.0.206

2022-09-08 21:29:49.307 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Power' changed from 335 to 305
2022-09-08 21:29:49.309 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Today_Consumption' changed from 7.178 to 7.179
2022-09-08 21:29:49.312 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Power_Factor' changed from 0.92 to 0.94
2022-09-08 21:29:49.314 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Total_Consumption' changed from 278.773 to 278.774
2022-09-08 21:29:49.316 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PZEM_Current' changed from 1.626 to 1.441
2022-09-08 21:29:49.341 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'This_Month_Power_Cost' changed from 617509.79424 to 617512.53312
2022-09-08 21:29:52.560 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Linh_Lastseen' changed from 2022-09-08T21:29:22.234+0700 to 2022-09-08T21:29:52.554+0700
2022-09-08 21:29:53.105 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Binh_Lastseen' changed from 2022-09-08T21:29:22.879+0700 to 2022-09-08T21:29:53.098+0700
^C

With Dahua thing: The same situation as Onvif, when camera lost connection (at 2022-09-08 21:19:21) binding re-connected (2022-09-08 21:21:01) and camera can trigger alarm and recording as normal.

==> /var/log/openhab/openhab.log <==
:
2022-09-08 21:18:18.991 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Guessed Channel Layout for Input Stream #0.1 : mono
2022-09-08 21:18:19.232 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [swscaler @ 0x268d2e0] deprecated pixel format used, make sure you did set range correctly
2022-09-08 21:18:21.691 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:41

Code=VideoMotionInfo;action=State;index=0

:
2022-09-08 21:18:22.741 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:41

Code=VideoMotionInfo;action=State;index=0

:
2022-09-08 21:18:26.311 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:41

Code=VideoMotionInfo;action=State;index=0

:
2022-09-08 21:18:26.521 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:41

Code=VideoMotionInfo;action=State;index=0

:
2022-09-08 21:18:26.941 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:41

Code=VideoMotionInfo;action=State;index=0

:
2022-09-08 21:18:28.202 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:41

Code=VideoMotionInfo;action=State;index=0

:

==> /var/log/openhab/openhab.log <==
2022-09-08 21:18:31.561 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:41

Code=VideoMotionInfo;action=State;index=0

:
2022-09-08 21:18:31.980 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:41

Code=VideoMotionInfo;action=State;index=0

:
2022-09-08 21:18:33.451 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:41

Code=VideoMotionInfo;action=State;index=0

:
2022-09-08 21:18:37.634 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:95

Code=VideoMotion;action=Stop;index=0;data={
   "Id" : [ 0 ],
   "RegionName" : [ "Region1" ]
}


:

==> /var/log/openhab/events.log <==
2022-09-08 21:18:37.639 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'DahuaMotionAlarm' changed from ON to OFF

==> /var/log/openhab/openhab.log <==
2022-09-08 21:18:47.724 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:148

Code=RtspSessionDisconnect;action=Start;index=0;data={
   "Device" : "192.168.0.206",
   "StreamType" : "Main",
   "UserAgent" : " Lavf58.20.100"
}


:


==> /var/log/openhab/openhab.log <==
2022-09-08 21:19:03.228 [DEBUG] [amera.internal.servlet.CameraServlet] - GET:/ipcamera.gif, received from 192.168.0.206
2022-09-08 21:19:03.233 [DEBUG] [amera.internal.servlet.CameraServlet] - GET:/ipcamera.gif, received from 192.168.0.206

==> /var/log/openhab/openhab.log <==
2022-09-08 21:19:21.030 [DEBUG] [amera.internal.onvif.OnvifConnection] - Connecting 192.168.0.234 to ONVIF

==> /var/log/openhab/events.log <==
2022-09-08 21:19:21.031 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'ipcamera:dahua:Dahua_Test' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Connection Timeout: Check your IP and PORT are correct and the camera can be reached.

==> /var/log/openhab/openhab.log <==
2022-09-08 21:19:21.032 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:GetSystemDateAndTime
2022-09-08 21:19:21.036 [INFO ] [era.internal.handler.IpCameraHandler] - The alarm stream was not running for camera 192.168.0.234, re-starting it now
2022-09-08 21:19:21.101 [DEBUG] [amera.internal.onvif.OnvifConnection] - Eventloop is shutdown:true
2022-09-08 21:19:25.036 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:19:31.059 [DEBUG] [amera.internal.onvif.OnvifConnection] - Camera is not reachable on ONVIF port:80 or the port may be wrong.
2022-09-08 21:19:33.038 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:19:41.039 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:19:49.041 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:19:57.043 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:20:05.045 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:20:13.047 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:20:21.049 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80
2022-09-08 21:20:29.051 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:20:37.053 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:20:45.055 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:20:53.057 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80

==> /var/log/openhab/openhab.log <==
2022-09-08 21:21:01.059 [DEBUG] [era.internal.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.0.234:80
2022-09-08 21:21:01.069 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.0.234:80/cgi-bin/snapshot.cgi?Channel=1

==> /var/log/openhab/events.log <==
2022-09-08 21:21:01.070 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'ipcamera:dahua:Dahua_Test' changed from OFFLINE (COMMUNICATION_ERROR): Connection Timeout: Check your IP and PORT are correct and the camera can be reached. to ONLINE

==> /var/log/openhab/openhab.log <==
2022-09-08 21:21:01.166 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.0.234:80/cgi-bin/snapshot.cgi?Channel=1
2022-09-08 21:21:02.075 [INFO ] [era.internal.handler.IpCameraHandler] - The alarm stream was not running for camera 192.168.0.234, re-starting it now
2022-09-08 21:21:02.083 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.0.234:80/cgi-bin/eventManager.cgi?action=attach&codes=[All]
2022-09-08 21:21:02.126 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.0.234:80/cgi-bin/eventManager.cgi?action=attach&codes=[All]
2022-09-08 21:21:06.476 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:69

Code=SystemState;action=Pulse;index=0;data={
   "State" : "Active"
}


:
2022-09-08 21:21:06.480 [DEBUG] [era.internal.handler.IpCameraHandler] - Unrecognised Dahua event, Code=SystemState, action=Pulse

==> /var/log/openhab/openhab.log <==
2022-09-08 21:21:15.004 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:41

Code=VideoMotionInfo;action=State;index=0

:
2022-09-08 21:21:15.098 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:96

Code=VideoMotion;action=Start;index=0;data={
   "Id" : [ 0 ],
   "RegionName" : [ "Region1" ]
}


:

==> /var/log/openhab/events.log <==
2022-09-08 21:21:15.102 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'DahuaMotionAlarm' changed from OFF to ON

==> /var/log/openhab/openhab.log <==
2022-09-08 21:21:15.109 [DEBUG] [ng.ipcamera.internal.IpCameraActions] - Recording ipcamera.gif for 5 seconds.
2022-09-08 21:21:15.111 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-y -t 5 -hide_banner -loglevel warning -rtsp_transport tcp -i rtsp://admin:********@192.168.0.234:554/cam/realmonitor?channel=1&amp;subtype=0&amp;unicast=true&amp;proto=Onvif -r 2 -filter_complex scale=-2:360:flags=lanczos,setpts=0.5*PTS,split[o1][o2];[o1]palettegen[p];[o2]fifo[o3];[o3][p]paletteuse /var/lib/openhab/ipcamera/Dahua_Test/ipcamera.gif

==> /var/log/openhab/events.log <==
2022-09-08 21:21:15.115 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'DahuaRecordingGif' changed from 0 to 5

==> /var/log/openhab/openhab.log <==
2022-09-08 21:21:16.351 [DEBUG] [ipcamera.internal.MyNettyAuthHandler] - Camera at IP:192.168.0.234 gave a reply with a response code of :500
2022-09-08 21:21:16.418 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:41

Code=VideoMotionInfo;action=State;index=0

:

==> /var/log/openhab/openhab.log <==
2022-09-08 21:21:17.528 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Guessed Channel Layout for Input Stream #0.1 : mono
2022-09-08 21:21:17.774 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [swscaler @ 0x120c4a0] deprecated pixel format used, make sure you did set range correctly

==> /var/log/openhab/openhab.log <==
2022-09-08 21:21:21.188 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:95

Code=VideoMotion;action=Stop;index=0;data={
   "Id" : [ 0 ],
   "RegionName" : [ "Region1" ]
}


:

==> /var/log/openhab/events.log <==
2022-09-08 21:21:21.194 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'DahuaMotionAlarm' changed from ON to OFF

==> /var/log/openhab/openhab.log <==
2022-09-08 21:21:33.105 [DEBUG] [amera.internal.servlet.CameraServlet] - GET:/ipcamera.gif, received from 192.168.0.206
2022-09-08 21:21:33.107 [DEBUG] [amera.internal.servlet.CameraServlet] - GET:/ipcamera.gif, received from 192.168.0.206

==> /var/log/openhab/openhab.log <==
2022-09-08 21:21:39.404 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:75

Code=InterVideoAccess;action=Pulse;index=0;data={
   "Type" : "WebLogin"
}


:
2022-09-08 21:21:39.405 [DEBUG] [era.internal.handler.IpCameraHandler] - Unrecognised Dahua event, Code=InterVideoAccess, action=Pulse
2022-09-08 21:21:44.106 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is        :--myboundary
Content-Type: text/plain
Content-Length:148

Code=RtspSessionDisconnect;action=Start;index=0;data={
   "Device" : "192.168.0.206",
   "StreamType" : "Main",
   "UserAgent" : " Lavf58.20.100"
}


:
2022-09-08 21:21:44.587 [DEBUG] [amera.internal.servlet.CameraServlet] - GET:/ipcamera.gif, received from 192.168.0.206
2022-09-08 21:21:44.590 [DEBUG] [amera.internal.servlet.CameraServlet] - GET:/ipcamera.gif, received from 192.168.0.206

==> /var/log/openhab/events.log <==
2022-09-08 21:21:44.881 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'DahuaRecordingGif' changed from 5 to 0
^C

So the issue seems to happen only with Onvif thing, not with Dahua thing? Or am I missing some Onvif configuration? Thank you for your patience :smiley:

I think this will be the reason your logs mention a http error 500 and it causes the camera to stop responding for 30seconds when this occurs. You should get better results after doing the work around.

No problem, thank you for taking the time to test and report the results.

1 Like

I have made a PR for this binding with a number of major bug fixes for ONVIF cameras. Anyone using ONVIF events for their alarms should upgrade to the JAR link inside the PR to help test, as should anyone using PTZ features. If you’re using API based cameras without PTZ, then you probably won’t notice any difference, but it’s good to have people test nothing got broken. The risk of that is very very low as I have been testing the changes on my production system for over a week now and its far better. Installing the telstick binding fixes any Netty dependency issues.

[ipcamera] Fix ONVIF fails to reconnect by Skinah · Pull Request #13396 · openhab/openhab-addons (github.com)

@downloadme4free
I made a change that should auto use ffmpeg for your cameras snapshots that is ONVIF and missing the snapshot url. I also made a change so it should use this to detect if the camera is online/offline/rebooting, however during my tests, it appears ffmpeg does not exit and seems to hang when the camera reboots. To be clear this happens when running ffmpeg on the command line via the termina,l as well as in the binding, so it is not a binding bug but not the way I want it to work long term. Originally I did test this a year or more back and it did work when the network cable was pulled out of the camera, so my guess is that my ffmpeg version 4.1.9 has a bug that is freezing and changing ffmpeg versions may fix this (?). EDIT: I tested the same camera with pulling out the network cable and had the same result of ffmpeg locking up so most likely older versions worked.

@John_Siemon this should work for your camera. This ffmpeg freezing even via the command line will cause issues when I look at doing auto restarts for the ffmpeg alarms.

Can you run a test to see if it exits when you trigger a reboot? This can be done with the hikvision batch configuration program.

Command to use.
ffmpeg -rtsp_transport tcp -i rtsp://admin:password@192.168.1.4:554/Streaming/Channels/1 -update 1 http://127.0.0.1:8080/foo/bar.jpg

Does it exit back to the terminal when the camera reboots or does the output hang and stop updating forever? CTRL + C will close it if that happens. Note the version of ffmpeg you use so I can compare.

Thanks.

2 Likes

@matt1 I downloaded and installed the latest binding from Git, and updated to the latest HikVision Batch Config Tool, but from that point I’m a bit lost. Are u just wanting to use the HikVision Tool to execute the Reboot or to run your commands? I’m thinking the commands are run from the OH console (I’m using OH Docker). I put your commands in a script but I’m unclear on a few things and I get some errors when I run the script so I need some guidance here. First the is rtsp ip address is the OH docker address or the camera ip address? Secondly, http ip address is what, OH docker or camera? Finally the path to /foo/bar.jpg is what?

When I try to run the commands from the console one of the errors I get is “Missing argument for option ‘i’.”

Thanks for your help.

UPDATE:: Ok I’m a bit dense, but I figured out that 3 lines you list as a command are in fact a single line command, the rtsp ip is the camera, and you were referencing Batch Config Tool only to reboot the camera. The command ran and showed output as “frame= 194 fps= 15 q=24.8 size=N/A time=00:00:12.93 bitrate=N/A dup=6 drop=4 speed=1.01x” etc so I figure it is working as expected. When I reboot using Batch Config Tool, the console freezes and DOES NOT restart when the camera is back online in OH. I have to use CTL-C to exit.

That’s confirming my tests. Which ffmpeg version are you using? It gets listed when you run that command. How easy is it for you to test different ffmpeg versions to see if an older version exits cleanly or if a version 5.x branch works without locking up?

This will determine if I need to use more CPU power to watch the ffmpeg output to detect if it stops changing and then force kill the process. If it is only a bug that will get fixed in ffmpeg then it’s less CPU load to not have to do that.

Keen to do the coding to auto restart the ffmpeg alarms if someone can do the tests of older and newer ffmpeg versions and look to see if this is a reported bug on the ffmpeg github page.

I’m currently running ffmpeg version 4.3.4-0+deb11u1. Not sure how easy it would be for me swap out different versions of ffmpeg. I’m running OH in a docker on an Unraid server that is based on Slackware. I’m fairly certain that given time I could do the swap, but the bigger issue for me is time. Starting shortly I will be out of pocket until mid November and not have access to the server for testing.

I was hoping since you use docker, it would be simple to swap out the version for testing, if not then don’t worry about it. I have been doing some thinking about this and feel that the increase in load will not be much, only would happen if the ffmpeg alarm or snapshot creation is running, and would be handy to have in case the thread crashes for other reasons besides the camera rebooting/reconnecting. I want to get this sorted, since I have read the code recently and its all fresh in my head, so getting it done now makes sense and not waiting to see if the problem goes away with a newer ffmpeg version.

EDIT:
@John_Siemon and @downloadme4free
If you’re willing to test an Alpha build of the binding, I made some changes you were both wanting made.

  • FFmpeg snapshots will now auto restart and also take the camera offline if the stream locks up from a camera rebooting. I have tested and it seems to work here the 1 time I tried it.
  • FFmpeg motion alarm should auto restart if the camera reboots, ffmpeg crashes, or goes offline. I have not tested this yet as its late and want to read the github issue on this topic before completing and doing the testing in the next few days.

Feel free to give it a go.

Index of /openhab/IpCameraBinding/ (pcmus.com)

1 Like

I’ve tested the latest binding version at Index of /openhab/IpCameraBinding/ and attached the log here (it’s too big to fit in a post)

I did following actions to test with my Imou Ranger 2:

  • 2022-09-20 22:23:24: Disable the binding
  • 2022-09-20 22:23:28: Re-enable the binding. Camera is successfully connected and starts recording when triggering an alarm at 2022-09-20 22:23:46.
  • 2022-09-20 22:24:37: Unplug then re-plug the camera power, binding is trying to connect but gets some errors “Camera is not reachable on ONVIF port:80 or the port may be wrong.”
  • 2022-09-20 22:25:17: Finally camera is going online again but since then binding cannot receive any alarm from the camera. The issue stays the same.

ipcamera_binding_log.txt (141.9 KB)

@downloadme4free I have looked at the logs and noticed 2 things:

  1. 2022-09-20 22:25:19.183 [DEBUG] [g.ipcamera.internal.onvif.OnvifCodec] - Exception on ONVIF connection: Connection reset by peer
    This means that the camera was responsible for closing the connection and not replying to the request.

  2. The cameras time and date is very wrong, the ONVIF specs actually state that they must be within a short space of time otherwise the spec is that the traffic may be a hacker replaying old captured packets. For security ONVIF should not work with them so far out of sync. Note that they are close in time when it was working, but not close when it failed. Perhaps the camera does not backup the time with a battery and it uses an external server to correct the time with.

When it was working...
2022-09-20 22:23:28.998 [DEBUG] [amera.internal.onvif.OnvifConnection] - Cameras  UTC dateTime is:2022-9-20T15:23:28
2022-09-20 22:23:29.006 [DEBUG] [amera.internal.onvif.OnvifConnection] - Openhabs UTC dateTime is:2022-09-20T15:23:29.003Z

When it failed to start the alarm subscription....
2022-09-20 22:25:17.992 [DEBUG] [amera.internal.onvif.OnvifConnection] - Cameras  UTC dateTime is:2000-1-1T0:0:15
2022-09-20 22:25:18.000 [DEBUG] [amera.internal.onvif.OnvifConnection] - Openhabs UTC dateTime is:2022-09-20T15:25:17.999Z

I would not be surprised if the alarm subscription is failing as you need to renew and subscribe based on times.

@John_Siemon
Can you try the jar that is at this PR for making ffmpeg restart automatically? [ipcamera] FFmpeg based alarms will now auto restart if stopped by Skinah · Pull Request #13446 · openhab/openhab-addons · GitHub
It is testing to work here so you may be able to disable any rules that were used as a work around now.

1 Like

@matt1
As much as I would like to help, unfortunately I am currently away do not have access to my server/dockers for testing purposes. I will not be able to test this new binding until early November which I’m sure doesn’t meet you schedule. However just as an fyi I have been running OH3.3 docker release with ipcamera 3.4.0.202209021001 and a few rules to reconnect and keep ffmpeg alive, all is working very well.

Maybe that’s the point. I will test again this weekend and report later.
The camera is still working with the official Imou Life app on Android, and in the app timezone is set correctly according to my region. I will try to find out the reason why the timezone is so wrong

The camera will be getting the correct time from what is called an NTP server, which is why it allows the timezone to be changed.

The camera rebooting has wiped the time as it does not retain the time like more expensive cameras do. The binding tries to connect before the camera has fetched the time from the NTP. If you ever isolated the camera behind a NVR or firewall this would be a hurdle.

I suspect the camera is refusing to talk as openHAB is 22+ years in the future. So both points are connected to the reason it stops.

I am not sure about the best way to tackle this that won’t potentially break for another camera.

A rule that pauses the camera for a certain amount of time before unpausing it could be a work around triggered by the camera going offline.

I’ll have to think about this one for a way forward.

1 Like

hi matt,

I’m having some issues with the proxy stream… have a couple of ESP32CAMs (which just allow one stream with default project), but proxying has worked fine.
Then I changed and tried out on the thing properiets (e.g. gif preroll “variations”) and suddenly, the proxying is not working anymore…

what I tried so far:

  • removed the cam thing
  • recreated from scratch
  • restarted oh / system
  • checked ffmpeg output folder / properties
  • reinstalled the binding
Thing ipcamera:generic:esp32cam "ESP"
[
    ipAddress="192.168.100.57", 
    gifPreroll=1,
    pollTime=1000, 
    ipWhitelist="DISABLE",
    snapshotUrl="http://192.168.100.57/capture",
    mjpegUrl="http://192.168.100.57:81/stream",
    ffmpegInputOptions="-f mjpeg",
    ffmpegOutput="/tmpfs/openhabcams/espbell/", 
    ffmpegInput="http://192.168.100.57:81/stream"
]

here’s the log, when I open a 2nd stream:

22:11:05.566 [DEBUG] [camera.internal.servlet.CameraServlet] - GET:/ipcamera.mjpeg, received from 192.168.100.14
22:11:05.571 [DEBUG] [camera.internal.servlet.CameraServlet] - First stream requested, opening up stream from camera
22:11:05.953 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.100.57:81/stream
22:11:05.998 [DEBUG] [mera.internal.handler.IpCameraHandler] - Setting Content-Type to:multipart/x-mixed-replace;boundary=123456789000000000000987654321
22:11:23.096 [DEBUG] [camera.internal.servlet.CameraServlet] - GET:/ipcamera.mjpeg, received from 192.168.100.14
22:11:23.099 [DEBUG] [camera.internal.servlet.CameraServlet] - Not the first stream requested but the stream from camera was closed
22:11:23.464 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.100.57:81/stream
22:11:23.484 [DEBUG] [mera.internal.handler.IpCameraHandler] - Setting Content-Type to:multipart/x-mixed-replace;boundary=123456789000000000000987654321

1st: any idea’s, why “the stream from the camera was closed” ?

2nd: is it also possible to add a timestamp to the stream?
e.g.

ffmpeg -y -i input.mp4 -vf "drawtext=fontfile=roboto.ttf:fontsize=36:fontcolor=yellow:text='%{pts\:gmtime\:1575526882\:%A, %d, %B %Y %I\\\:%M\\\:%S %p}'" -preset ultrafast -f mp4 output.mp4

as in the docu is described, the ffmpegInputOptions "Allows you to specify any options before the -i ".

what I just found…

I just commented the “mjpegUrl=” and started a stream. ffmpeg is now started:

21:29:13.747 [DEBUG] [camera.internal.servlet.CameraServlet] - GET:/ipcamera.mjpeg, received from 192.168.100.14
21:29:13.753 [DEBUG] [camera.internal.servlet.CameraServlet] - First stream requested, opening up stream from camera
21:29:13.760 [DEBUG] [nhab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-f mjpeg -hide_banner -loglevel warning -i http://192.168.100.57:81/stream -q:v 5 -r 2 -vf scale=640:-2 -update 1 http://127.0.0.1:8080/ipcamera/esp32cam/ipcamera.jpg

21:30:12.875 [DEBUG] [camera.internal.servlet.CameraServlet] - GET:/ipcamera.mjpeg, received from 192.168.100.14
21:30:13.450 [DEBUG] [camera.internal.servlet.CameraServlet] - GET:/ipcamera.mjpeg, received from 192.168.100.14
21:30:19.163 [DEBUG] [camera.internal.servlet.CameraServlet] - Now there are 2 ipcamera.mjpeg streams open.

but the framerates are pretty low.
so I uncommented the mjpeg section and closed all browsers…
I expected again a high framerate and the same behaviour as on my post before…
but it behaves different…

I cannot help you unless it is a bug in the binding. The esp32 is a very low powered device and can have any number of firmwares loaded and I have no idea on what firmware you have loaded or what choices the firmware made. Because of the low powered CPU, the chip can not do high res and high frame rate video at the same time as regular snapshots. It has its limits and perhaps the firmware is making changes based on this. All I can suggest is you test the urls directly from the camera to see the results and compare, but when your getting snapshots the camera is not as capable for video, there is a trade off to be made.

I really think you should look at spending $10 more on a camera at least and you will get a far better result. The cheapest thing you can buy is not always the best VALUE you can buy. My esp32 cam just sits in the draw and only comes out when I need to run a test.

EDIT @maDDin1338
I did fix a bug last week that is merged that may have been the issue. But pausing and unpausing the camera or restarting openhab would reset things. If your using ffmpeg to create the stream and then edit the cameras settings to go back, it would not go back. The jar in this github PR will solve that or you can pause as a work around till the next milestone is released in a few weeks time.

[ipcamera] Fix ONVIF fails to reconnect by Skinah · Pull Request #13396 · openhab/openhab-addons (github.com)

Yes you can do that with the record to mp4 action. I use this to create mp4 files for each person that rings the doorbell that is timestamped. Then there is a MP4 history widget that makes displaying the recordings easy for the main UI. However you still have the issue with esp32 cameras that the stream is in mjpeg format and it takes a lot of CPU grunt to transcode it to h264. The widget could be modified easily to do the same with the GIF recording feature.

See the rule in this post for timestamps on the mp4 and gif recordings…
Custom Widget: Camera History and Live Popup - Apps & Services / HABPanel - openHAB Community

This post for the updated mainUI OH3 widget.
Camera MP4 Recording History and Live HLS - Add-on Marketplace / UI Widgets - openHAB Community

No idea, can you describe a way to reproduce this reliably? Suggest testing if the stream can be opened in a browser direct from the camera after pausing the thing.

Hi matt,

yes, indeed it’s not the best solution, currently it’s still WIP, later on there will come up better cams.
Just right now, I’m using the default example Code:

which is capable of streaming (1 client) and snapshotting without video breakup. on 640*480 it’s around 18-22fps, which is totally fine.

The proxying worked fine, had one stream opened in Firefox, one on Edge, one on a mobile device, but I’m not able to get it to run once again, so that I could bring you up the steps to reproduce…
I’m just always running into the same issue right now.

Opening the stream via the esp’s webinterface is working, cause it breaks up the (running) openhab stream.

After pausing and starting the thing, same behaviour…

Will continue to try and if I find a way to reproduce, will let you know.

thx 4 now.

EDIT:
@matt1 just checked you 3.4 build, same behaviour…
Just checked the binding Code… in CameraServlet.java line 177 ff:

if (openStreams.isEmpty()) {
	logger.debug("First stream requested, opening up stream from camera");
	handler.openCamerasStream();
	if (handler.mjpegUri.isEmpty() || "ffmpeg".equals(handler.mjpegUri)) {
		output = new StreamOutput(resp);
	} else {
		output = new StreamOutput(resp, handler.mjpegContentType);
	}
} else {
	if (handler.mjpegUri.isEmpty() || "ffmpeg".equals(handler.mjpegUri)) {
		output = new StreamOutput(resp);
	} else {
		ChannelTracking tracker = handler.channelTrackingMap.get(handler.mjpegUri);
		if (tracker == null || !tracker.getChannel().isOpen()) {
			logger.debug("Not the first stream requested but the stream from camera was closed");
			handler.openCamerasStream();
			openStreams.closeAllStreams();
		}
		output = new StreamOutput(resp, handler.mjpegContentType);
	}
}

So the handler gets lost of the Tracking (handler.channelTrackingMap.get(handler.mjpegUri); )
That cause’s the Stream’s to be closed and started from scratch, instead of adding another output.

Next question, why is it lost… or… why it is not added to the tracking map when started…