OpenHab Camera as an Item?

Hey guys, I’m trying to add a camera feed into Rotini, but I’m not really sure where to start in OpenHab. The widget in Rotini requests an Item, but OpenHab doesn’t have a “Camera” item type. There is an Image type, but there isn’t much help on how to define it*.

Right now the camera feed is available on the network as an rtsp url, but I’m feeding that into motioneye to play with. Motioneye gives me several urls:

  • MPEG Streaming
  • JPEG Snapshot - needs to be auto refreshed
  • HTML Embed

Any ideas on the best way to tackle this?

  • I’ve taken a note to go back and suggest an edit to the doc once I sort this out…

Currently, camera widget doesn’t support static URLs, so there is no way to use it with OpenHAB yet. You would be able to use MJPEG with it in the future.
As a temporary workaround, web widget might be used, but it would heavier on resources.

Ok, then how can I use the Camera widget as it is now? What kind of item would I bind it to? What do you mean “doesn’t support status urls”? Is there any other kind?

I meant that you cannot use camera widget with OH yet, since there is no way to enter a URL. That functionality should be coming soon.

1 Like

@dinodog next release will have support for String items that have URL state in Camera widget.

You would need to define an item to hold URL, JPEG snapshot in your case:

String Camera_Snapshot "Camera Snapshot"

Then one way to do assign state to that item is to create a startup rule:

rule "Startup"
  when
    System started
  then
    Camera_Snapshot.postUpdate("http://host/snapshot.jpg")
end

Preview 14 version is out.

Man, you’re fast! :slight_smile:

Ok, so I created an item:

String	FrontDoorCam	"Front Door Cam"

Then I have a rule to populate this on system start:

rule "System start stuff"
when 
	System started
then
	FrontDoorCam.postUpdate( "http://servername/picture/1/current/" )
end

I verified the url above does have the current image, then I restarted Openhab to trigger the rule. I checked out the Karaf console and using the items list command, I see:

FrontDoorCam (Type=StringItem, State=http://servername/picture/1/current/, Label=Front Door Cam, Category=null)

But then in Rotini, when I add a widget and select the Camera type, I go to bind then Item and the list is empty.

I tried restarting Rotini several times. Any ideas?

Ok, so the reason is that URL for your camera is generic, so it is not clear that it is a camera image (jpeg or something) from UI perspective. Let me see how it can be resolved.

Ah, I see. This is motioneye if that helps at all.

I managed to get the motioneye cameras showing on Rotini by using the “embed url” from motioneye and a web widget with javascript enabled. They actually show up great!

Glad you managed to get it working another way!
The original issue is also fixed for the next release.

Hey @igor I’ve setup my item and rule in OpenHAB and can see this in the event log…

SecCam1_URL changed from NULL to http://192.168.1.91:85/image/SECCAM01/

But in my widget it shows as this? What can we do to get the URL correct?

@TommySharp there seem to be a bug with URL processing, even when it is an absolute URL and should be used as is. Needs investigation.

@TommySharp URL bug is fixed for the next release

I can’t get this method to work:

Item:
String CameraKitchenURL “”

Rule code during startup:
CameraKitchenURL.postUpdate(“http://172.16.1.242:8080/static/Kitchen.jpg”)

Error:
2018-04-19 12:43:23.480 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Error during the execution of startup rule ‘System starup initialization’: Couldn’t invoke ‘assignValueTo’ for feature JvmVoid: (eProxyURI: Startup.rules#|::0.2.0.2.0.74::0::/1)

@milty456 I would suggest checking on OH community as well.
I don’t see anything wrong with that config, and it looks the same as the one I’m using myself.
What OH version are you on?

An old one :slight_smile: OH2 from March of Last year; i dont have the heart to upgrade it and deal with all the things that will break in OH :slight_smile: Which is why i keep harping on letting me use legacy :slight_smile:

Going to use the web widget and see if that works