@matt1
After checking on Wbox is working now. Only small remarks:
after restart need to click 2 times to change state (after is ok)
if you will change area of motion control from browser directly on camera and switch motion control from openhab it will back to previosly selected area (restart of openhab is fixing this issue).
Another question, I have introduced a new camera, with a login and password, but in the log appears one password that it’s not mine??!? Can you understand/explain me this?
First of all please use code fences when posting any text that needs to be accurate. Your post has the curly ‘smart quotes’ in it and they often cause issues with openhab but since you did not use code fences it is probably from that…
I am confused by this part, perhaps you know something I dont but try removing that and make it look like the examples in the readme.md file.
Yes that happens if the REFRESH for the control is never called. If you restart the server it is called, but if you edit the settings of the camera it never gets called and hence that happens. Perhaps someone can tell me if there is a way to trigger a refresh? maybe from a rule or timer/cron?
See above as it is related, the refresh stores the state, then when you move the control the stored state is used, modified and then uploaded to the camera. If there is a way to do a refresh every X amount of time that would solve your problem, I just did not want to fetch the state every second as that is too much overhead.
Hi - This is working on a budget ONVIF setup (SANNCE) but there is some sort of memory leJ, so after a while it brings my PI3 to its knees:
This is the error stream
2018-07-12 16:30:28.750 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - Can't find ch when removing handler URL:null
2018-07-12 16:30:33.415 [WARN ] [me.core.internal.events.EventHandler] - Dispatching event to subscriber 'org.eclipse.smarthome.core.internal.items.ItemUpdater@117ca3a' takes more than 5000ms.
==> /var/log/openhab2/events.log <==
2018-07-12 16:30:31.780 [vent.ItemStateChangedEvent] - frontDoorCam changed from raw type (image/jpeg): 112395 bytes to raw type (image/jpeg): 112601 bytes
==> /var/log/openhab2/openhab.log <==
2018-07-12 16:30:30.261 [WARN ] [eclipse.jetty.servlet.ServletHandler] -
javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.OutOfMemoryError: Java heap space
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489) [170:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) [170:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) [170:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) [170:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) [170:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76) [15:com.eclipsesource.jaxrs.publisher:5.3.1.201602281253]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848) [85:org.eclipse.jetty.servlet:9.3.21.v20170918]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:584) [85:org.eclipse.jetty.servlet:9.3.21.v20170918]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) [186:org.ops4j.pax.web.pax-web-jetty:6.0.9]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) [82:org.eclipse.jetty.security:9.3.21.v20170918]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:284) [186:org.ops4j.pax.web.pax-web-jetty:6.0.9]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) [85:org.eclipse.jetty.servlet:9.3.21.v20170918]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) [186:org.ops4j.pax.web.pax-web-jetty:6.0.9]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.eclipse.jetty.server.Server.handle(Server.java:534) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283) [76:org.eclipse.jetty.io:9.3.21.v20170918]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108) [76:org.eclipse.jetty.io:9.3.21.v20170918]
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) [76:org.eclipse.jetty.io:9.3.21.v20170918]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) [87:org.eclipse.jetty.util:9.3.21.v20170918]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) [87:org.eclipse.jetty.util:9.3.21.v20170918]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) [87:org.eclipse.jetty.util:9.3.21.v20170918]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) [87:org.eclipse.jetty.util:9.3.21.v20170918]
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) [87:org.eclipse.jetty.util:9.3.21.v20170918]
at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: org.glassfish.jersey.server.ContainerException: java.lang.OutOfMemoryError: Java heap space
at org.glassfish.jersey.servlet.internal.ResponseWriter.rethrow(ResponseWriter.java:278) ~[?:?]
at org.glassfish.jersey.servlet.internal.ResponseWriter.failure(ResponseWriter.java:260) ~[?:?]
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:509) ~[173:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:334) ~[173:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) ~[172:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) ~[172:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[172:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.internal.Errors.process(Errors.java:297) ~[172:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.internal.Errors.process(Errors.java:267) ~[172:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) ~[172:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) ~[173:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) ~[173:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473) ~[170:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
... 31 more
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3332) ~[?:?]
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124) ~[?:?]
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:448) ~[?:?]
at java.lang.StringBuffer.append(StringBuffer.java:270) ~[?:?]
at java.io.StringWriter.write(StringWriter.java:101) ~[?:?]
at com.google.gson.stream.JsonWriter.string(JsonWriter.java:587) ~[?:?]
at com.google.gson.stream.JsonWriter.value(JsonWriter.java:419) ~[?:?]
at com.google.gson.internal.bind.TypeAdapters$16.write(TypeAdapters.java:422) ~[?:?]
at com.google.gson.internal.bind.TypeAdapters$16.write(TypeAdapters.java:406) ~[?:?]
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) ~[?:?]
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:208) ~[?:?]
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:145) ~[?:?]
at com.google.gson.Gson.toJson(Gson.java:669) ~[?:?]
at com.google.gson.Gson.toJson(Gson.java:648) ~[?:?]
at com.google.gson.Gson.toJson(Gson.java:603) ~[?:?]
at com.google.gson.Gson.toJson(Gson.java:583) ~[?:?]
at org.eclipse.smarthome.io.rest.core.internal.GsonProvider.writeTo(GsonProvider.java:71) ~[?:?]
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265) ~[172:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250) ~[172:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) ~[172:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106) ~[?:?]
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) ~[172:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86) ~[?:?]
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) ~[172:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130) ~[172:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:711) ~[173:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444) ~[173:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434) ~[173:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:329) ~[173:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) ~[172:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) ~[172:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[172:org.glassfish.jersey.core.jersey-common:2.22.2]
Unfortunately this makes it a non starter.
Any ideas what is causing the crash?
I have only got 2 webcams running for now and have only enabled the image channels for now.
I am displaying them in HabPanel (which I am guessing due toi the strain on the PI seems to be unable to refresh the images too)
@bulletprooffool
I am working blind as I don’t have your camera nor do I have the TRACE log output that I can use to see what is going on. Once the OOM occurs the logs are useless, I will need to see some output BEFORE the first of the errors start as no memory causes things that work normally to stop, thus making diagnosis much harder. I am happy to say I do not see that issue so it may be a conflict with another binding, a leak that only happens when a camera does a certain thing I have not thought of, or you may need to increase the heap size. I use VisualVM to look for leaks but the last build I skipped checking it, so worth going back to some older builds to see if it still occurs. One build is marked as using the old backend, try that one.
Also post how you are using the image channel. Are you using it in an item file and then passing it onto Habpanel as an Item?
@Syn @Kristo
Thanks that looks exactly what I was hoping could be done. It is a REFRESH command that currently stores the settings for HIK only, other cameras thankfully do it a different way. I may take a look at other solutions in the binding to take care of this in the future as the plan was always to fetch and then use the cameras fresh response but this part of the code has not been written. For now I would create a rule that calls the refresh, sleeps for >100ms and then changes the setting as you need to wait for the reply to come back from the camera.
I seem to be able to embed images in Habpanel, but I have not quite figured out how to publish the RTSP stream so it plays as a video feed. Has anyone got this working?
My guess is your camera creates a random password for when handing out the link via onvif. This is probably not an issue, what appears to be the cause of the error is a space in the URL at the end. This is why I print a dash in the logs to show where a string ends. Enter in a snapshot manually to over ride just be sure to test the link in a browser to make sure it works as the random password may expire.
When I question onvif port, I can do it without provide any user/password, then you don’t have to force the user and password that I put in the configuration?
Sorry I am not sure I know what you are asking or if are having an issue?
Yes the binding should allow you to have no user/pass with onvif, however I do not test this very often and hence there could be bugs. If your camera does not have PTZ or you dont care about that feature you can deliberately put the ONVIF port to the wrong number and provide a snapshot over ride and the camera is then much faster to connect as it will skip the ONVIF.
Lastly in a few replies recently people have smart quotes showing, these are tiny 6 and 9 looking quotes and they cause issues with Openhab if you paste them into config files. Please use code fences as it saves new comers issues if they try to cut and paste things from the forum, here is how:
jwiseman
(Mr. Wiseman (OH 4.2 Snapshot on Pi4))
366
Just wanted to say thank you! and kudo’s to you on this binding!
I got it running quickly with this setup:
Synology DSM 6.x running OH2.3 querying against HIKVision Model DS-7208HUI-K2
When I start adding cameras, even just one, Openhabian starts freaking out. Everything grinds to a halt and the logs shows repeated java heap space errors. This is repeatable. And persisted even after totally re-imaging the SD card.
Is there anything specific I have to do to get motion detect to work with foscam or amcrest cameras? According to logs binding connects to camera -
2018-07-14 19:02:38.764 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Camera is reporting that it supports PTZ control with Absolute movement via ONVIF
2018-07-14 19:02:50.672 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Finished with PTZ with no errors, now fetching the Video URL for RTSP from the camera.
I also created 2 items - Motion detect on/off and Motion detect switch and linked them to channels. Openhab v 2.3
Here is debug log. Trying to enable/disable motion. If I copy/past url to browser and authenticate then it works.
2018-07-14 20:00:25.069 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera at IP:x.x.x.x, URL:/cgi-bin/configManager.cgi?action=setConfig&MotionDetect[0].Enable=true
2018-07-14 20:00:25.069 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Just locked in main1
2018-07-14 20:00:25.069 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Just unlocked main1
@jwiseman
Thanks, I have put the model of your camera in the list that are confirmed to work. How do you find 8 cameras work regarding CPU load and what kind of server? I’m still punching down cables at the moment and building a house on top of many projects Your habpanel looks great.
@Pedals2Paddles
See the first post of this thread. Follow how to create some TRACE log output and then PM it to me after doing a quick find/replace on your passwords. The log needs to be from BEFORE the oom error so I can see how your camera behaves in the binding, I use this to then step through the code to look for faults. Please also provide what camera you have and some more info on your system so we can start looking at any patterns from people that report this. Lastly it would also be a good idea to remove all bindings except this one and see if it works, then add them back 1 at a time if it does.
No, just check in the cameras setup if you have changed the port away from what the binding uses. Yes your camera connects to ONVIF which is good, but the API uses a different port number and that may not be matching. Your log output was a little short to see what happens when the first HTTP request is made of the camera. TRACE output gives more info in the logs to DEBUG and to fault find this I would need TRACE level as it includes the replies back from the camera which sometimes give clues.