Alle ioBroker Tutorials
- ioBroker with Docker (Updated 08.04.2024)
- ioBroker on a Raspberry Pi (deprecated)
- INSTAR MQTT - ioBroker
All ioBroker FAQs
- ioBroker v9.1.2 as MQTTv5 Client for your WQHD INSTAR IP Camera
- ioBroker as MQTT Broker for your WQHD Camera
- ioBroker MQTT Alarmserver for your WQHD Camera
- ioBroker REST API with your WQHD Camera
- Using ioBroker with your WQHD Camera
- ioBroker v7 with your WQHD INSTAR MQTTv5 Broker
- Camera Vis with Node-RED
- Live Video and ioBroker VIS
- INSTAR MQTT Alarmserver ioBroker
- ioBroker and INSTAR Alarmserver
- ioBroker MQTT Broker vs Client
- ioBroker as MQTT Broker for your Kamera
- ioBroker MQTT Overwrites Camera Settings
- ioBroker and MotionEye Webhooks
- ioBroker w/o MQTT
Using MQTT to inform ioBroker that an Alarm was Triggered
Q: I found your guide to use the INSTAR (HTTP) Alarmserver. Wouldn't it make more sense to publish those events through the MQTT service that every Full HD cameras offers? This way I would be able to be sure that every alarm event is registered by my ioBroker installation.
A: All alarm events that published by the INSTAR HTTP Alarmserver can now also be accessed through the MQTT Service!
MQTT Alarmserver
The corresponding MQTT Topic is:
alarm/triggered
All you need to do is adding a subscription to the Status Topic and you will receive updates about alarm events as well as what service triggered the alarm:
- Alarmbereich 1 ausgelöst:
1
- Alarmbereich 2 ausgelöst:
2
- Alarmbereich 3 ausgelöst:
3
- Alarmbereich 4 ausgelöst:
4
- Alarm-In / PIR ausgelöst:
5
- Audio Alarm ausgelöst:
6
- Bewegungserkennung & ausgelöst (Bereich 1):
7
- Bewegungserkennung & ausgelöst (Bereich 2):
8
- Bewegungserkennung & ausgelöst (Bereich 3):
9
- Bewegungserkennung & ausgelöst (Bereich 4):
10
Setting up ioBroker
We already published a guide on how to use Node-RED to interact with your MQTT Alarmserver. You can follow this guide if you installed the Node-RED adapter in ioBroker.
In this guide we want to use the Blockly Script Engine instead of Node-RED. You can start by installing it from the Adapter tab:
Now switch to the Scripts tab and select Blockly to add a new script:
You can now start using the Blockly UI to create your alarm server script:
In the following example I re-created the Motion Tracking Example that we previously solved in Node-RED. Please refer to this turorials for details on how to set up your camera for this to work.
Whenever we receive a status update for alarm/triggered
, we have to check if the alarm was triggered by Area 1 - payload will be {"val":"1"}
- or Area 4 - with the payload {"val":"4"}
. If Area 1 was triggered - which is the motion detection area we added to the left side - we have to move our camera one step to the left
. For Area 4 we have to go right
to center the moving object in our cameras field of view.
Note that the camera that I am using here has the MQTT ID
10D1DC21F5DB
. If you import the Blockly script you have to changes this according to your personal cameras ID!
The topics that are used here are:
/status/alarm/triggered
: INSTAR MQTT Alarmserver Status Topic/features/ptz/movestep/raw
: Command topic to move your pan&tilt camera one step to theleft
orright
.
And in addition I added a script that will move my camera to preset position 2, if the camera's Audio Alarm {"val":"6"}
was triggered. This can be done with the following:
/features/ptz/presets/raw
Command topic to move your camera to position0
-7
/alarm/pushalarm
Command topic to trigger an audio alarm on your camera and trigger the preset function in Blockly
XML Export
You can import the complete script into Blockly with the following JSON code. Note that you will have to replace the MQTT ID 10D1DC21F5DB
with your personal cameras ID:
<xml xmlns="http://www.w3.org/1999/xhtml">
<block type="on_ext" id="5:E8z%?$kF2:_228=Fsl" x="-62" y="-112">
<mutation items="1"></mutation>
<field name="CONDITION">ne</field>
<field name="ACK_CONDITION"></field>
<value name="OID0">
<shadow type="field_oid" id="7K},E#*On`zsq^jhPQ9v">
<field name="oid">mqtt.0.instar.10D1DC21F5DB.status.alarm.triggered</field>
</shadow>
</value>
<statement name="STATEMENT">
<block type="controls_if" id="2%z$7WDJUl-dSz+miU(-">
<value name="IF0">
<block type="logic_compare" id="9]pjLD{[W^26TPYM6liS">
<field name="OP">EQ</field>
<value name="A">
<block type="on_source" id="-?/H,NwcYjPh~{p`fc`~">
<field name="ATTR">state.val</field>
</block>
</value>
<value name="B">
<block type="text" id="hKDWmg?WzR9@$Wo4RHj5">
<field name="TEXT">{"val":"1"}</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="control" id="g@M?e*b1_8ezO{_(PUcP">
<mutation delay_input="false"></mutation>
<field name="OID">mqtt.0.instar.10D1DC21F5DB.features.ptz.movestep.raw</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="text" id="u2H{{k$7nO+({(J4,2,C">
<field name="TEXT">left</field>
</block>
</value>
</block>
</statement>
<next>
<block type="controls_if" id="}uq*%|F/Nt=*`rn`|hV4">
<value name="IF0">
<block type="logic_compare" id="|x2u0AR*aTmVC=lfROzF">
<field name="OP">EQ</field>
<value name="A">
<block type="on_source" id="In|(S^y0YVoVN#Y^[.5m">
<field name="ATTR">state.val</field>
</block>
</value>
<value name="B">
<block type="text" id="uC/+7LgdO]A`UdHW*sHC">
<field name="TEXT">{"val":"4"}</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="control" id="K58]j^_|1M4|}D2aF?{u">
<mutation delay_input="false"></mutation>
<field name="OID">mqtt.0.instar.10D1DC21F5DB.features.ptz.movestep.raw</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="text" id="13|%(`^fM,_w499|gkt-">
<field name="TEXT">right</field>
</block>
</value>
</block>
</statement>
<next>
<block type="controls_if" id="JhXZ,A)R?fQ}!et!,!/7">
<value name="IF0">
<block type="logic_compare" id="560g5G|oV?rEcXER(oOD">
<field name="OP">EQ</field>
<value name="A">
<block type="on_source" id="9[A80k}o*RpbflDD2h/:">
<field name="ATTR">state.val</field>
</block>
</value>
<value name="B">
<block type="text" id="._5?cn:Mi%DWgz;OL}v4">
<field name="TEXT">{"val":"6"}</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="control" id="]KIbdkEE?:DEhmZ`)wE=">
<mutation delay_input="false"></mutation>
<field name="OID">mqtt.0.instar.10D1DC21F5DB.features.ptz.preset.raw</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="text" id="1HbkwoM-U/]J2go|iNoe">
<field name="TEXT">2</field>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</xml>