rytilahti / python-miio

Python library & console tool for controlling Xiaomi smart appliances
https://python-miio.readthedocs.io
GNU General Public License v3.0
3.65k stars 551 forks source link

miio + nodered #208

Closed battosai30 closed 2 years ago

battosai30 commented 6 years ago

Hi, I don't find any other place to share this, so sorry if it's not the good way ...

So it's a simple share to drive my mirobo from my nodered server, thanks to miio script ;) Sorry some texts are in french, but I'm aware to any question. The interface is based on dashboard nodes and MQTT, so I can drive it from a web interface or mqtt messages.

image

image

Code to import in clipboard, you have to adapt IP and token in the concerned nodes :

[{"id":"379eec9e.2fdcb4","type":"inject","z":"e7ffbfff.9e009","name":"","topic":"","payload":"","payloadType":"date","repeat":"30","crontab":"","once":false,"x":250,"y":300,"wires":[["c9d4fcca.a181c","5b909c59.76f964"]]},{"id":"c54d5d4c.58882","type":"exec","z":"e7ffbfff.9e009","command":"/usr/local/bin/mirobo ","addpay":true,"append":"","useSpawn":"true","timer":"15","oldrc":true,"name":"","x":700,"y":200,"wires":[["68405477.6946ac","24e9c202.6886ae"],[],["44a046b6.ce38d8"]]},{"id":"68405477.6946ac","type":"split","z":"e7ffbfff.9e009","name":"","splt":"\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":930,"y":220,"wires":[["cd74e64f.a57b28"]]},{"id":"cd74e64f.a57b28","type":"switch","z":"e7ffbfff.9e009","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"State","vt":"str"},{"t":"cont","v":"Battery","vt":"str"},{"t":"cont","v":"Fanspeed","vt":"str"},{"t":"cont","v":"Cleaning since","vt":"str"},{"t":"cont","v":"Cleaned area","vt":"str"},{"t":"cont","v":"Side brush","vt":"str"},{"t":"cont","v":"Filter","vt":"str"},{"t":"cont","v":"Main brush","vt":"str"},{"t":"cont","v":"Sensor dirty","vt":"str"}],"checkall":"false","outputs":9,"x":1110,"y":220,"wires":[["e12716de.572b58"],["18f0348f.6a9c7b"],["bdc6549d.b26428"],["888428e9.7e90e8"],["346be28c.22320e"],["dd663459.77c3c8"],["fa602d78.edd04"],["e4f7575.a8e6ea8"],["e96a3c15.24e36"]]},{"id":"e54eba1.6df2748","type":"ui_gauge","z":"e7ffbfff.9e009","name":"","group":"d4625eee.ea466","order":1,"width":"0","height":"0","gtype":"gage","title":"Batterie","label":"","format":"{{value}}%","min":0,"max":"100","colors":["#cf2218","#e6e600","#00ca33"],"seg1":"","seg2":"","x":1560,"y":280,"wires":[]},{"id":"18f0348f.6a9c7b","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Battery: ","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":" %","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1340,"y":280,"wires":[["e54eba1.6df2748","cb2cff2d.1ba7b"]]},{"id":"69cf874e.bda0a8","type":"ui_gauge","z":"e7ffbfff.9e009","name":"","group":"e0708c01.fe22a","order":2,"width":"0","height":"0","gtype":"donut","title":"Fan speed","label":"","format":"{{value}}%","min":0,"max":"100","colors":["#ed6861","#ffff5b","#00ca33"],"seg1":"","seg2":"","x":1570,"y":380,"wires":[]},{"id":"bdc6549d.b26428","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Fanspeed: ","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":" %","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1340,"y":380,"wires":[["69cf874e.bda0a8","986c59d6.065af8"]]},{"id":"e12716de.572b58","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"State: ","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1360,"y":180,"wires":[["f1ef60.734740a","d16f4f83.39a61"]]},{"id":"24e9c202.6886ae","type":"debug","z":"e7ffbfff.9e009","name":"","active":true,"console":"false","complete":"false","x":950,"y":180,"wires":[]},{"id":"4f736821.007168","type":"ui_text","z":"e7ffbfff.9e009","group":"d4625eee.ea466","order":3,"width":0,"height":0,"name":"","label":"Durée nettoyage","format":"{{msg.payload}}","layout":"row-spread","x":1580,"y":480,"wires":[]},{"id":"ffb5d451.ba3488","type":"ui_text","z":"e7ffbfff.9e009","group":"d4625eee.ea466","order":4,"width":0,"height":0,"name":"","label":"Surface nettoyée","format":"{{msg.payload}}","layout":"row-spread","x":1590,"y":580,"wires":[]},{"id":"f1ef60.734740a","type":"ui_text","z":"e7ffbfff.9e009","group":"d4625eee.ea466","order":5,"width":0,"height":0,"name":"","label":"Etat","format":"{{msg.payload}}","layout":"row-spread","x":1550,"y":180,"wires":[]},{"id":"888428e9.7e90e8","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Cleaning since: ","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1360,"y":480,"wires":[["4f736821.007168","7d254e5d.ab3de"]]},{"id":"346be28c.22320e","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Cleaned area: ","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1360,"y":580,"wires":[["ffb5d451.ba3488","e5831367.2f7a6"]]},{"id":"86ef5fd9.bc81b","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"ee81531e.f0a57","order":6,"width":0,"height":0,"passthru":false,"label":"Lancement du Jean Tong","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":270,"y":460,"wires":[["4292baa7.656c54"]]},{"id":"17b09ee7.586771","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"ee81531e.f0a57","order":7,"width":0,"height":0,"passthru":false,"label":"Arrêt du Jean Tong","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":250,"y":560,"wires":[["13d1c5a3.9ef6da"]]},{"id":"409cfb43.b67504","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"ee81531e.f0a57","order":8,"width":0,"height":0,"passthru":false,"label":"Coucouche panier Jean Tong","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":280,"y":660,"wires":[["57a85b1c.15e8b4"]]},{"id":"b03c8d6c.c53ef","type":"ui_dropdown","z":"e7ffbfff.9e009","name":"","label":"Fan speed","place":"Select option","group":"e0708c01.fe22a","order":10,"width":0,"height":0,"passthru":true,"options":[{"label":"","value":10,"type":"num"},{"label":"","value":"20","type":"str"},{"label":"","value":"30","type":"str"},{"label":"","value":"40","type":"str"},{"label":"","value":"50","type":"str"},{"label":"","value":"60","type":"str"},{"label":"","value":"70","type":"str"},{"label":"","value":"80","type":"str"},{"label":"","value":"90","type":"str"},{"label":"","value":"100","type":"str"}],"payload":"","topic":"","x":230,"y":360,"wires":[["6fa01ae1.25fbd4"]]},{"id":"6654b529.7d57fc","type":"link in","z":"e7ffbfff.9e009","name":"","links":["6ef41072.41a7f","4b4b0912.8759e8","7d169430.6c0bac","95e79b32.219c68","dacc4cbf.b3af5","d9488615.aaec28","49f5257b.691b4c","420ed1fe.d4972","fb4f0c9e.e55da","545e153.b3631ec","2ef39db1.eb9fe2","94d8262e.b21798","6992106.f660bf","e8611884.8fd378","7dd57d0e.e6ac74","51a01aa2.1924a4","300eb1b2.de36be","97056cfd.4fada","f991f3ad.e3baa","4ad28a2f.2376e4","9e07317b.1beaf","e790c58c.6eeab8","f328c696.f7c0e8","abc82743.24e848","d1896b88.fbc228"],"x":175,"y":200,"wires":[["947574ec.4e7ee8"]]},{"id":"4b4b0912.8759e8","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":735,"y":500,"wires":[]},{"id":"7d169430.6c0bac","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":735,"y":600,"wires":[]},{"id":"95e79b32.219c68","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":735,"y":700,"wires":[]},{"id":"dacc4cbf.b3af5","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":895,"y":400,"wires":[]},{"id":"6fa01ae1.25fbd4","type":"function","z":"e7ffbfff.9e009","name":"","func":"msg.payload =\"fanspeed \" + msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":770,"y":360,"wires":[["dacc4cbf.b3af5","8b8e9b32.017f08"]]},{"id":"c9d4fcca.a181c","type":"link out","z":"e7ffbfff.9e009","name":"","links":["c47e7021.99d09"],"x":395,"y":260,"wires":[]},{"id":"d16f4f83.39a61","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/etat","qos":"","retain":"","broker":"746b3d75.048484","x":1610,"y":220,"wires":[]},{"id":"cb2cff2d.1ba7b","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/batterie","qos":"","retain":"","broker":"746b3d75.048484","x":1620,"y":320,"wires":[]},{"id":"986c59d6.065af8","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/fanspeed","qos":"","retain":"","broker":"746b3d75.048484","x":1630,"y":420,"wires":[]},{"id":"7d254e5d.ab3de","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/duree","qos":"","retain":"","broker":"746b3d75.048484","x":1610,"y":520,"wires":[]},{"id":"e5831367.2f7a6","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/surface","qos":"","retain":"","broker":"746b3d75.048484","x":1620,"y":620,"wires":[]},{"id":"978a1782.0c44d8","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"ee81531e.f0a57","order":9,"width":0,"height":0,"passthru":false,"label":"Faire parler le Jean Tong","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":270,"y":760,"wires":[["e087790.9e06988"]]},{"id":"49f5257b.691b4c","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":695,"y":760,"wires":[]},{"id":"840581a7.c4cde","type":"ui_text","z":"e7ffbfff.9e009","group":"f47572d.067869","order":11,"width":0,"height":0,"name":"","label":"Brosse de côté","format":"{{msg.payload}}","layout":"row-spread","x":1580,"y":680,"wires":[]},{"id":"dd663459.77c3c8","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Side brush: ","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1360,"y":680,"wires":[["840581a7.c4cde","f5246f4c.17e9"]]},{"id":"f5246f4c.17e9","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/sidebrush","qos":"","retain":"","broker":"746b3d75.048484","x":1630,"y":720,"wires":[]},{"id":"318301a6.1313de","type":"ui_text","z":"e7ffbfff.9e009","group":"f47572d.067869","order":12,"width":0,"height":0,"name":"","label":"Filtre","format":"{{msg.payload}}","layout":"row-spread","x":1550,"y":780,"wires":[]},{"id":"fa602d78.edd04","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Filter: ","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1360,"y":780,"wires":[["318301a6.1313de","80bee2a9.f97bf"]]},{"id":"80bee2a9.f97bf","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/filter","qos":"","retain":"","broker":"746b3d75.048484","x":1610,"y":820,"wires":[]},{"id":"57db945a.cbe3ec","type":"ui_text","z":"e7ffbfff.9e009","group":"f47572d.067869","order":13,"width":0,"height":0,"name":"","label":"Brosse principale","format":"{{msg.payload}}","layout":"row-spread","x":1590,"y":880,"wires":[]},{"id":"e4f7575.a8e6ea8","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Main brush: ","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1360,"y":880,"wires":[["57db945a.cbe3ec","61198331.50f8ec"]]},{"id":"61198331.50f8ec","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/mainbrush","qos":"","retain":"","broker":"746b3d75.048484","x":1630,"y":920,"wires":[]},{"id":"e730a978.4a5dd8","type":"ui_text","z":"e7ffbfff.9e009","group":"f47572d.067869","order":14,"width":0,"height":0,"name":"","label":"Capteur de saleté","format":"{{msg.payload}}","layout":"row-spread","x":1590,"y":980,"wires":[]},{"id":"e96a3c15.24e36","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Sensor dirty: ","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1360,"y":980,"wires":[["e730a978.4a5dd8","576798f8.80af18"]]},{"id":"576798f8.80af18","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/sensordirty","qos":"","retain":"","broker":"746b3d75.048484","x":1630,"y":1020,"wires":[]},{"id":"1d90137e.a2634d","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"f47572d.067869","order":0,"width":0,"height":0,"passthru":false,"label":"Sors de ton trou SAM","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":260,"y":1080,"wires":[["c9069f7a.207ba"]]},{"id":"fb4f0c9e.e55da","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":595,"y":1120,"wires":[]},{"id":"659bdf8e.a7f33","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"f47572d.067869","order":9,"width":0,"height":0,"passthru":false,"label":"RAZ brosse principale","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":260,"y":860,"wires":[["4599c6b3.4dcc68","f2bb8905.91e488"]]},{"id":"f157f114.1c005","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"f47572d.067869","order":9,"width":0,"height":0,"passthru":false,"label":"RAZ brosse de côté","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":250,"y":900,"wires":[["4599c6b3.4dcc68","8284a517.b7ac28"]]},{"id":"d5040797.b47bf8","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"f47572d.067869","order":9,"width":0,"height":0,"passthru":false,"label":"RAZ filtre","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":220,"y":940,"wires":[["4599c6b3.4dcc68","9e38cd3.a07293"]]},{"id":"448a0f77.8e72d","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"f47572d.067869","order":9,"width":0,"height":0,"passthru":false,"label":"RAZ capteur de saleté","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":260,"y":980,"wires":[["4599c6b3.4dcc68","908b6ff2.af026"]]},{"id":"febafa10.98ff28","type":"mqtt in","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/start","qos":"0","broker":"746b3d75.048484","x":270,"y":500,"wires":[["4292baa7.656c54"]]},{"id":"56b2a2ca.fbef7c","type":"mqtt in","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/stop","qos":"0","broker":"746b3d75.048484","x":270,"y":600,"wires":[["13d1c5a3.9ef6da"]]},{"id":"faae4ab5.ec9dc8","type":"mqtt in","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/home","qos":"0","broker":"746b3d75.048484","x":270,"y":700,"wires":[["57a85b1c.15e8b4"]]},{"id":"aae77f5e.72fe8","type":"mqtt in","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/find","qos":"0","broker":"746b3d75.048484","x":260,"y":800,"wires":[["e087790.9e06988"]]},{"id":"71cfa4c2.a3329c","type":"mqtt in","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/out","qos":"0","broker":"746b3d75.048484","x":260,"y":1120,"wires":[["c9069f7a.207ba"]]},{"id":"efdd588a.264158","type":"mqtt in","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/setfanspeed","qos":"0","broker":"746b3d75.048484","x":290,"y":400,"wires":[["83132ad0.b7bd48"]]},{"id":"83132ad0.b7bd48","type":"switch","z":"e7ffbfff.9e009","name":"","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"0","vt":"num","v2":"100","v2t":"num"}],"checkall":"true","outputs":1,"x":550,"y":400,"wires":[["6fa01ae1.25fbd4"]]},{"id":"97056cfd.4fada","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":1275,"y":1080,"wires":[]},{"id":"944e0f1a.78db1","type":"delay","z":"e7ffbfff.9e009","name":"","pauseType":"delay","timeout":"15","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1000,"y":1080,"wires":[["697aad97.5802b4"]]},{"id":"f991f3ad.e3baa","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":955,"y":1120,"wires":[]},{"id":"52efe2ef.d053dc","type":"delay","z":"e7ffbfff.9e009","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":640,"y":1080,"wires":[["1793f454.a822fc"]]},{"id":"221f7771.79a708","type":"function","z":"e7ffbfff.9e009","name":"Simple triggered queue","func":"// if queue doesn't exist, create it\ncontext.queue = context.queue || [];\ncontext.busy = context.busy || false;\n\n// if the msg is a trigger one release next message\nif (msg.hasOwnProperty(\"trigger\")) {\n if (context.queue.length > 0) {\n var m = context.queue.shift();\n return {payload:m};\n }\n else {\n context.busy = false;\n }\n}\nelse {\n if (context.busy) {\n // if busy add to queue\n context.queue.push(msg.payload);\n }\n else {\n // otherwise we are empty so just pass through and set busy flag\n context.busy = true;\n return msg;\n }\n}\n\nreturn null;","outputs":1,"noerr":0,"x":470,"y":200,"wires":[["c54d5d4c.58882"]]},{"id":"44a046b6.ce38d8","type":"function","z":"e7ffbfff.9e009","name":"set trigger","func":"// handle the return from the exec in here \n// if all is good then set msg.trigger property to exist\nmsg.trigger = 1;\nreturn msg;","outputs":1,"noerr":0,"x":940,"y":260,"wires":[["4ad28a2f.2376e4"]]},{"id":"4ad28a2f.2376e4","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":1035,"y":260,"wires":[]},{"id":"6a60c9bb.a59e48","type":"function","z":"e7ffbfff.9e009","name":"","func":"msg.payload =\"\";\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":1220,"wires":[["9e07317b.1beaf"]]},{"id":"9e07317b.1beaf","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":495,"y":1220,"wires":[]},{"id":"67909988.4cf848","type":"link out","z":"e7ffbfff.9e009","name":"","links":["c47e7021.99d09"],"x":735,"y":460,"wires":[]},{"id":"c47e7021.99d09","type":"link in","z":"e7ffbfff.9e009","name":"","links":["67909988.4cf848","8b8e9b32.017f08","c9d4fcca.a181c","ffb6ffb6.b950b","de6fcf39.11752"],"x":175,"y":1220,"wires":[["409879fa.a39f08"]]},{"id":"8b8e9b32.017f08","type":"link out","z":"e7ffbfff.9e009","name":"","links":["c47e7021.99d09"],"x":895,"y":360,"wires":[]},{"id":"ffb6ffb6.b950b","type":"link out","z":"e7ffbfff.9e009","name":"","links":["c47e7021.99d09"],"x":735,"y":560,"wires":[]},{"id":"de6fcf39.11752","type":"link out","z":"e7ffbfff.9e009","name":"","links":["c47e7021.99d09"],"x":735,"y":660,"wires":[]},{"id":"84a01163.6054b","type":"function","z":"e7ffbfff.9e009","name":"","func":"msg.payload =\"consumables\";\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":1260,"wires":[["abc82743.24e848"]]},{"id":"abc82743.24e848","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":495,"y":1260,"wires":[]},{"id":"60f3ec06.83f4d4","type":"link in","z":"e7ffbfff.9e009","name":"","links":["5b909c59.76f964","4599c6b3.4dcc68"],"x":175,"y":1260,"wires":[["f01b856c.29ca58"]]},{"id":"5b909c59.76f964","type":"link out","z":"e7ffbfff.9e009","name":"","links":["60f3ec06.83f4d4"],"x":395,"y":300,"wires":[]},{"id":"4599c6b3.4dcc68","type":"link out","z":"e7ffbfff.9e009","name":"","links":["60f3ec06.83f4d4"],"x":515,"y":1020,"wires":[]},{"id":"947574ec.4e7ee8","type":"function","z":"e7ffbfff.9e009","name":"","func":"msg.payload=\" --ip 192.168.1.7 --token 555253626b72763832766d34586e747a \" + msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":270,"y":200,"wires":[["221f7771.79a708"]]},{"id":"4292baa7.656c54","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"start","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":460,"wires":[["67909988.4cf848","4b4b0912.8759e8"]]},{"id":"13d1c5a3.9ef6da","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":560,"wires":[["ffb6ffb6.b950b","7d169430.6c0bac"]]},{"id":"57a85b1c.15e8b4","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"home","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":660,"wires":[["de6fcf39.11752","95e79b32.219c68"]]},{"id":"e087790.9e06988","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"find","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":760,"wires":[["49f5257b.691b4c"]]},{"id":"f2bb8905.91e488","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset_consumable main_brush","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":860,"wires":[["d1896b88.fbc228"]]},{"id":"8284a517.b7ac28","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset_consumable side_brush","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":900,"wires":[["d1896b88.fbc228"]]},{"id":"9e38cd3.a07293","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset_consumable filter","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":940,"wires":[["d1896b88.fbc228"]]},{"id":"908b6ff2.af026","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset_consumable senspr_dirty","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":980,"wires":[["d1896b88.fbc228"]]},{"id":"c9069f7a.207ba","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"manual start","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":1080,"wires":[["52efe2ef.d053dc","fb4f0c9e.e55da"]]},{"id":"1793f454.a822fc","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"manual forward 0.29","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":1080,"wires":[["944e0f1a.78db1","f991f3ad.e3baa"]]},{"id":"697aad97.5802b4","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"manual stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1160,"y":1080,"wires":[["97056cfd.4fada"]]},{"id":"d1896b88.fbc228","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":735,"y":920,"wires":[]},{"id":"f01b856c.29ca58","type":"delay","z":"e7ffbfff.9e009","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":280,"y":1260,"wires":[["84a01163.6054b"]]},{"id":"409879fa.a39f08","type":"delay","z":"e7ffbfff.9e009","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":280,"y":1220,"wires":[["6a60c9bb.a59e48"]]},{"id":"d4625eee.ea466","type":"ui_group","z":"","name":"Infos","tab":"7052db5c.6b5094","disp":true,"width":"5"},{"id":"e0708c01.fe22a","type":"ui_group","z":"","name":"Fan speed","tab":"7052db5c.6b5094","order":4,"disp":true,"width":"5"},{"id":"ee81531e.f0a57","type":"ui_group","z":"","name":"Commandes","tab":"7052db5c.6b5094","order":2,"disp":true,"width":"5"},{"id":"746b3d75.048484","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"f47572d.067869","type":"ui_group","z":"","name":"Consommables","tab":"7052db5c.6b5094","order":3,"disp":true,"width":"10"},{"id":"7052db5c.6b5094","type":"ui_tab","z":"","name":"Jean Tong","icon":"dashboard","order":2}]

joseska commented 6 years ago

Hi.... Imposible to Import your code... any idea???? Thanks.....

battosai30 commented 6 years ago

I just checked, if copy the code from my nodered and paste it directly in another nodered => OK If I paste it in github, copy it from github and copy it to nodered => not OK

[{"id":"379eec9e.2fdcb4","type":"inject","z":"e7ffbfff.9e009","name":"","topic":"","payload":"","payloadType":"date","repeat":"30","crontab":"","once":false,"x":250,"y":300,"wires":[["c9d4fcca.a181c","5b909c59.76f964"]]},{"id":"c54d5d4c.58882","type":"exec","z":"e7ffbfff.9e009","command":"/usr/local/bin/mirobo ","addpay":true,"append":"","useSpawn":"true","timer":"15","oldrc":true,"name":"","x":700,"y":200,"wires":[["68405477.6946ac","24e9c202.6886ae"],[],["44a046b6.ce38d8"]]},{"id":"68405477.6946ac","type":"split","z":"e7ffbfff.9e009","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":930,"y":220,"wires":[["cd74e64f.a57b28"]]},{"id":"cd74e64f.a57b28","type":"switch","z":"e7ffbfff.9e009","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"State","vt":"str"},{"t":"cont","v":"Battery","vt":"str"},{"t":"cont","v":"Fanspeed","vt":"str"},{"t":"cont","v":"Cleaning since","vt":"str"},{"t":"cont","v":"Cleaned area","vt":"str"},{"t":"cont","v":"Side brush","vt":"str"},{"t":"cont","v":"Filter","vt":"str"},{"t":"cont","v":"Main brush","vt":"str"},{"t":"cont","v":"Sensor dirty","vt":"str"}],"checkall":"false","outputs":9,"x":1110,"y":220,"wires":[["e12716de.572b58"],["18f0348f.6a9c7b"],["bdc6549d.b26428"],["888428e9.7e90e8"],["346be28c.22320e"],["dd663459.77c3c8"],["fa602d78.edd04"],["e4f7575.a8e6ea8"],["e96a3c15.24e36"]]},{"id":"e54eba1.6df2748","type":"ui_gauge","z":"e7ffbfff.9e009","name":"","group":"d4625eee.ea466","order":1,"width":"0","height":"0","gtype":"gage","title":"Batterie","label":"","format":"{{value}}%","min":0,"max":"100","colors":["#cf2218","#e6e600","#00ca33"],"seg1":"","seg2":"","x":1560,"y":280,"wires":[]},{"id":"18f0348f.6a9c7b","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Battery: ","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":" %","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1340,"y":280,"wires":[["e54eba1.6df2748","cb2cff2d.1ba7b"]]},{"id":"69cf874e.bda0a8","type":"ui_gauge","z":"e7ffbfff.9e009","name":"","group":"e0708c01.fe22a","order":2,"width":"0","height":"0","gtype":"donut","title":"Fan speed","label":"","format":"{{value}}%","min":0,"max":"100","colors":["#ed6861","#ffff5b","#00ca33"],"seg1":"","seg2":"","x":1570,"y":380,"wires":[]},{"id":"bdc6549d.b26428","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Fanspeed: ","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":" %","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1340,"y":380,"wires":[["69cf874e.bda0a8","986c59d6.065af8"]]},{"id":"e12716de.572b58","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"State: ","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1360,"y":180,"wires":[["f1ef60.734740a","d16f4f83.39a61"]]},{"id":"24e9c202.6886ae","type":"debug","z":"e7ffbfff.9e009","name":"","active":true,"console":"false","complete":"false","x":950,"y":180,"wires":[]},{"id":"4f736821.007168","type":"ui_text","z":"e7ffbfff.9e009","group":"d4625eee.ea466","order":3,"width":0,"height":0,"name":"","label":"Durée nettoyage","format":"{{msg.payload}}","layout":"row-spread","x":1580,"y":480,"wires":[]},{"id":"ffb5d451.ba3488","type":"ui_text","z":"e7ffbfff.9e009","group":"d4625eee.ea466","order":4,"width":0,"height":0,"name":"","label":"Surface nettoyée","format":"{{msg.payload}}","layout":"row-spread","x":1590,"y":580,"wires":[]},{"id":"f1ef60.734740a","type":"ui_text","z":"e7ffbfff.9e009","group":"d4625eee.ea466","order":5,"width":0,"height":0,"name":"","label":"Etat","format":"{{msg.payload}}","layout":"row-spread","x":1550,"y":180,"wires":[]},{"id":"888428e9.7e90e8","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Cleaning since: ","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1360,"y":480,"wires":[["4f736821.007168","7d254e5d.ab3de"]]},{"id":"346be28c.22320e","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Cleaned area: ","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1360,"y":580,"wires":[["ffb5d451.ba3488","e5831367.2f7a6"]]},{"id":"86ef5fd9.bc81b","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"ee81531e.f0a57","order":6,"width":0,"height":0,"passthru":false,"label":"Lancement du Jean Tong","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":270,"y":460,"wires":[["4292baa7.656c54"]]},{"id":"17b09ee7.586771","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"ee81531e.f0a57","order":7,"width":0,"height":0,"passthru":false,"label":"Arrêt du Jean Tong","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":250,"y":560,"wires":[["13d1c5a3.9ef6da"]]},{"id":"409cfb43.b67504","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"ee81531e.f0a57","order":8,"width":0,"height":0,"passthru":false,"label":"Coucouche panier Jean Tong","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":280,"y":660,"wires":[["57a85b1c.15e8b4"]]},{"id":"b03c8d6c.c53ef","type":"ui_dropdown","z":"e7ffbfff.9e009","name":"","label":"Fan speed","place":"Select option","group":"e0708c01.fe22a","order":10,"width":0,"height":0,"passthru":true,"options":[{"label":"","value":10,"type":"num"},{"label":"","value":"20","type":"str"},{"label":"","value":"30","type":"str"},{"label":"","value":"40","type":"str"},{"label":"","value":"50","type":"str"},{"label":"","value":"60","type":"str"},{"label":"","value":"70","type":"str"},{"label":"","value":"80","type":"str"},{"label":"","value":"90","type":"str"},{"label":"","value":"100","type":"str"}],"payload":"","topic":"","x":230,"y":360,"wires":[["6fa01ae1.25fbd4"]]},{"id":"6654b529.7d57fc","type":"link in","z":"e7ffbfff.9e009","name":"","links":["6ef41072.41a7f","4b4b0912.8759e8","7d169430.6c0bac","95e79b32.219c68","dacc4cbf.b3af5","d9488615.aaec28","49f5257b.691b4c","420ed1fe.d4972","fb4f0c9e.e55da","545e153.b3631ec","2ef39db1.eb9fe2","94d8262e.b21798","6992106.f660bf","e8611884.8fd378","7dd57d0e.e6ac74","51a01aa2.1924a4","300eb1b2.de36be","97056cfd.4fada","f991f3ad.e3baa","4ad28a2f.2376e4","9e07317b.1beaf","e790c58c.6eeab8","f328c696.f7c0e8","abc82743.24e848","d1896b88.fbc228"],"x":175,"y":200,"wires":[["947574ec.4e7ee8"]]},{"id":"4b4b0912.8759e8","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":735,"y":500,"wires":[]},{"id":"7d169430.6c0bac","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":735,"y":600,"wires":[]},{"id":"95e79b32.219c68","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":735,"y":700,"wires":[]},{"id":"dacc4cbf.b3af5","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":895,"y":400,"wires":[]},{"id":"6fa01ae1.25fbd4","type":"function","z":"e7ffbfff.9e009","name":"","func":"msg.payload =\"fanspeed \" + msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":770,"y":360,"wires":[["dacc4cbf.b3af5","8b8e9b32.017f08"]]},{"id":"c9d4fcca.a181c","type":"link out","z":"e7ffbfff.9e009","name":"","links":["c47e7021.99d09"],"x":395,"y":260,"wires":[]},{"id":"d16f4f83.39a61","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/etat","qos":"","retain":"","broker":"746b3d75.048484","x":1610,"y":220,"wires":[]},{"id":"cb2cff2d.1ba7b","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/batterie","qos":"","retain":"","broker":"746b3d75.048484","x":1620,"y":320,"wires":[]},{"id":"986c59d6.065af8","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/fanspeed","qos":"","retain":"","broker":"746b3d75.048484","x":1630,"y":420,"wires":[]},{"id":"7d254e5d.ab3de","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/duree","qos":"","retain":"","broker":"746b3d75.048484","x":1610,"y":520,"wires":[]},{"id":"e5831367.2f7a6","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/surface","qos":"","retain":"","broker":"746b3d75.048484","x":1620,"y":620,"wires":[]},{"id":"978a1782.0c44d8","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"ee81531e.f0a57","order":9,"width":0,"height":0,"passthru":false,"label":"Faire parler le Jean Tong","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":270,"y":760,"wires":[["e087790.9e06988"]]},{"id":"49f5257b.691b4c","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":695,"y":760,"wires":[]},{"id":"840581a7.c4cde","type":"ui_text","z":"e7ffbfff.9e009","group":"f47572d.067869","order":11,"width":0,"height":0,"name":"","label":"Brosse de côté","format":"{{msg.payload}}","layout":"row-spread","x":1580,"y":680,"wires":[]},{"id":"dd663459.77c3c8","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Side brush: ","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1360,"y":680,"wires":[["840581a7.c4cde","f5246f4c.17e9"]]},{"id":"f5246f4c.17e9","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/sidebrush","qos":"","retain":"","broker":"746b3d75.048484","x":1630,"y":720,"wires":[]},{"id":"318301a6.1313de","type":"ui_text","z":"e7ffbfff.9e009","group":"f47572d.067869","order":12,"width":0,"height":0,"name":"","label":"Filtre","format":"{{msg.payload}}","layout":"row-spread","x":1550,"y":780,"wires":[]},{"id":"fa602d78.edd04","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Filter: ","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1360,"y":780,"wires":[["318301a6.1313de","80bee2a9.f97bf"]]},{"id":"80bee2a9.f97bf","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/filter","qos":"","retain":"","broker":"746b3d75.048484","x":1610,"y":820,"wires":[]},{"id":"57db945a.cbe3ec","type":"ui_text","z":"e7ffbfff.9e009","group":"f47572d.067869","order":13,"width":0,"height":0,"name":"","label":"Brosse principale","format":"{{msg.payload}}","layout":"row-spread","x":1590,"y":880,"wires":[]},{"id":"e4f7575.a8e6ea8","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Main brush: ","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1360,"y":880,"wires":[["57db945a.cbe3ec","61198331.50f8ec"]]},{"id":"61198331.50f8ec","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/mainbrush","qos":"","retain":"","broker":"746b3d75.048484","x":1630,"y":920,"wires":[]},{"id":"e730a978.4a5dd8","type":"ui_text","z":"e7ffbfff.9e009","group":"f47572d.067869","order":14,"width":0,"height":0,"name":"","label":"Capteur de saleté","format":"{{msg.payload}}","layout":"row-spread","x":1590,"y":980,"wires":[]},{"id":"e96a3c15.24e36","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Sensor dirty: ","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1360,"y":980,"wires":[["e730a978.4a5dd8","576798f8.80af18"]]},{"id":"576798f8.80af18","type":"mqtt out","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/sensordirty","qos":"","retain":"","broker":"746b3d75.048484","x":1630,"y":1020,"wires":[]},{"id":"1d90137e.a2634d","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"f47572d.067869","order":0,"width":0,"height":0,"passthru":false,"label":"Sors de ton trou SAM","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":260,"y":1080,"wires":[["c9069f7a.207ba"]]},{"id":"fb4f0c9e.e55da","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":595,"y":1120,"wires":[]},{"id":"659bdf8e.a7f33","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"f47572d.067869","order":9,"width":0,"height":0,"passthru":false,"label":"RAZ brosse principale","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":260,"y":860,"wires":[["4599c6b3.4dcc68","f2bb8905.91e488"]]},{"id":"f157f114.1c005","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"f47572d.067869","order":9,"width":0,"height":0,"passthru":false,"label":"RAZ brosse de côté","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":250,"y":900,"wires":[["4599c6b3.4dcc68","8284a517.b7ac28"]]},{"id":"d5040797.b47bf8","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"f47572d.067869","order":9,"width":0,"height":0,"passthru":false,"label":"RAZ filtre","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":220,"y":940,"wires":[["4599c6b3.4dcc68","9e38cd3.a07293"]]},{"id":"448a0f77.8e72d","type":"ui_button","z":"e7ffbfff.9e009","name":"","group":"f47572d.067869","order":9,"width":0,"height":0,"passthru":false,"label":"RAZ capteur de saleté","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":260,"y":980,"wires":[["4599c6b3.4dcc68","908b6ff2.af026"]]},{"id":"febafa10.98ff28","type":"mqtt in","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/start","qos":"0","broker":"746b3d75.048484","x":270,"y":500,"wires":[["4292baa7.656c54"]]},{"id":"56b2a2ca.fbef7c","type":"mqtt in","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/stop","qos":"0","broker":"746b3d75.048484","x":270,"y":600,"wires":[["13d1c5a3.9ef6da"]]},{"id":"faae4ab5.ec9dc8","type":"mqtt in","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/home","qos":"0","broker":"746b3d75.048484","x":270,"y":700,"wires":[["57a85b1c.15e8b4"]]},{"id":"aae77f5e.72fe8","type":"mqtt in","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/find","qos":"0","broker":"746b3d75.048484","x":260,"y":800,"wires":[["e087790.9e06988"]]},{"id":"71cfa4c2.a3329c","type":"mqtt in","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/out","qos":"0","broker":"746b3d75.048484","x":260,"y":1120,"wires":[["c9069f7a.207ba"]]},{"id":"efdd588a.264158","type":"mqtt in","z":"e7ffbfff.9e009","name":"","topic":"domotique/jeantong/setfanspeed","qos":"0","broker":"746b3d75.048484","x":290,"y":400,"wires":[["83132ad0.b7bd48"]]},{"id":"83132ad0.b7bd48","type":"switch","z":"e7ffbfff.9e009","name":"","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"0","vt":"num","v2":"100","v2t":"num"}],"checkall":"true","outputs":1,"x":550,"y":400,"wires":[["6fa01ae1.25fbd4"]]},{"id":"97056cfd.4fada","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":1275,"y":1080,"wires":[]},{"id":"944e0f1a.78db1","type":"delay","z":"e7ffbfff.9e009","name":"","pauseType":"delay","timeout":"15","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1000,"y":1080,"wires":[["697aad97.5802b4"]]},{"id":"f991f3ad.e3baa","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":955,"y":1120,"wires":[]},{"id":"52efe2ef.d053dc","type":"delay","z":"e7ffbfff.9e009","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":640,"y":1080,"wires":[["1793f454.a822fc"]]},{"id":"221f7771.79a708","type":"function","z":"e7ffbfff.9e009","name":"Simple triggered queue","func":"// if queue doesn't exist, create it\ncontext.queue = context.queue || [];\ncontext.busy = context.busy || false;\n\n// if the msg is a trigger one release next message\nif (msg.hasOwnProperty(\"trigger\")) {\n if (context.queue.length > 0) {\n var m = context.queue.shift();\n return {payload:m};\n }\n else {\n context.busy = false;\n }\n}\nelse {\n if (context.busy) {\n // if busy add to queue\n context.queue.push(msg.payload);\n }\n else {\n // otherwise we are empty so just pass through and set busy flag\n context.busy = true;\n return msg;\n }\n}\n\nreturn null;","outputs":1,"noerr":0,"x":470,"y":200,"wires":[["c54d5d4c.58882"]]},{"id":"44a046b6.ce38d8","type":"function","z":"e7ffbfff.9e009","name":"set trigger","func":"// handle the return from the exec in here \n// if all is good then set msg.trigger property to exist\nmsg.trigger = 1;\nreturn msg;","outputs":1,"noerr":0,"x":940,"y":260,"wires":[["4ad28a2f.2376e4"]]},{"id":"4ad28a2f.2376e4","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":1035,"y":260,"wires":[]},{"id":"6a60c9bb.a59e48","type":"function","z":"e7ffbfff.9e009","name":"","func":"msg.payload =\"\";\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":1220,"wires":[["9e07317b.1beaf"]]},{"id":"9e07317b.1beaf","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":495,"y":1220,"wires":[]},{"id":"67909988.4cf848","type":"link out","z":"e7ffbfff.9e009","name":"","links":["c47e7021.99d09"],"x":735,"y":460,"wires":[]},{"id":"c47e7021.99d09","type":"link in","z":"e7ffbfff.9e009","name":"","links":["67909988.4cf848","8b8e9b32.017f08","c9d4fcca.a181c","ffb6ffb6.b950b","de6fcf39.11752"],"x":175,"y":1220,"wires":[["409879fa.a39f08"]]},{"id":"8b8e9b32.017f08","type":"link out","z":"e7ffbfff.9e009","name":"","links":["c47e7021.99d09"],"x":895,"y":360,"wires":[]},{"id":"ffb6ffb6.b950b","type":"link out","z":"e7ffbfff.9e009","name":"","links":["c47e7021.99d09"],"x":735,"y":560,"wires":[]},{"id":"de6fcf39.11752","type":"link out","z":"e7ffbfff.9e009","name":"","links":["c47e7021.99d09"],"x":735,"y":660,"wires":[]},{"id":"84a01163.6054b","type":"function","z":"e7ffbfff.9e009","name":"","func":"msg.payload =\"consumables\";\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":1260,"wires":[["abc82743.24e848"]]},{"id":"abc82743.24e848","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":495,"y":1260,"wires":[]},{"id":"60f3ec06.83f4d4","type":"link in","z":"e7ffbfff.9e009","name":"","links":["5b909c59.76f964","4599c6b3.4dcc68"],"x":175,"y":1260,"wires":[["f01b856c.29ca58"]]},{"id":"5b909c59.76f964","type":"link out","z":"e7ffbfff.9e009","name":"","links":["60f3ec06.83f4d4"],"x":395,"y":300,"wires":[]},{"id":"4599c6b3.4dcc68","type":"link out","z":"e7ffbfff.9e009","name":"","links":["60f3ec06.83f4d4"],"x":515,"y":1020,"wires":[]},{"id":"947574ec.4e7ee8","type":"function","z":"e7ffbfff.9e009","name":"","func":"msg.payload=\" --ip 192.168.1.7 --token 555253626b72763832766d34586e747a \" + msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":270,"y":200,"wires":[["221f7771.79a708"]]},{"id":"4292baa7.656c54","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"start","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":460,"wires":[["67909988.4cf848","4b4b0912.8759e8"]]},{"id":"13d1c5a3.9ef6da","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":560,"wires":[["ffb6ffb6.b950b","7d169430.6c0bac"]]},{"id":"57a85b1c.15e8b4","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"home","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":660,"wires":[["de6fcf39.11752","95e79b32.219c68"]]},{"id":"e087790.9e06988","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"find","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":760,"wires":[["49f5257b.691b4c"]]},{"id":"f2bb8905.91e488","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset_consumable main_brush","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":860,"wires":[["d1896b88.fbc228"]]},{"id":"8284a517.b7ac28","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset_consumable side_brush","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":900,"wires":[["d1896b88.fbc228"]]},{"id":"9e38cd3.a07293","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset_consumable filter","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":940,"wires":[["d1896b88.fbc228"]]},{"id":"908b6ff2.af026","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset_consumable senspr_dirty","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":980,"wires":[["d1896b88.fbc228"]]},{"id":"c9069f7a.207ba","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"manual start","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":1080,"wires":[["52efe2ef.d053dc","fb4f0c9e.e55da"]]},{"id":"1793f454.a822fc","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"manual forward 0.29","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":1080,"wires":[["944e0f1a.78db1","f991f3ad.e3baa"]]},{"id":"697aad97.5802b4","type":"change","z":"e7ffbfff.9e009","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"manual stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1160,"y":1080,"wires":[["97056cfd.4fada"]]},{"id":"d1896b88.fbc228","type":"link out","z":"e7ffbfff.9e009","name":"","links":["6654b529.7d57fc"],"x":735,"y":920,"wires":[]},{"id":"f01b856c.29ca58","type":"delay","z":"e7ffbfff.9e009","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":280,"y":1260,"wires":[["84a01163.6054b"]]},{"id":"409879fa.a39f08","type":"delay","z":"e7ffbfff.9e009","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":280,"y":1220,"wires":[["6a60c9bb.a59e48"]]},{"id":"d4625eee.ea466","type":"ui_group","z":"","name":"Infos","tab":"7052db5c.6b5094","disp":true,"width":"5"},{"id":"e0708c01.fe22a","type":"ui_group","z":"","name":"Fan speed","tab":"7052db5c.6b5094","order":4,"disp":true,"width":"5"},{"id":"ee81531e.f0a57","type":"ui_group","z":"","name":"Commandes","tab":"7052db5c.6b5094","order":2,"disp":true,"width":"5"},{"id":"746b3d75.048484","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"f47572d.067869","type":"ui_group","z":"","name":"Consommables","tab":"7052db5c.6b5094","order":3,"disp":true,"width":"10"},{"id":"7052db5c.6b5094","type":"ui_tab","z":"","name":"Jean Tong","icon":"dashboard","order":2}]

battosai30 commented 6 years ago

With code balises it seems to be ok

joseska commented 6 years ago

Thanks..... I will try

JackDaniel007 commented 6 years ago

first thanks for the flow, looks great now my problem is i can not understand what you do with the exec node "/usr/local/bin/morobo" :( sorry but i am a total beginner with this stuff

battosai30 commented 6 years ago

It's simple : if you have well install miio on your server, you normally can use in your SSH terminal "mirobo" commands as described in the wiki. /usr/local/bin/morobo just replace this command, which is completed in my script by the right suffix to do what I want (for example, "/usr/local/bin/morobo fanspeed 80" to configure fan speed to 80%).

Hope it helps