Node-Red Flow to use Bosch Indego with Loxone (e.g.)
Connect your Bosch Indego with MQTT to Loxone
You will need some other components:
- mosquitto
- node-red-contrib-httpauth
- https://github.com/zazaz-de/iot-device-bosch-indego-controller (compiled for your architecture)
See https://github.com/sbernhard/Node-Red-Indego for more information
[{"id":"6eeec393.9bedcc","type":"mqtt in","z":"5f63e31.7f2099c","name":"IndegoStateCode","topic":"device/indego/stateCode","qos":"2","broker":"80e883e5.b20f28","x":133.50001525878906,"y":95.33333587646484,"wires":[["df10650a.9c9ea"]]},{"id":"dfbb0aa6.bd9e68","type":"mqtt out","z":"5f63e31.7f2099c","name":"IndegoCommand","topic":"device/indego/command","qos":"","retain":"","broker":"80e883e5.b20f28","x":627.5,"y":404.6666564941406,"wires":[]},{"id":"95585128.4a7ef","type":"function","z":"5f63e31.7f2099c","name":"parseIndegoCommand","func":"var indego_command;\nvar http_status_code = 200;\nvar http_text = \"\";\n\nif (msg.req.params.hasOwnProperty(\"action\"))\n{\n var action = msg.req.params[\"action\"];\n \n switch(action)\n {\n case \"MOW\":\n case \"RETURN\":\n case \"PAUSE\":\n node.log(\"Parsed command: \"+ action);\n indego_command = action;\n http_status_code = 200;\n http_text = \"success\";\n break;\n default:\n node.error(\"Invalid command: \"+ action);\n indego_command = \"\";\n http_status_code = \"404\";\n http_text = \"Invalid command: \"+ action;\n break;\n }\n}\nelse\n{\n node.error(\"No action given\");\n indego_command = \"\";\n http_status_code = 500;\n http_text = \"No action given\";\n}\n\nmsg1 = { payload: indego_command};\nmsg2 = msg;\nmsg2.statusCode = http_status_code;\nmsg2.payload = http_text;\n\nreturn [msg1, msg2];","outputs":"2","noerr":0,"x":368.5,"y":409.0000305175781,"wires":[["dfbb0aa6.bd9e68"],["d8af45c.40ea2b8"]]},{"id":"b77de35c.25dd18","type":"http in","z":"5f63e31.7f2099c","name":"IndegoStatus","url":"/indego/status","method":"get","upload":false,"swaggerDoc":"","x":96.5,"y":287.6666564941406,"wires":[["7b08a33d.427234"]]},{"id":"a4aa908a.5cd8b8","type":"http response","z":"5f63e31.7f2099c","name":"IndegoStatusResponse","statusCode":"","headers":{"content-type":"text/plain"},"x":677.5,"y":307,"wires":[]},{"id":"6a5ae192.3d7c4","type":"mqtt in","z":"5f63e31.7f2099c","name":"IndegoStateMessage","topic":"device/indego/stateMessage","qos":"2","broker":"80e883e5.b20f28","x":151.50001525878906,"y":47.333335876464844,"wires":[["83a9dd24.5ea0a8"]]},{"id":"49bbb801.11ff7","type":"mqtt in","z":"5f63e31.7f2099c","name":"IndegoMowedPercent","topic":"device/indego/mowedPercent","qos":"2","broker":"80e883e5.b20f28","x":153.50001525878906,"y":154.33334350585938,"wires":[["e84e3536.dd82"]]},{"id":"4597e6d4.81554","type":"mqtt in","z":"5f63e31.7f2099c","name":"IndegoStateError","topic":"device/indego/stateError","qos":"2","broker":"80e883e5.b20f28","x":131.5,"y":205.33334350585938,"wires":[["d3e3aad7.75ba5"]]},{"id":"d89ee490.549b08","type":"function","z":"5f63e31.7f2099c","name":"prepare IndegoStatus","func":"var status = \"\";\n\nstatus += \"mode_code:\\\"\" + flow.get('stateCode') + \"\\\"\\n\"\n\nmowedPercent = flow.get('mowedPercent')\nif (mowedPercent !== undefined)\n status += \"completed:\\\"\" + mowedPercent + \"\\\"\\n\";\nelse\n status += \"completed:\\\"0\\\"\\n\";\n \nerror = flow.get('stateError');\nif (error !== undefined)\n status += \"error:\\\"\" + error + \"\\\"\\n\";\nelse\n status += \"error:\\\"none\\\"\\n\";\n \nmsg.payload = status;\nmsg.statusCode = \"200\";\n\nreturn msg;","outputs":1,"noerr":0,"x":443.5,"y":276.33331298828125,"wires":[["a4aa908a.5cd8b8"]]},{"id":"2043b267.4be0d6","type":"http in","z":"5f63e31.7f2099c","name":"IndegoCommand","url":"/indego/command/:action","method":"get","upload":false,"swaggerDoc":"","x":133.5,"y":405.6666259765625,"wires":[["4dc8cb61.83566c"]]},{"id":"d8af45c.40ea2b8","type":"http response","z":"5f63e31.7f2099c","name":"IndegoComandResponse","statusCode":"","headers":{"content-type":"text/plain"},"x":640.5,"y":467.0000305175781,"wires":[]},{"id":"83a9dd24.5ea0a8","type":"function","z":"5f63e31.7f2099c","name":"set stateMessage","func":"flow.set('stateMessage', msg.payload);","outputs":1,"noerr":0,"x":409.5,"y":44,"wires":[[]]},{"id":"df10650a.9c9ea","type":"function","z":"5f63e31.7f2099c","name":"set stateCode","func":"flow.set('stateCode', msg.payload);","outputs":1,"noerr":0,"x":395.5,"y":92.99999237060547,"wires":[[]]},{"id":"e84e3536.dd82","type":"function","z":"5f63e31.7f2099c","name":"setMowedPercent","func":"flow.set('mowedPercent', msg.payload)","outputs":1,"noerr":0,"x":399.5,"y":154,"wires":[[]]},{"id":"d3e3aad7.75ba5","type":"function","z":"5f63e31.7f2099c","name":"set stateError","func":"flow.set('stateError', msg.payload);","outputs":1,"noerr":0,"x":388.5,"y":205.00003051757812,"wires":[[]]},{"id":"7b08a33d.427234","type":"node-red-contrib-httpauth","z":"5f63e31.7f2099c","name":"","file":"","cred":"","authType":"Basic","realm":"","username":"USERNAME","password":"PASSWORD","hashed":false,"x":252.50001525878906,"y":326.6666259765625,"wires":[["d89ee490.549b08"]]},{"id":"4dc8cb61.83566c","type":"node-red-contrib-httpauth","z":"5f63e31.7f2099c","name":"","file":"","cred":"","authType":"Basic","realm":"","username":"USERNAME","password":"PASSWORD","hashed":false,"x":260.50001525878906,"y":476.66664123535156,"wires":[["95585128.4a7ef"]]},{"id":"80e883e5.b20f28","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]