Node-RED

From IOT4
Revision as of 11:01, 6 June 2017 by Admin (talk | contribs)
Jump to navigation Jump to search

Installing Node-RED

First install the Node.js.

When that working install the Node-RED , with command:

sudo npm install -g --unsafe-perm node-red

Running the Node-RED

If installed globally (-g) , just simply need to enter the command:

$ node-red

Welcome to Node-RED
===================

25 Feb 22:51:09 - [info] Node-RED version: v0.14.6
25 Feb 22:51:09 - [info] Node.js  version: v4.6.0
25 Feb 22:51:09 - [info] Loading palette nodes
25 Feb 22:51:10 - [warn] ------------------------------------------
25 Feb 22:51:10 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node
25 Feb 22:51:10 - [warn] ------------------------------------------
25 Feb 22:51:10 - [info] Settings file  : /home/nol/.node-red/settings.js
25 Feb 22:51:10 - [info] User Directory : /home/nol/.node-red
25 Feb 22:51:10 - [info] Server now running at http://127.0.0.1:1880/
25 Feb 22:51:10 - [info] Creating new flows file : flows_noltop.json
25 Feb 22:51:10 - [info] Starting flows
25 Feb 22:51:10 - [info] Started flows

If you started a screen before the command can run it in the background.

Using the Node-RED

You can open it in a browser http://home.local:1880 if you installed the Avahi daemon, else can open on the http://device_ip:1880.

Domoticz Wacthdog with notification Email

[{"id":"c865297.04cbbd8","type":"mqtt in","z":"1ca87a70.def406","name":"domoticz_out","topic":"domoticz/out","qos":"0","broker":"4d90d7c6.0e6488","x":268,"y":104,"wires":[["eb2aa9ff.0e6358","c0ddce19.226f1","6a3f7e96.f6296"]]},{"id":"eb2aa9ff.0e6358","type":"debug","z":"1ca87a70.def406","name":"","active":true,"console":"false","complete":"payload","x":554,"y":179,"wires":[]},{"id":"c2648e2c.adeab","type":"e-mail","z":"1ca87a70.def406","server":"smtp.gmail.com","port":"465","secure":true,"name":"1234@gmailcom","dname":"to_jrobi772","x":1010,"y":240,"wires":[]},{"id":"c0ddce19.226f1","type":"trigger","z":"1ca87a70.def406","op1":"","op2":"Nincs uj adat","op1type":"nul","op2type":"str","duration":"30","extend":true,"units":"s","reset":"","name":"watchdog","x":540,"y":240,"wires":[["643f2552.191abc"]]},{"id":"643f2552.191abc","type":"exec","z":"1ca87a70.def406","command":"sudo service domoticz.sh restart","addpay":true,"append":"","useSpawn":"","timer":"","name":"restart domoticz","x":760,"y":240,"wires":[["c2648e2c.adeab"],[],[]]},{"id":"4d90d7c6.0e6488","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"node_red_orangepi","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]

If you import this will be look like this picture: Watchdog.png Maybe need to update the mqtt_in mqtt server address, email settings and if you have few devices, in the watchdog timer need to set more second to trigger.