UniPi

An example of controlling the UniPi via Node-RED.

Requires the evok api for UniPi installed from http://github.com/UniPiTechnology/evok and running.

More detailed documentation and complex solution using IBM Bluemix can be found at http://unipi.technology/wiki/Controlling_UniPi_over_Node-RED_and_IBM_Bluemix

[{"id":"a3c2ed71.5c3d1","type":"websocket-client","path":"ws://127.0.0.1/ws","wholemsg":"false"},{"id":"4072282f.bf8dd8","type":"websocket out","name":"","server":"","client":"a3c2ed71.5c3d1","x":761,"y":324,"z":"166cb75.fe99349","wires":[]},{"id":"e09a01a9.1f66","type":"inject","name":"R1 ON","topic":"","payload":"{\"dev\":\"relay\", \"circuit\":\"1\", \"value\":\"1\"}","payloadType":"string","repeat":"","crontab":"","once":false,"x":461,"y":322,"z":"166cb75.fe99349","wires":[["4072282f.bf8dd8"]]},{"id":"afe6d4fc.501928","type":"inject","name":"R1 OFF","topic":"","payload":"{\"dev\":\"relay\", \"circuit\":\"1\", \"value\":\"0\"}","payloadType":"string","repeat":"","crontab":"","once":false,"x":461,"y":358,"z":"166cb75.fe99349","wires":[["4072282f.bf8dd8"]]},{"id":"b69e1c4b.4961e","type":"inject","name":"AO set 5V a","topic":"","payload":"{\"dev\":\"ao\", \"circuit\":\"1\", \"value\":\"5\"}","payloadType":"string","repeat":"","crontab":"","once":false,"x":447,"y":284,"z":"166cb75.fe99349","wires":[["4072282f.bf8dd8"]]},{"id":"dc4842e8.23b7c","type":"websocket in","name":"","server":"","client":"a3c2ed71.5c3d1","x":237,"y":466,"z":"166cb75.fe99349","wires":[["7bf07b0c.840f84","6dd388d.f922c78"]]},{"id":"7bf07b0c.840f84","type":"debug","name":"","active":true,"console":"false","complete":"payload","x":481,"y":560,"z":"166cb75.fe99349","wires":[]},{"id":"6dd388d.f922c78","type":"function","name":"IN 1-7 -> RELAY 1-7","func":"var status = JSON.parse(msg.payload);\nvar msg = {};\nif (status.dev == \"input\" && status.circuit<8) {\n\t//leave the relay 8 to the temp control node\n\tif (status.value == 0) {\n\t\tmsg.payload = {\"dev\":\"relay\", \"circuit\":\"\", \"value\":\"0\"};\n\t\tmsg.payload[\"circuit\"] = status.circuit;\n\t}\n\telse {\n\t\tmsg.payload = {\"dev\":\"relay\", \"circuit\":\"\", \"value\":\"1\"};\n\t\tmsg.payload[\"circuit\"] = status.circuit;\n\t}\n\treturn msg;\n}\nelse return;\n","outputs":1,"x":499,"y":466,"z":"166cb75.fe99349","wires":[["4072282f.bf8dd8"]]}]
tomashora

Flow Info

created 2 years, 2 months ago

Node Types

Core
  • debug (x1)
  • function (x1)
  • inject (x3)
  • websocket in (x1)
  • websocket out (x1)
  • websocket-client (x1)

Tags

  • UniPi
  • Raspberry
  • Websocket
  • Cloud
  • Bluemix
  • IoT
  • Input
  • Digital
  • Analog
  • 1Wire
  • Temperature
  • Humidity
  • Relay
  • Output
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option