This is how you add an INSTAR Full HD MQTT camera to the OpenHAB 2.5 PaperUI.
MQTT Broker
You start by configuring the MQTT broker inside the cameras webUI under Network. Here you can set:
- MQTT Server Address: Leave at 127.0.0.1 to use the internal broker
- MQTT Server Port: Default 1883, adjust if needed
- Username /Password: Set your own login
Now go to the PaperUI Add-Ons Menu and click on the Bindings tab. To be able to connect to the INSTAR MQTT Server we need to install the MQTT Binding - make sure that you choose the Version 2.
Then open your Inbox, click the plus icon, then Add Manually and choose an MQTT Broker.
The broker address is the IP of our INSTAR Full HD camera. Add the port and login you choose in the earlier step. After confirming your settings, you should see that the MQTT broker is listed as ONLINE in the Things menu.
MQTT Interface
The complete MQTT API is documented here. It basically mirrors the cameras webUI. E.g. to switch the motion detection areas you have to navigate the webUI to Alarm / Areas. The MQTT topic to switch Area 1 on or off is alarm/area1/enable
. The payload of this topic is:
-
{“val”:”0”}
/switch off -
{“val”:”1”}
/switch on
Since we can have more than one camera on our network, we also need to add an ID for the camera we want to contact. This ID always starts with instar
followed by local
(to contact the camera that runs the MQTT broker), all
(to send the message to all INSTAR cameras on the MQTT network) or the LAN MAC address of a camera to target it specifically:
instar/local/alarm/area1/enable
instar/all/alarm/area1/enable
instar/000389888811/alarm/area1/enable
And one more thing – every of those, so called COMMAND Topics, also has a corresponding STATE Topic:
instar/local/alarm/area1/enable
instar/local/status/alarm/area1/enable
We use the first one to update / switch something on our camera and – once this happened successfully – receive a state update to set the state of our Paper UI switch.
MQTT Things
Just like you added the MQTT broker you can now add a Generic MQTT Thing name it Alarm Areas
and bridge it with the broker you just added (See tutorial on Github) for more screenshots).
Confirm your edits and click on the MQTT Thing you just created to add a channel with the following configuration:
- Channel type: On/Off Switch
- Channel ID: AlarmArea1
- Channel type: Alarm Area 1
-
MQTT State Topic:
instar/local/status/alarm/area1/enable
-
MQTT Command Topic:
instar/local/alarm/area1/enable
-
Custom ON Value:
{"val": "1"}
-
Custom OFF Value:
{"val": "0"}
- QoS: At least Once
Now all we have to do is linking everything to an UI element of type switch. Switch to the Control tab – it should now hold a switch that can activate and deactivate the alarm area 1 on your camera.
Automations
The MQTT API documentation covers the complete set of functions the camera offers. All ready to go to be connected to a UI element or an automation script inside OpenHAB.