INSTAR Deutschland GmbHINSTAR Deutschland GmbH

BlueIris MQTT with ioBroker



MQTT Alarmserver

We already set up BlueIris to update an MQTT Topic when an alarm is triggered by our camera (shortname black). This MQTT Topic is BlueIris/MotionAlarm/8015black/ and the payload is 1 at the beginning of the alarm event and 0 once the events ended.

Blue Iris for your INSTAR IP Camera

We can now access this data point in ioBroker and write a small Blockly Script to handle such events:

Blue Iris for your INSTAR IP Camera

I now want to use this event to switch the camera into Fullscreen View when it triggered an alarm. I can do this with the BlueIris Admin Command Topic BlueIris/admin and the two payloads camera=black&fullscreen=1 and camera=black&escape.

black in those payloads is the camera short name that I assigned to this camera in BlueIris - please substitute it with your cameras short name.

Blue Iris for your INSTAR IP Camera

When the MQTT Topic BlueIris/MotionAlarm/8015black/ is updated with the payload 1 the camera with the short name black will switch into fullscreen. It falls back into the standard multiview once the topic is updated back to 0.

Controlling BlueIris with MQTT

Additionally, we can use the rest of the BlueIris Admin Command Topics to take control over BlueIris from the ioBroker Vis - for example we can start and stop the video recording for a camera with a radio button.

Start by creating a new Boolean Datapoint in ioBroker that should signify the state of the manual recording as true or false:

Blue Iris for your INSTAR IP Camera

Select this button inside your Blockly Script:

Blue Iris for your INSTAR IP Camera

And use it to start a recording when it is true with the Admin Topic payload camera=black&manrec=1 and stop it on false with camera=black&manrec=0:

black in those payloads is the camera short name that I assigned to this camera in BlueIris - please substitute it with your cameras short name.

Blue Iris for your INSTAR IP Camera

Now add a radio button to your ioBroker Vis and assign it the boolean datapoint you created in the first step:

Blue Iris for your INSTAR IP Camera

Now BlueIris will start recording when you toggle the switch:

Blue Iris for your INSTAR IP Camera

Blockly Script Export

<xml xmlns="http://www.w3.org/1999/xhtml">
  <block type="on_ext" id="5:E8z%?$kF2:_228=Fsl" x="-937" y="-1112">
    <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.BlueIris.MotionAlarm.8015black</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">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.BlueIris.admin</field>
            <field name="WITH_DELAY">FALSE</field>
            <value name="VALUE">
              <block type="text" id="u2H{{k$7nO+({(J4,2,C">
                <field name="TEXT">camera=black&amp;fullscreen=1</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">0</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.BlueIris.admin</field>
                <field name="WITH_DELAY">FALSE</field>
                <value name="VALUE">
                  <block type="text" id="13|%(`^fM,_w499|gkt-">
                    <field name="TEXT">camera=black&amp;escape</field>
                  </block>
                </value>
              </block>
            </statement>
          </block>
        </next>
      </block>
    </statement>
  </block>
  <block type="on_ext" id="Ei}KT7e($1cGLin{;UTm" x="-937" y="-812">
    <mutation items="1"></mutation>
    <field name="CONDITION">ne</field>
    <field name="ACK_CONDITION"></field>
    <value name="OID0">
      <shadow type="field_oid" id="ln]r4[0V5_L!]U5KPfb@">
        <field name="oid">mqtt.0.Vis.BlueIris_Black_Recording</field>
      </shadow>
    </value>
    <statement name="STATEMENT">
      <block type="controls_if" id=")cMCX)J;8M59C5H`Rli!">
        <value name="IF0">
          <block type="logic_compare" id="t53#:CqYz.mr75mrlYA:">
            <field name="OP">EQ</field>
            <value name="A">
              <block type="on_source" id="dltx$H=ML^odTRKTDg_|">
                <field name="ATTR">state.val</field>
              </block>
            </value>
            <value name="B">
              <block type="logic_boolean" id="91YBG0;5yLS/zYmx_;OE">
                <field name="BOOL">TRUE</field>
              </block>
            </value>
          </block>
        </value>
        <statement name="DO0">
          <block type="control" id="PiTjfdeQA.nk^iRB#koj">
            <mutation delay_input="false"></mutation>
            <field name="OID">mqtt.0.BlueIris.admin</field>
            <field name="WITH_DELAY">FALSE</field>
            <value name="VALUE">
              <block type="text" id=")$.%lh([i}CH$zN+~]r7">
                <field name="TEXT">camera=black&amp;manrec=1</field>
              </block>
            </value>
          </block>
        </statement>
        <next>
          <block type="controls_if" id="Im2Hbj,A0f3)]^CiE5]Z">
            <value name="IF0">
              <block type="logic_compare" id="WHPuRxbS%P[g|c(?/T)B">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="on_source" id="GqIv8M.dGKe%zW-(CzGz">
                    <field name="ATTR">state.val</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id="PT)u9X[u)2vObE%^zBR4">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
              </block>
            </value>
            <statement name="DO0">
              <block type="control" id="!{Xp%f@G0yYXd$svb})Z">
                <mutation delay_input="false"></mutation>
                <field name="OID">mqtt.0.BlueIris.admin</field>
                <field name="WITH_DELAY">FALSE</field>
                <value name="VALUE">
                  <block type="text" id="F[;Bz;NO72gV|)$HN3Fu">
                    <field name="TEXT">camera=black&amp;manrec=0</field>
                  </block>
                </value>
              </block>
            </statement>
          </block>
        </next>
      </block>
    </statement>
  </block>
</xml>