Foscam and IpCamera: New IP Camera Binding not working in OpenHAB2.4

Tags: #<Tag:0x00007f387398b270> #<Tag:0x00007f387398b0e0> #<Tag:0x00007f387398ae38>

Hi.
I’m new to Openhab, smart home stuff and so on.
I have installed Openhab2.4 via the APT methode on my ubuntu 18.04 machine.
I have succesfully added my Tasmota Sonoff powerswitch S26 to Openhab by using manual config files. I also have succesfully added my Kodi instance by manually using config files.
All is working well.

But now I am trying to configure my Foscam camera (Fosbaby P1) which supports ONVIF and API. But I’m not able to get it done and could use some help. It is frustrating me.

First, I’m from Holland so my English might not be perfect ;-).

Oke, now for the good stuff.

My foscam.things is configured like this:

// foscam.things
// bron:Idea for FOSCAM camera binding

Thing ipcamera:FOSCAM:Evi “Babyfoon Evi” @ “Slaapkamer” [
IPADDRESS=“192.168.XXX.XXX”,
PORT=88,
ONVIF_PORT=888,
USERNAME=“myUser”,
PASSWORD=“myPws”,
ONVIF_MEDIA_PROFILE=0,
POLL_CAMERA_MS=2000
] {}
###########################################################
###########################################################

My foscam.items is configured like so:

// foscam.items
// bron:Idea for FOSCAM camera binding

Switch foscam_updimg “Afbeelding Update” { channel=“ipcamera:FOSCAM:Evi:updateImageNow” }

But my camera stays on Status: UNINITIALIZED in the paper UI. I cannot get past this point.

I have a test openhab environment in which I test all my stuff, This test environment resides on a ubuntu laptop. when correctly configured is goes onto my server (Which is also Ubuntu 18.04). On my test machine I have reinstalled openhab several times and tried the Ipcamera binding serval times via the PAPERUI (Which also ends up with the same error (Status: UNINITIALIZED) But during configuring via de PAPERUI it also gives me error 500 Request failed on first save. On second save it gives me a error 409 Conflict.

I have tested the following urls and they all work.
Video MPEG
http://192.168.XXX.XXX:88/cgi-bin/CGIStream.cgi?cmd=GetMJStream&usr=myUser&pwd=myPws
Video H.264
rtsp://myUser:myPws@192.168.XXX.XXX:88/videoMain

Audio
rtsp://myUser:myPws@192.168.XXX.XXX:88/audio

In short, my foscam does not work, and I could use some help…
Steps taken:

Install openhab, install ipbinding, setup camera via PAPER UI. Results in error 500 and 409. And status uninitialized

(No manual config)

#Remove openhab

#Reinstall openhab, install ipbinding, configure foscam via manual config files only (See above) resulting in status uninitialized.

ps: I’m using fixed IP addresses for all my items (configured in the router).
Help?

I have tried the Beta version also, but same result.

Thank you for all your help and support.

Regards Onac

Try this in your things file and do not add anything extra until you have a camera coming online, most of the options have defaults that work hence why the ports are not in this file as they are the standard ports for Foscam. In future please use code fences.

Thing ipcamera:FOSCAM:Evi [IPADDRESS="192.168.xxx.xxx", PASSWORD="password", USERNAME="admin", POLL_CAMERA_MS=2000]

If this does not work, then you need to post some of the log output when you turn on TRACE output, this is covered in the readme file how to do this.

Thank you for your quick reply! Aprreciate it.

As soon as I updated my foscam.things with your code and removed mine nothing happend unfortunatly…

What I did notice was the following in the openhab.log (this happens with your suggested config and my own config, and also with the PAPERUI config.)

The log spits out a lot of code…

2019-03-14 10:48:09.671 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'foscam.things'
2019-03-14 10:48:09.678 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.NoClassDefFoundError: javax/xml/soap/SOAPException
	at org.openhab.binding.ipcamera.handler.IpCameraHandler.<init>(IpCameraHandler.java:2028) ~[?:?]
	at org.openhab.binding.ipcamera.internal.IpCameraHandlerFactory.createHandler(IpCameraHandlerFactory.java:46) ~[?:?]
	at org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory.registerHandler(BaseThingHandlerFactory.java:128) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.ThingManagerImpl.doRegisterHandler(ThingManagerImpl.java:600) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.ThingManagerImpl.registerHandler(ThingManagerImpl.java:577) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.ThingManagerImpl.registerAndInitializeHandler(ThingManagerImpl.java:1073) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.ThingManagerImpl.thingUpdated(ThingManagerImpl.java:532) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyTrackers(ThingRegistryImpl.java:218) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyListenersAboutUpdatedElement(ThingRegistryImpl.java:142) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyListenersAboutUpdatedElement(ThingRegistryImpl.java:1) ~[?:?]
	at org.eclipse.smarthome.core.common.registry.AbstractRegistry.updated(AbstractRegistry.java:288) ~[?:?]
	at org.eclipse.smarthome.core.common.registry.AbstractRegistry.updated(AbstractRegistry.java:1) ~[?:?]
	at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListeners(AbstractProvider.java:62) ~[?:?]
	at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListenersAboutUpdatedElement(AbstractProvider.java:86) ~[?:?]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.lambda$27(GenericThingProvider.java:955) ~[?:?]
	at java.util.ArrayList.forEach(ArrayList.java:1378) ~[?:?]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.createThingsFromModelForThingHandlerFactory(GenericThingProvider.java:963) ~[?:?]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.lambda$4(GenericThingProvider.java:301) ~[?:?]
	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.createThingsFromModel(GenericThingProvider.java:303) ~[?:?]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.modelChanged(GenericThingProvider.java:759) ~[?:?]
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:301) ~[?:?]
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:123) ~[?:?]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:227) ~[?:?]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.processWatchEvent(FolderObserver.java:291) ~[?:?]
	at org.eclipse.smarthome.core.service.WatchQueueReader.lambda$3(WatchQueueReader.java:323) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:844) [?:?]
Caused by: java.lang.ClassNotFoundException: javax.xml.soap.SOAPException cannot be found by org.openhab.binding.ipcamera_2.5.0.201903101141
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484) ~[?:?]
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395) ~[?:?]
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387) ~[?:?]
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150) ~[?:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:499) ~[?:?]

If I leave the foscam.things empty it does not generate that code. If needed I will alse try to get that trace output you requested.

Your help is much appreciated!

Allright, problem found, Camera online, and usable in openHAB2. Somewhere in the installation instructions of installing openHAB there was told to install a special java version 10 or something… So I did. After reading the error and duckduckgo-ing on it (same like googling on it) I found out that java 8 was required, so I installed it, rebooted openhab and tadaaaa it works… Jeej!

I’m not a programmer or developer, but I think that this IpCamera binding needs to be updated to work with newer java version ? possibly? On my test machine its no problem but on my server it is going to be an issue. I use te server for more things that use newer versions of Java. Is it possible to update the binding to a newer java version ? (Just a thought)

Entire Openhab recommends you use java V8 and zulu is preferred. See documentation for Openhab on installing requirements.

You are absolutly right sir!, My bad! I misread that information. Please accept my humble apology. I really am sorry. And thank you for your help! It was much apreciated!