Manage Miele Appliances

Miele subflows enable you to retrieve data from the installed Miele appliances and their current status in your household. Furthermore, they allow some basic actions to control the appliances.

More information at Miele. Available actions

Installation

  1. Install your appliances with the required WIFI hardware interface

  2. Install the Miele@mobile app on your smartphone and connect your appliance to the Miele Cloud. You need to register (username, password)

  3. Request client_id and client_secret via email: [email protected] - name your app e. g. nodeRED flows

  4. Install the https://flows.nodered.org/node/node-red-contrib-credentials. A node is included in this flow. Comment: I recommend to use the credential node to store username, password, client_id, client_secret.

  5. Import the flow. The nodes show up in the palette, category Miele.

  6. Fill in your username, password, client_id and client_secret in the credential node.

  7. Submit the first flow to get your bearer node - the bearer node and the refresh token is stored in global.system_bearerMiele, global.system_refreshMiele. Caution: You have to make your globals persistent in settings.js otherwise they got lost after a flow restart.

  8. Now you can use all the other nodes - they fetch the bearer from the global variable. Use the build-in catch node to catch all errors and act on them. Caution: You have to refresh (that means to get a new token) every 30 days.

[{"id":"ad607e01.511ea","type":"subflow","name":"set action","info":"Set (execute) an action for the given appliance. Valid action depend on kind of appliance and state!","category":"Miele","in":[{"x":40,"y":75,"wires":[{"id":"2542e5f6.b0fd8a"}]}],"out":[{"x":1011,"y":74,"wires":[{"id":"21b0eeb.798de12","port":0}]}],"env":[],"color":"#A70625","inputLabels":["appliance id in payload and an action "],"outputLabels":["result"],"icon":"font-awesome/fa-angle-double-right","status":{"x":1010,"y":240,"wires":[{"id":"e4fefa21.402038","port":0},{"id":"9ebcdded.4fad9","port":0},{"id":"ebacb8a0.327d58","port":0}]}},{"id":"dafbb889.fb7f58","type":"http request","z":"ad607e01.511ea","name":"PUT to Miele","method":"PUT","ret":"obj","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":499,"y":188,"wires":[["21b0eeb.798de12"]]},{"id":"8bbd1614.6e5288","type":"change","z":"ad607e01.511ea","name":"url, body","rules":[{"t":"set","p":"url","pt":"msg","to":"\"https://api.mcs3.miele.com/v1/devices/\" & payload & \"/actions/\"","tot":"jsonata"},{"t":"move","p":"action","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":389,"y":68,"wires":[["47b32910.93a498"]]},{"id":"2542e5f6.b0fd8a","type":"function","z":"ad607e01.511ea","name":"verify input","func":"// verify bearer & msg properties\nif (!global.get('system_bearerMiele')) {\n    node.error('global variable system_bearerMiele not defined', msg)\n    return [null, {payload:'invalid global variable'}]\n}\nif (!msg.payload){\n    node.error('invalid msg.payload - device id', msg)\n    return [null, {payload:\"invalid msg.payload - device id\"}]\n}\nif (!msg.action){\n    node.error('invalid msg.action - action', msg)\n    return [null, {payload:\"invalid msg.action - action\"}]\n}\nreturn [msg, null]","outputs":2,"noerr":0,"x":193,"y":75,"wires":[["8bbd1614.6e5288"],["ebacb8a0.327d58"]]},{"id":"f7de50c4.54625","type":"template","z":"ad607e01.511ea","name":"header with authorization","field":"headers","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"Authorization\":\"bearer {{global.system_bearerMiele}}\", \"Accept\": \"application/json\", \"Accept-Charset\": \"utf-8\"}","output":"json","x":459,"y":146,"wires":[["dafbb889.fb7f58"]]},{"id":"21b0eeb.798de12","type":"switch","z":"ad607e01.511ea","name":"ok?","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":693,"y":80,"wires":[["e4fefa21.402038"],["6ad0d242.05cb5c"]]},{"id":"6ad0d242.05cb5c","type":"function","z":"ad607e01.511ea","name":"throw error","func":"node.error('http error: ' + msg.payload.message, msg)\nreturn msg\n","outputs":1,"noerr":0,"x":716,"y":160,"wires":[["9ebcdded.4fad9"]]},{"id":"9ebcdded.4fad9","type":"template","z":"ad607e01.511ea","name":"error  http","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"fill\":\"red\",\"shape\":\"dot\",\"text\":\"error: {{payload.message}}\"}","output":"json","x":863,"y":160,"wires":[[]]},{"id":"e4fefa21.402038","type":"template","z":"ad607e01.511ea","name":"ok!","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"fill\":\"green\",\"shape\":\"dot\",\"text\":\"ok!\"}","output":"json","x":873,"y":120,"wires":[[]]},{"id":"ebacb8a0.327d58","type":"template","z":"ad607e01.511ea","name":"error input","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"fill\":\"red\",\"shape\":\"dot\",\"text\":\"error: {{payload}}\"}","output":"json","x":330,"y":240,"wires":[[]]},{"id":"47b32910.93a498","type":"json","z":"ad607e01.511ea","name":"","property":"payload","action":"obj","pretty":false,"x":399,"y":108,"wires":[["f7de50c4.54625"]]},{"id":"4ae29caa.8056e4","type":"subflow","name":"get actions","info":"Get an object with all valid actions for the given appliance id at the current appliance state.\n\nPrereq: bearer in global variable system_bearerMiele","category":"Miele","in":[{"x":40,"y":88,"wires":[{"id":"d3015191.5633d"}]}],"out":[{"x":1099,"y":38,"wires":[{"id":"c8655abf.93b328","port":0}]}],"env":[],"color":"#A70625","inputLabels":["appliance id"],"outputLabels":["all actions"],"icon":"node-red/debug.svg","status":{"x":1099,"y":158,"wires":[{"id":"2c02bcd4.dc63d4","port":0},{"id":"1455fb1d.b32055","port":0},{"id":"d9bc2537.715df8","port":0}]}},{"id":"a2806ac3.d3a2d8","type":"http request","z":"4ae29caa.8056e4","name":"GET from Miele","method":"GET","ret":"obj","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":460,"y":118,"wires":[["c8655abf.93b328"]]},{"id":"e9e5b981.24d568","type":"change","z":"4ae29caa.8056e4","name":"msg.url, no payload","rules":[{"t":"set","p":"url","pt":"msg","to":"\"https://api.mcs3.miele.com/v1/devices/\" & payload & \"/actions/\"","tot":"jsonata"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":78,"wires":[["a2806ac3.d3a2d8"]]},{"id":"f2707f72.38a2f","type":"template","z":"4ae29caa.8056e4","name":"msg.headers with authorization","field":"headers","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"Authorization\":\"bearer {{global.system_bearerMiele}}\", \"Accept\": \"application/json\", \"Accept-Charset\": \"utf-8\"}","output":"json","x":429,"y":38,"wires":[["e9e5b981.24d568"]]},{"id":"d3015191.5633d","type":"function","z":"4ae29caa.8056e4","name":"verify input","func":"// verify bearer & msg properties\nif (!global.get('system_bearerMiele')) {\n    node.error('global variable system_bearerMiele not defined', msg)\n    return [null, {payload:'invalid global variable'}]\n}\nif (!msg.payload){\n    node.error('invalid msg.payload - device id', msg)\n    return [null, {payload:\"invalid msg.payload - device id\"}]\n}\nreturn [msg, null]","outputs":2,"noerr":0,"x":198,"y":88,"wires":[["f2707f72.38a2f"],["d9bc2537.715df8"]]},{"id":"c8655abf.93b328","type":"switch","z":"4ae29caa.8056e4","name":"ok?","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":703,"y":38,"wires":[["2c02bcd4.dc63d4"],["52535782.315028"]]},{"id":"52535782.315028","type":"function","z":"4ae29caa.8056e4","name":"throw error","func":"node.error('http error: ' + msg.payload.message, msg)\nreturn msg\n","outputs":1,"noerr":0,"x":815,"y":118,"wires":[["1455fb1d.b32055"]]},{"id":"1455fb1d.b32055","type":"template","z":"4ae29caa.8056e4","name":"error  http","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"fill\":\"red\",\"shape\":\"dot\",\"text\":\"error: {{payload.message}}\"}","output":"json","x":962,"y":118,"wires":[[]]},{"id":"2c02bcd4.dc63d4","type":"template","z":"4ae29caa.8056e4","name":"ok!","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"fill\":\"green\",\"shape\":\"dot\",\"text\":\"ok!\"}","output":"json","x":972,"y":78,"wires":[[]]},{"id":"d9bc2537.715df8","type":"template","z":"4ae29caa.8056e4","name":"error input","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"fill\":\"red\",\"shape\":\"dot\",\"text\":\"error: {{payload}}\"}","output":"json","x":310,"y":158,"wires":[[]]},{"id":"aeba9414.6f40a8","type":"subflow","name":"get appliance","info":"Get an object with identification and state data for the given appliance id.\n\nPrereq: bearer in global variable system_bearerMiele","category":"Miele","in":[{"x":40,"y":97,"wires":[{"id":"a260e272.ea783"}]}],"out":[{"x":1143,"y":33,"wires":[{"id":"3da93881.b6e868","port":0}]}],"env":[{"name":"language","type":"str","value":"en","ui":{"label":{"en-US":"Language"},"type":"select","opts":{"opts":[{"l":{"en-US":"English"},"v":"en"},{"l":{"en-US":"Deutsch"},"v":"de"}]}}}],"color":"#A70625","inputLabels":["appliance id as payload"],"outputLabels":["appliance identification and state"],"icon":"font-awesome/fa-info","status":{"x":1140,"y":164,"wires":[{"id":"dd906f4c.1361a","port":0},{"id":"fd32a717.878c28","port":0},{"id":"96a3026.b505b","port":0}]}},{"id":"88aafd6a.c0982","type":"http request","z":"aeba9414.6f40a8","name":"GET from Miele","method":"GET","ret":"obj","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":460,"y":120,"wires":[["3da93881.b6e868"]]},{"id":"3f0996d.8ed756a","type":"change","z":"aeba9414.6f40a8","name":"msg.url, no payload","rules":[{"t":"set","p":"url","pt":"msg","to":"\"https://api.mcs3.miele.com/v1/devices/\" & payload & \"/?language=\" & $env('language')","tot":"jsonata"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":80,"wires":[["88aafd6a.c0982"]]},{"id":"98d65a27.8020b8","type":"template","z":"aeba9414.6f40a8","name":"msg.headers with authorization","field":"headers","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"Authorization\":\"bearer {{global.system_bearerMiele}}\", \"Accept\": \"application/json\", \"Accept-Charset\": \"utf-8\"}","output":"json","x":410,"y":40,"wires":[["3f0996d.8ed756a"]]},{"id":"a260e272.ea783","type":"function","z":"aeba9414.6f40a8","name":"verify input","func":"// verify bearer & msg properties\nif (!global.get('system_bearerMiele')) {\n    node.error('global variable system_bearerMiele not defined', msg)\n    return [null, {payload:'invalid global variable'}]\n}\nif (!msg.payload){\n    node.error('invalid msg.payload - device id', msg)\n    return [null, {payload:\"invalid msg.payload - device id\"}]\n}\nreturn [msg, null]","outputs":2,"noerr":0,"x":192,"y":97,"wires":[["98d65a27.8020b8"],["fd32a717.878c28"]]},{"id":"3da93881.b6e868","type":"switch","z":"aeba9414.6f40a8","name":"ok?","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":670,"y":40,"wires":[["96a3026.b505b"],["6a599077.f8081"]]},{"id":"6a599077.f8081","type":"function","z":"aeba9414.6f40a8","name":"throw error","func":"node.error('http error: ' + msg.payload.message, msg)\nreturn msg\n","outputs":1,"noerr":0,"x":830,"y":120,"wires":[["dd906f4c.1361a"]]},{"id":"dd906f4c.1361a","type":"template","z":"aeba9414.6f40a8","name":"error  http","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"fill\":\"red\",\"shape\":\"dot\",\"text\":\"error: {{payload.message}}\"}","output":"json","x":980,"y":120,"wires":[[]]},{"id":"fd32a717.878c28","type":"template","z":"aeba9414.6f40a8","name":"error input","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"fill\":\"red\",\"shape\":\"dot\",\"text\":\"error: {{payload}}\"}","output":"json","x":350,"y":164,"wires":[[]]},{"id":"96a3026.b505b","type":"template","z":"aeba9414.6f40a8","name":"ok!","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"fill\":\"green\",\"shape\":\"dot\",\"text\":\"ok!\"}","output":"json","x":990,"y":80,"wires":[[]]},{"id":"ea970db4.5106b","type":"subflow","name":"get all appliances","info":"Get a list of all appliances with indentification and state.\n\nPrereq: bearer in global variable system_bearerMiele","category":"Miele","in":[{"x":40,"y":80,"wires":[{"id":"eaf22f71.d9969"}]}],"out":[{"x":1119,"y":74,"wires":[{"id":"a35f8dee.9f18f","port":0}]}],"env":[{"name":"language","type":"str","value":"en","ui":{"label":{"en-US":"Language"},"type":"select","opts":{"opts":[{"l":{"en-US":"English"},"v":"en"},{"l":{"en-US":"Deutsch"},"v":"de"}]}}}],"color":"#A70625","inputLabels":["just trigger"],"outputLabels":["appliance list in household"],"icon":"font-awesome/fa-list-ul","status":{"x":1120,"y":220,"wires":[{"id":"fe83c7a3.1ef478","port":0},{"id":"84b66c9d.f62ef","port":0},{"id":"681dd18d.1baa4","port":0}]}},{"id":"1cb172b5.14d9cd","type":"http request","z":"ea970db4.5106b","name":"GET from Miele","method":"GET","ret":"obj","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":480,"y":160,"wires":[["a35f8dee.9f18f"]]},{"id":"93008453.2d0988","type":"change","z":"ea970db4.5106b","name":"define url delete payload","rules":[{"t":"set","p":"url","pt":"msg","to":"\"https://api.mcs3.miele.com/v1/devices/?language=\" & $env('language')","tot":"jsonata"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":120,"wires":[["1cb172b5.14d9cd"]]},{"id":"d7fd649a.9ff818","type":"template","z":"ea970db4.5106b","name":"header with authorization","field":"headers","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"Authorization\":\"bearer {{global.system_bearerMiele}}\", \"Accept\": \"application/json\", \"Accept-Charset\": \"utf-8\"}","output":"json","x":429,"y":80,"wires":[["93008453.2d0988"]]},{"id":"eaf22f71.d9969","type":"function","z":"ea970db4.5106b","name":"verify input","func":"// verify token\nif (!global.get('system_bearerMiele')) {\n    node.error('global variable system_bearerMiele not defined', msg)\n    return [null, {payload:'invalid global variable'}]\n}\nreturn [msg, null]","outputs":2,"noerr":0,"x":218,"y":80,"wires":[["d7fd649a.9ff818"],["681dd18d.1baa4"]]},{"id":"a35f8dee.9f18f","type":"switch","z":"ea970db4.5106b","name":"ok?","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":650,"y":80,"wires":[["84b66c9d.f62ef"],["8c52e1d0.35a7c"]]},{"id":"8c52e1d0.35a7c","type":"function","z":"ea970db4.5106b","name":"throw error","func":"node.error('http error: ' + msg.payload.message, msg)\nreturn msg\n","outputs":1,"noerr":0,"x":810,"y":160,"wires":[["fe83c7a3.1ef478"]]},{"id":"fe83c7a3.1ef478","type":"template","z":"ea970db4.5106b","name":"error http","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"fill\":\"red\",\"shape\":\"dot\",\"text\":\"error: {{payload.message}}\"}","output":"json","x":963,"y":160,"wires":[[]]},{"id":"84b66c9d.f62ef","type":"template","z":"ea970db4.5106b","name":"ok!","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"fill\":\"green\",\"shape\":\"dot\",\"text\":\"ok!\"}","output":"json","x":954,"y":120,"wires":[[]]},{"id":"681dd18d.1baa4","type":"template","z":"ea970db4.5106b","name":"error input","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"fill\":\"red\",\"shape\":\"dot\",\"text\":\"error: {{payload}}\"}","output":"json","x":390,"y":218,"wires":[[]]},{"id":"24092027.ab82","type":"subflow","name":"get bearer","info":"Get a new bearer and refresh token and stores it in global variables. \n\nThe global variables system_bearerMiele and system_refreshMiele are being used.","category":"Miele","in":[{"x":30,"y":63,"wires":[{"id":"85119bed.21b168"}]}],"out":[{"x":1221,"y":43,"wires":[{"id":"430fd0da.a6602","port":0}]}],"env":[{"name":"vg","type":"str","value":"de-DE","ui":{"label":{"en-US":"Country"},"type":"select","opts":{"opts":[{"l":{"en-US":"Germany"},"v":"de-DE"}]}}},{"name":"doRefresh","type":"bool","value":"false","ui":{"label":{"en-US":"Use refresh token"},"type":"checkbox","opts":{}}}],"color":"#A70625","inputLabels":["client and user credentials"],"outputLabels":["Miele reponse object"],"icon":"font-awesome/fa-key","status":{"x":1221,"y":254,"wires":[{"id":"ccdd1aa3.d7afe8","port":0},{"id":"afceb2f2.d18f3","port":0},{"id":"4400b51a.44eacc","port":0}]}},{"id":"7742f9f5.4a43e8","type":"change","z":"24092027.ab82","name":"get env","rules":[{"t":"set","p":"vg","pt":"msg","to":"vg","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":63,"wires":[["cbba5ff0.57a32"]]},{"id":"e44fd735.4b89a8","type":"switch","z":"24092027.ab82","name":"ok?","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":774,"y":143,"wires":[["ccdd1aa3.d7afe8","430fd0da.a6602"],["32c1a07f.b3aaa"]]},{"id":"32c1a07f.b3aaa","type":"function","z":"24092027.ab82","name":"throw error","func":"node.error('http error: ' + msg.payload.message, msg)\nreturn msg\n","outputs":1,"noerr":0,"x":934,"y":223,"wires":[["afceb2f2.d18f3"]]},{"id":"afceb2f2.d18f3","type":"template","z":"24092027.ab82","name":"error  http","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"fill\":\"red\",\"shape\":\"dot\",\"text\":\"error: {{payload.message}}\"}","output":"json","x":1081,"y":223,"wires":[[]]},{"id":"ccdd1aa3.d7afe8","type":"template","z":"24092027.ab82","name":"ok!","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"fill\":\"green\",\"shape\":\"dot\",\"text\":\"ok!\"}","output":"json","x":1091,"y":183,"wires":[[]]},{"id":"4400b51a.44eacc","type":"template","z":"24092027.ab82","name":"error input","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"fill\":\"red\",\"shape\":\"dot\",\"text\":\"error: {{payload}}\"}","output":"json","x":360,"y":258,"wires":[[]]},{"id":"85119bed.21b168","type":"function","z":"24092027.ab82","name":"verify input","func":"// verify bearer & msg properties\nif (!msg.username) {\n    node.error('msg.username not defined', msg)\n    return [null, {payload:'msg.username not defined'}]\n}\nif (!msg.password){\n    node.error('msg.password not defined', msg)\n    return [null, {payload:\"msg.password not definedd\"}]\n}\nif (!msg.clientId){\n    node.error('msg.clientId not defined', msg)\n    return [null, {payload:\"msg.clientId not defined\"}]\n}\nif (!msg.clientSecret){\n    node.error('msg.clientSecret not defined', msg)\n    return [null, {payload:\"msg.clientSecret not defined\"}]\n}\nreturn [msg, null]","outputs":2,"noerr":0,"x":160,"y":63,"wires":[["7742f9f5.4a43e8"],["4400b51a.44eacc"]]},{"id":"994c115f.0117b","type":"template","z":"24092027.ab82","name":"create body new","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"grant_type=password&username={{username}}&password={{password}}&client_id={{clientId}}&client_secret={{clientSecret}}&vg={{vg}}","output":"str","x":527,"y":103,"wires":[["a1d20301.4f124"]]},{"id":"a1d20301.4f124","type":"change","z":"24092027.ab82","name":"define url, headers","rules":[{"t":"set","p":"url","pt":"msg","to":"https://api.mcs3.miele.com/thirdparty/token/","tot":"str"},{"t":"set","p":"headers","pt":"msg","to":"{\"Content-Type\":\"application/x-www-form-urlencoded\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":754,"y":63,"wires":[["d782c3de.6219"]]},{"id":"d782c3de.6219","type":"http request","z":"24092027.ab82","name":"","method":"POST","ret":"obj","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":774,"y":103,"wires":[["e44fd735.4b89a8"]]},{"id":"98c0b90e.acfad8","type":"comment","z":"24092027.ab82","name":"Miele only supports form encoded","info":"","x":530,"y":23,"wires":[]},{"id":"430fd0da.a6602","type":"change","z":"24092027.ab82","name":"","rules":[{"t":"set","p":"system_bearerMiele","pt":"global","to":"payload.access_token","tot":"msg"},{"t":"set","p":"system_refreshMiele","pt":"global","to":"payload.refresh_token","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1001,"y":136,"wires":[[]]},{"id":"6fe89867.753478","type":"template","z":"24092027.ab82","name":"create body refresh","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"grant_type=refresh_token&refresh_token={{global.system_refreshMiele}}&client_id={{clientId}}&client_secret={{clientSecret}}&vg={{vg}}","output":"str","x":537,"y":63,"wires":[["a1d20301.4f124"]]},{"id":"cbba5ff0.57a32","type":"switch","z":"24092027.ab82","name":"","property":"doRefresh","propertyType":"env","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":360,"y":103,"wires":[["6fe89867.753478"],["994c115f.0117b"]]},{"id":"dea3f134.ddc37","type":"inject","z":"91448cef.2efc9","name":"trigger","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":91,"y":150,"wires":[["6ac23f94.dc3d"]]},{"id":"feb96bef.d13c48","type":"comment","z":"91448cef.2efc9","name":"B. get information about all devices","info":"","x":147,"y":117,"wires":[]},{"id":"df69bc9f.4c2d5","type":"debug","z":"91448cef.2efc9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":748,"y":400,"wires":[]},{"id":"754625fb.8865fc","type":"inject","z":"91448cef.2efc9","name":"","topic":"","payload":"000149287451","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":124,"y":323,"wires":[["33b22f76.f4038"]]},{"id":"2ecedcf0.da0db4","type":"comment","z":"91448cef.2efc9","name":"C. get all information about one specifc device","info":"","x":175,"y":289,"wires":[]},{"id":"7a654d71.f942e4","type":"comment","z":"91448cef.2efc9","name":"D. get all actions of one specific device - depend on the current state of the device","info":"","x":285,"y":615,"wires":[]},{"id":"45bd620f.4b086c","type":"comment","z":"91448cef.2efc9","name":"A. get new bearer  - also do refresh token","info":"","x":165,"y":20,"wires":[]},{"id":"fed8fd9e.68c2d","type":"inject","z":"91448cef.2efc9","name":"trigger","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":87,"y":53,"wires":[["f5ecdf57.03ab1"]]},{"id":"a048c655.ec1f78","type":"subflow:24092027.ab82","z":"91448cef.2efc9","name":"","env":[{"name":"language","value":"de","type":"str"},{"name":"clientId","value":"xx","type":"str"},{"name":"clientSecret","value":"xxx","type":"str"},{"name":"username","value":"xxxxx","type":"str"},{"name":"password","value":"xxxxxx","type":"str"}],"x":391,"y":53,"wires":[["df69bc9f.4c2d5"]]},{"id":"f5ecdf57.03ab1","type":"credentials","z":"91448cef.2efc9","name":"","props":[{"value":"username","type":"msg"},{"value":"password","type":"msg"},{"value":"clientId","type":"msg"},{"value":"clientSecret","type":"msg"}],"x":230,"y":53,"wires":[["a048c655.ec1f78"]]},{"id":"6ac23f94.dc3d","type":"subflow:ea970db4.5106b","z":"91448cef.2efc9","name":"","env":[],"x":254,"y":150,"wires":[["df69bc9f.4c2d5"]]},{"id":"33b22f76.f4038","type":"subflow:aeba9414.6f40a8","z":"91448cef.2efc9","name":"","env":[{"name":"language","value":"de","type":"str"}],"x":305,"y":323,"wires":[["df69bc9f.4c2d5"]]},{"id":"bc574599.2b5938","type":"comment","z":"91448cef.2efc9","name":"C. get current status of a specifc device","info":"","x":155,"y":443,"wires":[]},{"id":"8912f7bb.095be8","type":"inject","z":"91448cef.2efc9","name":"","topic":"","payload":"000149287451","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":124,"y":476,"wires":[["9100eaf.d08d818"]]},{"id":"9100eaf.d08d818","type":"subflow:aeba9414.6f40a8","z":"91448cef.2efc9","name":"","env":[{"name":"language","value":"de","type":"str"}],"x":305,"y":476,"wires":[["ffb4b516.d45be8"]]},{"id":"d4f62349.a5a59","type":"comment","z":"91448cef.2efc9","name":"C. get current device type of a specifc device","info":"","x":175,"y":367,"wires":[]},{"id":"3eee5c2a.855a04","type":"inject","z":"91448cef.2efc9","name":"","topic":"","payload":"000149287451","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":124,"y":400,"wires":[["2640e37d.d5b69c"]]},{"id":"2640e37d.d5b69c","type":"subflow:aeba9414.6f40a8","z":"91448cef.2efc9","name":"","env":[{"name":"language","value":"de","type":"str"}],"x":305,"y":400,"wires":[["35daca5.d3adb36"]]},{"id":"1e76a8e5.b32bc7","type":"comment","z":"91448cef.2efc9","name":"B. get device id of first device","info":"","x":125,"y":191,"wires":[]},{"id":"4590828c.8b3f2c","type":"inject","z":"91448cef.2efc9","name":"trigger","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":224,"wires":[["472d288e.030668"]]},{"id":"472d288e.030668","type":"subflow:ea970db4.5106b","z":"91448cef.2efc9","name":"","env":[],"x":251,"y":224,"wires":[["d960c503.4130c8"]]},{"id":"d960c503.4130c8","type":"function","z":"91448cef.2efc9","name":"id first object","func":"msg.payload = msg.payload[Object.keys(msg.payload)[0]].ident.deviceIdentLabel.fabNumber\nreturn msg;","outputs":1,"noerr":0,"x":433,"y":224,"wires":[["df69bc9f.4c2d5"]]},{"id":"80c862b8.062ff","type":"comment","z":"91448cef.2efc9","name":"C. get remaining time of specific device","info":"","x":155,"y":520,"wires":[]},{"id":"c47bb64d.541918","type":"inject","z":"91448cef.2efc9","name":"","topic":"","payload":"000149287451","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":124,"y":553,"wires":[["77c1288.984c0d8"]]},{"id":"77c1288.984c0d8","type":"subflow:aeba9414.6f40a8","z":"91448cef.2efc9","name":"","env":[{"name":"language","value":"de","type":"str"}],"x":305,"y":553,"wires":[["5dfa60dc.87fc8"]]},{"id":"5dfa60dc.87fc8","type":"change","z":"91448cef.2efc9","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.state.remainingTime[0]*60 + payload.state.remainingTime[1] &  \" min\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":491,"y":553,"wires":[["df69bc9f.4c2d5"]]},{"id":"35daca5.d3adb36","type":"change","z":"91448cef.2efc9","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.ident.type.value_localized","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":491,"y":400,"wires":[["df69bc9f.4c2d5"]]},{"id":"ffb4b516.d45be8","type":"change","z":"91448cef.2efc9","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.state.status.value_localized","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":491,"y":476,"wires":[["df69bc9f.4c2d5"]]},{"id":"f278936b.e797","type":"subflow:4ae29caa.8056e4","z":"91448cef.2efc9","name":"","env":[{"name":"language","value":"de","type":"str"}],"x":295,"y":648,"wires":[["df69bc9f.4c2d5"]]},{"id":"9c8e0be2.1c8a58","type":"inject","z":"91448cef.2efc9","name":"","topic":"","payload":"000149287451","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":124,"y":648,"wires":[["f278936b.e797"]]},{"id":"c0e959c7.d684f8","type":"comment","z":"91448cef.2efc9","name":"E. execute command set name {\"deviceName\":\"My_Devicename\"}","info":"","x":245,"y":708,"wires":[]},{"id":"b7906361.bd13b","type":"inject","z":"91448cef.2efc9","name":"trigger","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":94,"y":740,"wires":[["21e8e59.be3271a"]]},{"id":"bba95584.0ba288","type":"subflow:ad607e01.511ea","z":"91448cef.2efc9","name":"","env":[{"name":"language","value":"de","type":"str"}],"x":423,"y":740,"wires":[["df69bc9f.4c2d5"]]},{"id":"6f3d8c02.c4ff64","type":"subflow:ad607e01.511ea","z":"91448cef.2efc9","name":"","env":[],"x":423,"y":821,"wires":[["df69bc9f.4c2d5"]]},{"id":"488026b0.68fa38","type":"comment","z":"91448cef.2efc9","name":"E. execute command stop {\"processAction\":2}","info":"","x":175,"y":788,"wires":[]},{"id":"21e8e59.be3271a","type":"change","z":"91448cef.2efc9","name":"machine id, action","rules":[{"t":"set","p":"payload","pt":"msg","to":"000149287451","tot":"str"},{"t":"set","p":"action","pt":"msg","to":"{\"deviceName\":\"hkMiele\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":249,"y":740,"wires":[["bba95584.0ba288"]]},{"id":"7ab1b56e.a9c78c","type":"inject","z":"91448cef.2efc9","name":"trigger","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":94,"y":821,"wires":[["c54123db.3130e"]]},{"id":"c54123db.3130e","type":"change","z":"91448cef.2efc9","name":"machine id, action","rules":[{"t":"set","p":"payload","pt":"msg","to":"000149287451","tot":"str"},{"t":"set","p":"action","pt":"msg","to":"{\"processAction\":2}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":249,"y":821,"wires":[["6f3d8c02.c4ff64"]]},{"id":"7f9fee0b.c9bac","type":"comment","z":"91448cef.2efc9","name":"both commands throw error 204 without error message although action was performed succesfully","info":"","x":910,"y":706,"wires":[]}]

Flow Info

Created 5 years, 1 month ago
Updated 4 years, 11 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x12)
  • comment (x12)
  • debug (x1)
  • function (x11)
  • http request (x5)
  • inject (x10)
  • json (x1)
  • switch (x6)
  • template (x21)
Other
  • credentials (x1)
  • subflow (x5)
  • subflow:24092027.ab82 (x1)
  • subflow:4ae29caa.8056e4 (x1)
  • subflow:ad607e01.511ea (x2)
  • subflow:aeba9414.6f40a8 (x4)
  • subflow:ea970db4.5106b (x2)

Tags

  • Miele
  • REST
  • Washing
  • Drying
  • Subflow
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option