All camera functions of your INSTAR Full HD camera can be controlled through the HTTP/S CGI interface. This is the interface that is used by the web user interface and all INSTAR smartphone apps. In the Smarthome and Internet-of-Things (IoT) realm there is another protocol that is widely in use and that offers a few advantages over the classical HTTP - the protocol is called MQTT. Adding an MQTT interface* to our Full HD cameras makes adding those cameras to an existing Smarthome - almost - too easy :)
Configure your INSTAR MQTT Broker
Activate MQTT | The MQTT service is deactivated by default. Use this switch to start the broker. |
Use external MQTT Broker | By default the internal 127.0.0.1 broker is used. If you want to connect your camera to a different broker activate the option here and type in it's address below. |
MQTT Server address | Leave this value at 127.0.0.1 to use the internal broker. When you activated the option to use an external broker type in it's address here. |
MQTT Server Port | This is the port the MQTT broker uses to connect to clients without TLS encryption. The default value is 1883 |
MQTT Server Port (SSL) | This is the port the MQTT broker uses to connect to clients with TLS encryption. The default value is 8883 |
Authentication | Authentication has to be active, if you are using your camera as broker. If you already use an external broker set up without user authentication you can deactivate it here. |
Username | Type in the username you want to use to access the MQTT broker. |
Password | Add the corresponding password here. |
Download Client Certificate | When you are using the TLS encryption for your MQTT network each client needs to have a client key to be allowed to connect to your broker. This key can be downloaded here. |
Upload Server Certificate | The MQTT broker uses an official CA certificate for the TLS encryption - the same one that is used to connect with your camera using HTTPS. If you require a custom certificate for your MQTT network you can upload it here. |
Attention
The username and password may not contain more then 30 characters. The following special characters are currently supported: ! # ( ) * - . / ? @ [ ] ^ _ { | } <
. The following special characters are not supported: ä ö ü ´ " ' , \> ; ~ $ § % +
How to talk MQTT
When you are interested in using the MQTT interface to add your camera to a smarthome system, you are probably already familiar with our HTTP/S CGI interface that you can use to send commands to your camera through your web browser.
MQTT works much the same way. Every CGI command corresponds to an MQTT topic and every topic can carry specific payloads. For example to activate the first Motion Detection Area on your camera, you can send the following CGI command:
param.cgi?cmd=setmdattr&-name=1&-enable=${val}
Where the value (val
) can be 0
or 1
- depending on whether you want to deactivate or activate the detection area.
In MQTT doing the same thing looks like this:
alarm/area1/enable {"val":"0"}, {"val":"1"}
The topic to switch the area on or off is alarm/area1/enable
and you have to send either a value of 1
or 0
to switch it.
You can find an overview over all available MQTT topics and their Payload here.
Syntax
In order to send an MQTT command to the camera, an instar/
must first be prepended. To address exactly the right camera you now have 3 options. Either you use /local/
to address the camera on which the MQTT Broker is running. Or you can name a specific camera by its (LAN!) MAC address. For example, if the LAN MAC of your camera is 10:D1:DC:21:8F:96
, then the MQTT ID of this camera is 10D1DC218F96
and the MQTT Topic must contain /10D1DC218F96/
to address the camera. And last but not least you have the possibility to address all cameras in the MQTT network at once via /all/
:
instar/local/alarm/area1/enable
instar/10D1DC218F96/alarm/area1/enable
instar/all/alarm/area1/enable
After you have updated such a command topic, your camera will return a status topic to tell you that everything worked:
instar/local/alarm/area1/enable
Command Topicinstar/local/status/alarm/area1/enable
Status Topic
More information can be found in our MQTT Topics and Payloads Overview.
What Software can I use this with?
We are collecting an ever growing list of software that is compatible with the MQTT protocol. An easy way to get started are Dashboard and Testing applications that can be installed on your Android phone or under Windows or macOS:
Both Android apps are simple dashboards that allow you to control your camera through the MQTT interface. In case of the desktop apps, they are used to test your connection to your camera, record interactions between your camera and client application and to debug your MQTT network.
You can also check the MQTT logon your camera to debug your setup. All error messages will be listed here:
http://Kamera-IP/tmpfs/mqtt-log
For compatible Smarthome Systems please check out our guides for :
- Home Assistant
- OpenHAB 2
- Athom Homey
- Android Apps
- Windows & macOS Apps
- Node-RED
- Homematic
- Loxone
- homee
- IOBroker
- FHEM
And more to follow...
Please read our FAQ if you want to use a self-signed SSL certificate for the INSTAR MQTT-Broker.
* Eclipse Mosquitto
The INSTAR MQTT Interface is build upon the Eclipse Mosquitto open source MQTT broker. The source code can be downloaded from Github and is available under the Eclipse Public License 2.0.