Custom Widget: Camera with PTZ controls

UPDATE: If using openHAB 3, see this newer main UI widget OH3 Widget: Move a PTZ camera - Add-ons / UIs - openHAB Community

There are 3 main camera widgets that I have created:

  • A clickable camera widget that is easier to setup compared to this one due to no Pan Tilt Zoom (PTZ) controls.Click here for forum thread
  • One that matches the clickable widget and also includes PTZ controls that are only shown after you click on the thumbnail.Click here for forum thread
  • And this widget here that can not be clicked and displays the PTZ controls that allow you to move the camera.

This is my first attempt at creating a Habpanel widget, so feel free to suggest changes and mod it to your needs. All styles have been left off to allow any css or themes that you choose to effect how this looks. If you have improved it in any way then please post a picture.

To setup the widget:

  • Give the widget a URL and tell the binding what format the url is providing. Mjpeg and HLS both work here.
  • gotoPreset channel item is needed so you can move the camera with ONVIF presets. These are what the numbers do.
  • PTZ RELATIVE and also CONTINUOUS movement controls
  • Motion Alarm channel (icon will display to indicate alarm state)
  • Audio Alarm channel (icon will display to indicate alarm state)
  • Any item that you want to switch ON and OFF.

Json file is attached or it can be downloaded from the widget gallery inside the Habpanel editor…

camera-ptz.widget.json (6.2 KB)


ohhhhh :innocent:

thank you matt, still not using habpanel , maybe when i move in to the new house
i have that exact smart device , how did you get it to go to sleep at 9:52 :stuck_out_tongue_closed_eyes:

He’s only pretending, he knows that I am watching :grin: Yes they are a very smart device.

Is it intended that the PTZ controls are reversed? Arrow Up moves the camera down etc.

It does not do that on two different brands of cameras here. Since cameras can be mounted on the roof vs floor they usually have flip and Mirror settings in the firmware. Worse case you can easily edit the json yourself to fix.

I have tested with ODM and it sends x=“0.1” when pressing the right arrow and the camera moves right.
When I send INCREASE to the PAN channel then the binding sends x=“0.05” to the camera and the camera moves right.
So, INCREASE is moving right. In this widget and in the binding doc examples, DECREASE is being used for moving right.
Not super important, just saying. Maybe the camera reports something wrong via onvif back.