ioBroker Blockly Script Engine

ioBroker comes with a Blockly Adapter that - very similar to Node-RED - allows you to create small scripts with a graphical user interface. You can install it from the Adapters tab:

ioBroker Blockly Script Engine

ioBroker Blockly Script Engine

Click on the Scripts tab to load the Blockly interface:

ioBroker Blockly Script Engine

Click on the New Script icon:

ioBroker Blockly Script Engine

And choose the Blockly Script Engine to load the Blockly interface:

ioBroker Blockly Script Engine

Drag a Trigger - Event: if object block onto the canvas:

ioBroker Blockly Script Engine

Click on the Object ID to assign a trigger to the object:

ioBroker Blockly Script Engine

We are using the MQTT adapter to send messages to our IP camera. And we already learnt that, if a message arrives, we will see it inside the ioBroker Objects tab. For testing we can use the program MQTT.fx to send messages via MQTT, receive them in ioBroker and use them as a trigger in our Blockly script.

We already connected MQTT.fx to our MQTT server and am now publishing a message iobroker/alarmserver/triggered. Once we click Publish we see the corresponding entry in the ioBroker Objects List:

ioBroker Blockly Script Engine

Going back to our Blockly script, clicking on the Object for the Trigger block will open the lists of objects registered with ioBroker - we can find the message we just send under mqtt.0/iobroker/alarmserver/triggered. Select triggered for our trigger object:

ioBroker Blockly Script Engine

Now add another block to our script - in this case a Sendto block for the Pushover Adapter:

ioBroker Blockly Script Engine

Add Text Blocks:

ioBroker Blockly Script Engine

Connect them to the Pushover Block wherever appropriate and add some text to the push notification. Note a little trick we use here:

Link to a Camera inside your InstarVision App

Nehmen wir an, Sie verwenden Ihr Blockly-Skript, um jedes Mal, wenn der Alarm einer Kamera ausgelöst wird, eine Push-Benachrichtigung zu senden. Sie können der Nachricht eine URL hinzufügen, die die besagte Kamera direkt in unserer Android-App InstarVision öffnet! Geben Sie einfach iv://Name der Kamera in das URL-Feld ein. Als Namen der Kamera müssen Sie den Namen wählen, den Sie ihr innerhalb der InstarVision App gegeben haben (stellen Sie sicher, dass der Name keine Leerzeichen oder Sonderzeichen enthält).

Wenn die Benachrichtigung eintrifft, verwenden Sie diesen Link, um die Live-Ansicht der Kamera direkt in der Android-App zu öffnen (Die App muss im Hintergrund laufen, sonst wird das Multiview-Fenster angezeigt).

ioBroker Blockly Script Engine

Save the script and make sure that it is running.

ioBroker Blockly Script Engine

Go back to MQTT.fx and resend the message:

ioBroker Blockly Script Engine

The push notification will be triggered and arrive at your smartphone seconds afterwards:

ioBroker Blockly Script Engine