Skip to content

Instantly share code, notes, and snippets.

@FlorianDessloch
Last active December 13, 2023 21:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FlorianDessloch/32ab59e2399e1b99f786fd40bfa0835a to your computer and use it in GitHub Desktop.
Save FlorianDessloch/32ab59e2399e1b99f786fd40bfa0835a to your computer and use it in GitHub Desktop.
Node Red Miele@Home Integration

These Flows use the exec node embedded in a few subflows to log into your miele@home account, to get information about and to control your Miele device. For commands, status lists and an account to use the API check out https://www.miele.com/developer/index.html Also check the FAQ-tab.

It seams to me, like the API is still buggy. Some actions shown by "get action" are not supported by my device (yet) and some actions like START and STOP result in an error but are carried out anyways.

[{
"id": "1d4d5eda.0ea591",
"type": "subflow",
"name": "put Action",
"info": "",
"category": "miele",
"in": [{
"x": 60,
"y": 100,
"wires": [{
"id": "7f552f3.aa2dad"
}
]
}
],
"out": [{
"x": 680,
"y": 160,
"wires": [{
"id": "7ed3f9c8.27e698",
"port": 0
}
]
}
],
"env": [{
"name": "bearer",
"type": "str",
"value": ""
}, {
"name": "device",
"type": "str",
"value": ""
}, {
"name": "action",
"type": "str",
"value": ""
}, {
"name": "parameter",
"type": "str",
"value": ""
}
],
"color": "#DDAA99",
"status": {
"x": 680,
"y": 80,
"wires": [{
"id": "7f552f3.aa2dad",
"port": 0
}, {
"id": "7ed3f9c8.27e698",
"port": 1
}
]
}
}, {
"id": "e459c4f9.d32338",
"type": "exec",
"z": "1d4d5eda.0ea591",
"command": "",
"addpay": true,
"append": "",
"useSpawn": "false",
"timer": "",
"oldrc": false,
"name": "get devices",
"x": 310,
"y": 140,
"wires": [["9af5b8fa.2292b8"], [], []]
}, {
"id": "9af5b8fa.2292b8",
"type": "json",
"z": "1d4d5eda.0ea591",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 450,
"y": 140,
"wires": [["7ed3f9c8.27e698"]]
}, {
"id": "7f552f3.aa2dad",
"type": "function",
"z": "1d4d5eda.0ea591",
"name": "",
"func": "let bearer = \"\";\nlet action = \"\";\nlet device = \"\";\nlet parameter = \"\";\n\n//node.send({payload: {fill:\"green\",shape:\"dot\",text:\"OK\"}});\n\nbearer = env.get(\"bearer\");\nif(msg.hasOwnProperty('bearer')) bearer=msg.bearer;\nif (bearer === \"\") node.send({payload: {fill:\"red\",shape:\"dot\",text:\"bearer missing\"}});\n\naction = env.get(\"action\");\nif(msg.hasOwnProperty('action')) action=msg.action;\nif (action === \"\") node.send({payload: {fill:\"red\",shape:\"dot\",text:\"actionuage missing\"}});\n\ndevice = env.get(\"device\");\nif(msg.hasOwnProperty('device')) lang=msg.device;\nif (device === \"\") node.send({payload: {fill:\"red\",shape:\"dot\",text:\"device missing\"}});\n\nparameter = env.get(\"parameter\");\nif(msg.hasOwnProperty('parameter')) client_id=msg.parameter;\nif (parameter === \"\") node.send({payload: {fill:\"green\",shape:\"dot\",text:\"parameter fehlt\"}});\n\nvar msg2;\nmsg2={payload: \"curl -X PUT \\\"https:\\/\\/api.mcs3.miele.com\\/v1\\/devices\\/\"+device+\"\\/actions\\\" -H \\\"accept: *\\/*\\\" -H \\\"Authorization: Bearer \"+bearer+\"\\\" -H \\\"Content-Type: application\\/json\\\" -d \\\"{\\\\\\\"\"+action+\"\\\\\\\":\"+parameter+\"}\\\"\"};\nmsg1=null;\nreturn [[msg1],[msg2]];\n",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 150,
"y": 100,
"wires": [[], ["e459c4f9.d32338"]]
}, {
"id": "7ed3f9c8.27e698",
"type": "function",
"z": "1d4d5eda.0ea591",
"name": "",
"func": "var msg1={topic:msg.topic, payload: msg.payload};\nvar msg2;\n//if(msg.payload.status.hasOwnProperty(\"value_raw\")) msg2={payload:{fill:\"green\",shape:\"dot\",text:\"OK\"}};\n\nreturn [[msg1],[msg2]];",
"outputs": 2,
"noerr": 0,
"x": 570,
"y": 140,
"wires": [[], []]
}, {
"id": "b4c5c5ea.b2a928",
"type": "subflow",
"name": "get Action",
"info": "",
"category": "miele",
"in": [{
"x": 160,
"y": 100,
"wires": [{
"id": "98e5b950.6a2c58"
}
]
}
],
"out": [{
"x": 920,
"y": 160,
"wires": [{
"id": "3a80d692.13ff1a",
"port": 0
}
]
}
],
"env": [{
"name": "bearer",
"type": "str",
"value": ""
}, {
"name": "lang",
"type": "str",
"value": ""
}, {
"name": "device",
"type": "str",
"value": ""
}
],
"color": "#DDAA99",
"status": {
"x": 840,
"y": 80,
"wires": [{
"id": "98e5b950.6a2c58",
"port": 0
}, {
"id": "3a80d692.13ff1a",
"port": 1
}
]
}
}, {
"id": "da26411a.dd69c",
"type": "exec",
"z": "b4c5c5ea.b2a928",
"command": "",
"addpay": true,
"append": "",
"useSpawn": "false",
"timer": "",
"oldrc": false,
"name": "get devices",
"x": 430,
"y": 140,
"wires": [["eac26908.58f308"], [], []]
}, {
"id": "eac26908.58f308",
"type": "json",
"z": "b4c5c5ea.b2a928",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 570,
"y": 140,
"wires": [["3a80d692.13ff1a"]]
}, {
"id": "98e5b950.6a2c58",
"type": "function",
"z": "b4c5c5ea.b2a928",
"name": "",
"func": "let bearer = \"\";\nlet device = \"\";\n\n//node.send({payload: {fill:\"green\",shape:\"dot\",text:\"OK\"}});\n\nbearer = env.get(\"bearer\");\nif(msg.hasOwnProperty('bearer')) bearer=msg.bearer;\nif (bearer === \"\") node.send({payload: {fill:\"red\",shape:\"dot\",text:\"bearer missing\"}});\n\ndevice = env.get(\"device\");\nif(msg.hasOwnProperty('device')) lang=msg.device;\nif (device === \"\") node.send({payload: {fill:\"red\",shape:\"dot\",text:\"device missing\"}});\n\nvar msg2;\nmsg2={payload: \"curl -X GET \\\"https://api.mcs3.miele.com/v1/devices/\"+device+\"/actions\\\" -H \\\"accept: application/json; charset=utf-8\\\" -H \\\"Authorization: Bearer \" + bearer + \"\\\"\"};\nmsg1=null;\nreturn [[msg1],[msg2]];\n",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 270,
"y": 100,
"wires": [[], ["da26411a.dd69c"]]
}, {
"id": "3a80d692.13ff1a",
"type": "function",
"z": "b4c5c5ea.b2a928",
"name": "",
"func": "var msg1={topic:msg.topic, payload: msg.payload};\nvar msg2;\nif(msg.payload.hasOwnProperty(\"powerOn\")) msg2={payload:{fill:\"green\",shape:\"dot\",text:\"OK\"}};\n\nreturn [[msg1],[msg2]];",
"outputs": 2,
"noerr": 0,
"x": 690,
"y": 140,
"wires": [[], []]
}, {
"id": "8755d135.de6bf",
"type": "subflow",
"name": "get device state",
"info": "",
"category": "miele",
"in": [{
"x": 100,
"y": 120,
"wires": [{
"id": "98292c27.d877"
}
]
}
],
"out": [{
"x": 820,
"y": 160,
"wires": [{
"id": "1e7270f4.3abf8f",
"port": 0
}
]
}
],
"env": [{
"name": "bearer",
"type": "str",
"value": ""
}, {
"name": "lang",
"type": "str",
"value": ""
}, {
"name": "device",
"type": "str",
"value": ""
}
],
"color": "#DDAA99",
"status": {
"x": 700,
"y": 40,
"wires": [{
"id": "98292c27.d877",
"port": 0
}, {
"id": "1e7270f4.3abf8f",
"port": 1
}
]
}
}, {
"id": "7466cfd7.a3fcd",
"type": "exec",
"z": "8755d135.de6bf",
"command": "",
"addpay": true,
"append": "",
"useSpawn": "false",
"timer": "",
"oldrc": false,
"name": "get devices",
"x": 370,
"y": 160,
"wires": [["fff7f619.892af8"], [], []]
}, {
"id": "fff7f619.892af8",
"type": "json",
"z": "8755d135.de6bf",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 510,
"y": 160,
"wires": [["1e7270f4.3abf8f"]]
}, {
"id": "98292c27.d877",
"type": "function",
"z": "8755d135.de6bf",
"name": "",
"func": "let bearer = \"\";\nlet lang = \"\";\nlet device = \"\";\n\n//node.send({payload: {fill:\"green\",shape:\"dot\",text:\"OK\"}});\n\nbearer = env.get(\"bearer\");\nif(msg.hasOwnProperty('bearer')) bearer=msg.bearer;\nif (bearer === \"\") node.send({payload: {fill:\"red\",shape:\"dot\",text:\"bearer missing\"}});\n\nlang = env.get(\"lang\");\nif(msg.hasOwnProperty('lang')) lang=msg.lang;\nif (lang === \"\") node.send({payload: {fill:\"red\",shape:\"dot\",text:\"language missing\"}});\n\ndevice = env.get(\"device\");\nif(msg.hasOwnProperty('device')) lang=msg.device;\nif (device === \"\") node.send({payload: {fill:\"red\",shape:\"dot\",text:\"device missing\"}});\n\nvar msg2;\nmsg2={payload: \"curl -X GET \\\"https://api.mcs3.miele.com/v1/devices/\"+device+\"/state?language=\" + lang +\"\\\" -H \\\"accept: application/json; charset=utf-8\\\" -H \\\"Authorization: Bearer \" + bearer + \"\\\"\"};\nmsg1=null;\nreturn [[msg1],[msg2]];\n",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 210,
"y": 120,
"wires": [[], ["7466cfd7.a3fcd"]]
}, {
"id": "1e7270f4.3abf8f",
"type": "function",
"z": "8755d135.de6bf",
"name": "",
"func": "var msg1={topic:msg.topic, payload: msg.payload};\nvar msg2;\nif(msg.payload.status.hasOwnProperty(\"value_raw\")) msg2={payload:{fill:\"green\",shape:\"dot\",text:\"OK\"}};\n\nreturn [[msg1],[msg2]];",
"outputs": 2,
"noerr": 0,
"x": 630,
"y": 160,
"wires": [[], []]
}, {
"id": "bcad6a16.fbc798",
"type": "subflow",
"name": "get device ident",
"info": "",
"category": "miele",
"in": [{
"x": 140,
"y": 80,
"wires": [{
"id": "81c0a717.e9f738"
}
]
}
],
"out": [{
"x": 840,
"y": 80,
"wires": [{
"id": "b462fa37.689438",
"port": 0
}
]
}
],
"env": [{
"name": "bearer",
"type": "str",
"value": ""
}, {
"name": "lang",
"type": "str",
"value": ""
}, {
"name": "device",
"type": "str",
"value": ""
}
],
"color": "#DDAA99",
"status": {
"x": 760,
"y": 40,
"wires": [{
"id": "81c0a717.e9f738",
"port": 0
}, {
"id": "b462fa37.689438",
"port": 1
}
]
}
}, {
"id": "245908be.c28b58",
"type": "exec",
"z": "bcad6a16.fbc798",
"command": "",
"addpay": true,
"append": "",
"useSpawn": "false",
"timer": "",
"oldrc": false,
"name": "get devices",
"x": 410,
"y": 120,
"wires": [["2e2c716e.8292ee"], [], []]
}, {
"id": "2e2c716e.8292ee",
"type": "json",
"z": "bcad6a16.fbc798",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 550,
"y": 120,
"wires": [["b462fa37.689438"]]
}, {
"id": "81c0a717.e9f738",
"type": "function",
"z": "bcad6a16.fbc798",
"name": "",
"func": "let bearer = \"\";\nlet lang = \"\";\nlet device = \"\";\n\n//node.send({payload: {fill:\"green\",shape:\"dot\",text:\"OK\"}});\n\nbearer = env.get(\"bearer\");\nif(msg.hasOwnProperty('bearer')) bearer=msg.bearer;\nif (bearer === \"\") node.send({payload: {fill:\"red\",shape:\"dot\",text:\"bearer missing\"}});\n\nlang = env.get(\"lang\");\nif(msg.hasOwnProperty('lang')) lang=msg.lang;\nif (lang === \"\") node.send({payload: {fill:\"red\",shape:\"dot\",text:\"language missing\"}});\n\ndevice = env.get(\"device\");\nif(msg.hasOwnProperty('device')) lang=msg.device;\nif (device === \"\") node.send({payload: {fill:\"red\",shape:\"dot\",text:\"device missing\"}});\n\nvar msg2;\nmsg2={payload: \"curl -X GET \\\"https://api.mcs3.miele.com/v1/devices/\"+device+\"/ident?language=\" + lang +\"\\\" -H \\\"accept: application/json; charset=utf-8\\\" -H \\\"Authorization: Bearer \" + bearer + \"\\\"\"};\nmsg1=null;\nreturn [[msg1],[msg2]];\n",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 250,
"y": 80,
"wires": [[], ["245908be.c28b58"]]
}, {
"id": "b462fa37.689438",
"type": "function",
"z": "bcad6a16.fbc798",
"name": "",
"func": "var msg1={topic:msg.topic, payload: msg.payload};\nvar msg2;\nif(msg.payload.deviceIdentLabel.hasOwnProperty(\"fabNumber\")) msg2={payload:{fill:\"green\",shape:\"dot\",text:\"OK\"}};\n\nreturn [[msg1],[msg2]];",
"outputs": 2,
"noerr": 0,
"x": 670,
"y": 120,
"wires": [[], []]
}, {
"id": "390beeb8.8a5162",
"type": "subflow",
"name": "get device info",
"info": "",
"category": "miele",
"in": [{
"x": 260,
"y": 80,
"wires": [{
"id": "fdbbe7f7.00ba18"
}
]
}
],
"out": [{
"x": 940,
"y": 100,
"wires": [{
"id": "70e93124.23da5",
"port": 0
}
]
}
],
"env": [{
"name": "bearer",
"type": "str",
"value": ""
}, {
"name": "lang",
"type": "str",
"value": ""
}, {
"name": "device",
"type": "str",
"value": ""
}
],
"color": "#DDAA99",
"status": {
"x": 680,
"y": 40,
"wires": [{
"id": "fdbbe7f7.00ba18",
"port": 0
}, {
"id": "70e93124.23da5",
"port": 1
}
]
}
}, {
"id": "e8cbb2ba.6bc16",
"type": "exec",
"z": "390beeb8.8a5162",
"command": "",
"addpay": true,
"append": "",
"useSpawn": "false",
"timer": "",
"oldrc": false,
"name": "get devices",
"x": 530,
"y": 120,
"wires": [["ee0f6d14.6f4c3"], [], []]
}, {
"id": "ee0f6d14.6f4c3",
"type": "json",
"z": "390beeb8.8a5162",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 670,
"y": 120,
"wires": [["70e93124.23da5"]]
}, {
"id": "fdbbe7f7.00ba18",
"type": "function",
"z": "390beeb8.8a5162",
"name": "",
"func": "let bearer = \"\";\nlet lang = \"\";\nlet device = \"\";\n\n//node.send({payload: {fill:\"green\",shape:\"dot\",text:\"OK\"}});\n\nbearer = env.get(\"bearer\");\nif(msg.hasOwnProperty('bearer')) bearer=msg.bearer;\nif (bearer === \"\") node.send({payload: {fill:\"red\",shape:\"dot\",text:\"bearer missing\"}});\n\nlang = env.get(\"lang\");\nif(msg.hasOwnProperty('lang')) lang=msg.lang;\nif (lang === \"\") node.send({payload: {fill:\"red\",shape:\"dot\",text:\"language missing\"}});\n\ndevice = env.get(\"device\");\nif(msg.hasOwnProperty('device')) device=msg.device;\nif (device === \"\") node.send({payload: {fill:\"red\",shape:\"dot\",text:\"device missing\"}});\n\nvar msg2;\nmsg2={payload: \"curl -X GET \\\"https://api.mcs3.miele.com/v1/devices/\"+device+\"?language=\" + lang +\"\\\" -H \\\"accept: application/json; charset=utf-8\\\" -H \\\"Authorization: Bearer \" + bearer + \"\\\"\"};\nmsg1=null;\nreturn [[msg1],[msg2]];\n",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 370,
"y": 80,
"wires": [[], ["e8cbb2ba.6bc16"]]
}, {
"id": "70e93124.23da5",
"type": "function",
"z": "390beeb8.8a5162",
"name": "",
"func": "var msg1={topic:msg.topic, payload: msg.payload};\nvar msg2;\nif(msg.payload.ident.hasOwnProperty(\"deviceName\")) msg2={payload:{fill:\"green\",shape:\"dot\",text:\"OK\"}};\n\nreturn [[msg1],[msg2]];",
"outputs": 2,
"noerr": 0,
"x": 790,
"y": 120,
"wires": [[], []]
}, {
"id": "d79e6968.80ffa8",
"type": "subflow",
"name": "get devices",
"info": "",
"category": "miele",
"in": [{
"x": 50,
"y": 30,
"wires": [{
"id": "9c6730e2.d8dcd"
}
]
}
],
"out": [{
"x": 680,
"y": 140,
"wires": [{
"id": "3c9ff92.07e6c06",
"port": 0
}
]
}
],
"env": [{
"name": "bearer",
"type": "str",
"value": ""
}, {
"name": "lang",
"type": "str",
"value": ""
}
],
"color": "#DDAA99",
"status": {
"x": 700,
"y": 20,
"wires": [{
"id": "9c6730e2.d8dcd",
"port": 0
}
]
}
}, {
"id": "1cd22b3c.108b05",
"type": "exec",
"z": "d79e6968.80ffa8",
"command": "",
"addpay": true,
"append": "",
"useSpawn": "false",
"timer": "",
"oldrc": false,
"name": "get devices",
"x": 430,
"y": 140,
"wires": [["3c9ff92.07e6c06"], [], []]
}, {
"id": "3c9ff92.07e6c06",
"type": "json",
"z": "d79e6968.80ffa8",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 590,
"y": 140,
"wires": [[]]
}, {
"id": "9c6730e2.d8dcd",
"type": "function",
"z": "d79e6968.80ffa8",
"name": "",
"func": "let bearer = \"\";\nlet lang = \"\";\n\n//node.send({payload: {fill:\"green\",shape:\"dot\",text:\"OK\"}});\n\nbearer = env.get(\"bearer\");\nif(msg.hasOwnProperty('bearer')) bearer=msg.bearer;\nif (bearer === \"\") node.send({payload: {fill:\"red\",shape:\"dot\",text:\"bearer missing\"}});\n\nlang = env.get(\"lang\");\nif(msg.hasOwnProperty('lang')) lang=msg.lang;\nif (lang === \"\") node.send({payload: {fill:\"red\",shape:\"dot\",text:\"language missing\"}});\n\nvar msg2;\nmsg2={payload: \"curl -X GET \\\"https://api.mcs3.miele.com/v1/devices/?language=\" + lang +\"\\\" -H \\\"accept: application/json; charset=utf-8\\\" -H \\\"Authorization: Bearer \" + bearer + \"\\\"\"};\nmsg1=null;\nreturn [[msg1],[msg2]];\n",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 270,
"y": 100,
"wires": [[], ["1cd22b3c.108b05"]]
}, {
"id": "8b7bf7f.119a308",
"type": "subflow",
"name": "get Bearer",
"info": "This node uses your client_id, client_secret, username and password to get an autorization token, a so called Bearer (output 1) and a refresh token (output 2).\nAll parameters can be set using the incoming message.\nmsg.client_id, msg.client_secret, msg.[variable_name]...\ncoun_lang requires a combination of language and country, for germany it's DE-de.",
"category": "miele",
"in": [{
"x": 60,
"y": 80,
"wires": [{
"id": "272cb16.f5f164e"
}
]
}
],
"out": [{
"x": 720,
"y": 40,
"wires": [{
"id": "9af0fd2c.9426c",
"port": 0
}
]
}, {
"x": 720,
"y": 100,
"wires": [{
"id": "9af0fd2c.9426c",
"port": 1
}
]
}
],
"env": [{
"name": "client_id",
"type": "str",
"value": ""
}, {
"name": "client_secret",
"type": "str",
"value": ""
}, {
"name": "username",
"type": "str",
"value": ""
}, {
"name": "password",
"type": "str",
"value": ""
}, {
"name": "coun_lang",
"type": "str",
"value": ""
}
],
"color": "#DDAA99",
"outputLabels": ["Authorization Token", "Refresh Token"],
"status": {
"x": 720,
"y": 160,
"wires": [{
"id": "9af0fd2c.9426c",
"port": 2
}, {
"id": "272cb16.f5f164e",
"port": 0
}
]
}
}, {
"id": "1e9930fe.bf0faf",
"type": "exec",
"z": "8b7bf7f.119a308",
"command": "curl",
"addpay": true,
"append": "",
"useSpawn": "false",
"timer": "",
"oldrc": false,
"name": "get Bearer",
"x": 290,
"y": 40,
"wires": [["127e4047.65cb3"], [], []]
}, {
"id": "127e4047.65cb3",
"type": "json",
"z": "8b7bf7f.119a308",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 440,
"y": 40,
"wires": [["9af0fd2c.9426c"]]
}, {
"id": "9af0fd2c.9426c",
"type": "function",
"z": "8b7bf7f.119a308",
"name": "",
"func": "var msg1={topic:\"access_token\", payload: msg.payload.access_token};\nvar msg2={topic:\"refresh_token\", payload: msg.payload.refresh_token};\nvar msg3=null;\nif(msg.payload.hasOwnProperty('access_token') && msg.payload.hasOwnProperty('refresh_token')) msg3={payload:{fill:\"green\",shape:\"dot\",text:\"OK\"}};\n\nreturn [[msg1],[msg2],[msg3]];",
"outputs": 3,
"noerr": 0,
"x": 570,
"y": 40,
"wires": [[], [], []]
}, {
"id": "272cb16.f5f164e",
"type": "function",
"z": "8b7bf7f.119a308",
"name": "",
"func": "let client_id = \"\";\nlet client_secret = \"\";\nlet username = \"\";\nlet password = \"\";\nlet coun_lang = \"\";\n\nnode.send({payload: {fill:\"green\",shape:\"dot\",text:\"OK\"}});\n\nclient_id = env.get(\"client_id\");\nif(msg.hasOwnProperty('client_id')) client_id=msg.client_id;\nif (client_id === \"\") node.send({payload: {fill:\"green\",shape:\"dot\",text:\"Client_id fehlt\"}});\n\nclient_secret = env.get(\"client_secret\");\nif(msg.hasOwnProperty('client_secret')) client_secret=msg.client_secret;\nif (client_secret === \"\") node.send({payload: {fill:\"green\",shape:\"dot\",text:\"Client_secret fehlt\"}});\n\nusername = env.get(\"username\");\nif(msg.hasOwnProperty('username')) client_id=msg.username;\nif (username === \"\") node.send({payload: {fill:\"green\",shape:\"dot\",text:\"Username fehlt\"}});\n\npassword = env.get(\"password\");\nif(msg.hasOwnProperty('password')) client_id=msg.password;\nif (password === \"\") node.send({payload: {fill:\"green\",shape:\"dot\",text:\"Password fehlt\"}});\n\ncoun_lang = env.get(\"coun_lang\");\nif(msg.hasOwnProperty('coun_lang')) client_id=msg.coun_lang;\nif (coun_lang === \"\") node.send({payload: {fill:\"green\",shape:\"dot\",text:\"Country-Language fehlt\"}});\n\nvar msg2;\nmsg2={payload:\" -d \\\"grant_type=password\\\" -d \\\"client_id=\"+client_id+\n \"\\\" -d \\\"client_secret=\"+client_secret+\"\\\" -d \\\"username=\"+username+\n \"\\\" -d \\\"password=\"+password+\"\\\" -d \\\"vg=\"+coun_lang+\n \"\\\" https://api.mcs3.miele.com/thirdparty/token/\"};\nmsg1=null;\nreturn [[msg1],[msg2]];",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 150,
"y": 80,
"wires": [[], ["1e9930fe.bf0faf"]]
}, {
"id": "8cc73ce4.b2345",
"type": "inject",
"z": "8c044ad3.6aa2e8",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 240,
"y": 300,
"wires": [["4315b3b4.009d8c"]]
}, {
"id": "32015fbe.2f516",
"type": "function",
"z": "8c044ad3.6aa2e8",
"name": "set var",
"func": "global.set(\"mielebearer\",msg.payload);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 550,
"y": 300,
"wires": [[]]
}, {
"id": "3cffc84c.a8b748",
"type": "inject",
"z": "8c044ad3.6aa2e8",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 240,
"y": 360,
"wires": [["d073836.dc6fb8"]]
}, {
"id": "d073836.dc6fb8",
"type": "function",
"z": "8c044ad3.6aa2e8",
"name": "set var",
"func": "msg.lang=\"de\";\nmsg.bearer=global.get(\"mielebearer\");\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 370,
"y": 360,
"wires": [["2b0c40f3.cc07c"]]
}, {
"id": "ac0d4f3c.3f422",
"type": "debug",
"z": "8c044ad3.6aa2e8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 650,
"y": 360,
"wires": []
}, {
"id": "e0817a83.3638c8",
"type": "inject",
"z": "8c044ad3.6aa2e8",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 240,
"y": 420,
"wires": [["91b577ba.e11378"]]
}, {
"id": "91b577ba.e11378",
"type": "function",
"z": "8c044ad3.6aa2e8",
"name": "set var",
"func": "msg.lang=\"de\";\nmsg.bearer=global.get(\"mielebearer\");\n//msg.device=\"XXXXXXXXXXXX\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 370,
"y": 420,
"wires": [["679210e5.bb4a1"]]
}, {
"id": "84b603eb.7fb6d",
"type": "debug",
"z": "8c044ad3.6aa2e8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 670,
"y": 420,
"wires": []
}, {
"id": "2d89999e.2e6c96",
"type": "inject",
"z": "8c044ad3.6aa2e8",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 240,
"y": 480,
"wires": [["b331d5f2.a1c138"]]
}, {
"id": "b331d5f2.a1c138",
"type": "function",
"z": "8c044ad3.6aa2e8",
"name": "set var",
"func": "msg.lang=\"de\";\nmsg.bearer=global.get(\"mielebearer\");\n//msg.device=\"XXXXXXXXXXXX\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 370,
"y": 480,
"wires": [["69058e24.4db0e"]]
}, {
"id": "fc3b7cc5.0ac43",
"type": "debug",
"z": "8c044ad3.6aa2e8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 670,
"y": 480,
"wires": []
}, {
"id": "4d8b4405.b609cc",
"type": "comment",
"z": "8c044ad3.6aa2e8",
"name": "Returns all information about appliances linked to an user account.",
"info": "",
"x": 1040,
"y": 360,
"wires": []
}, {
"id": "37d27f0d.8c6b8",
"type": "comment",
"z": "8c044ad3.6aa2e8",
"name": "Returns all information about a single appliance linked to an user account",
"info": "",
"x": 1060,
"y": 420,
"wires": []
}, {
"id": "4f0c966b.5c13e8",
"type": "comment",
"z": "8c044ad3.6aa2e8",
"name": "Returns your access token / Bearer",
"info": "",
"x": 940,
"y": 300,
"wires": []
}, {
"id": "2940a41f.6a1dec",
"type": "inject",
"z": "8c044ad3.6aa2e8",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 240,
"y": 600,
"wires": [["8d502f9a.9cfae"]]
}, {
"id": "8d502f9a.9cfae",
"type": "function",
"z": "8c044ad3.6aa2e8",
"name": "set var",
"func": "msg.lang=\"de\";\nmsg.bearer=global.get(\"mielebearer\");\n//msg.device=\"XXXXXXXXXXXX\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 370,
"y": 600,
"wires": [["29bb8380.76988c"]]
}, {
"id": "1903fd7b.0d45a3",
"type": "debug",
"z": "8c044ad3.6aa2e8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 670,
"y": 600,
"wires": []
}, {
"id": "791c55db.267dcc",
"type": "comment",
"z": "8c044ad3.6aa2e8",
"name": "Returns the ident information of a single device",
"info": "",
"x": 980,
"y": 480,
"wires": []
}, {
"id": "a3209786.dafdc8",
"type": "comment",
"z": "8c044ad3.6aa2e8",
"name": "The GET action is used to request a device so send the currently supported actions",
"info": "",
"x": 1090,
"y": 600,
"wires": []
}, {
"id": "87379dd7.af663",
"type": "inject",
"z": "8c044ad3.6aa2e8",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 240,
"y": 540,
"wires": [["75c4daa.7552024"]]
}, {
"id": "75c4daa.7552024",
"type": "function",
"z": "8c044ad3.6aa2e8",
"name": "set var",
"func": "msg.lang=\"de\";\nmsg.bearer=global.get(\"mielebearer\");\n//msg.device=\"XXXXXXXXXXXX\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 370,
"y": 540,
"wires": [["22cd4a84.feb3f6"]]
}, {
"id": "d47b12a8.4c8ab",
"type": "debug",
"z": "8c044ad3.6aa2e8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 670,
"y": 540,
"wires": []
}, {
"id": "b4a6a8cf.4e9628",
"type": "comment",
"z": "8c044ad3.6aa2e8",
"name": "Returns the state information of a single device",
"info": "",
"x": 980,
"y": 540,
"wires": []
}, {
"id": "1c6f442f.16a17c",
"type": "inject",
"z": "8c044ad3.6aa2e8",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 240,
"y": 660,
"wires": [["322386e.eaa967a"]]
}, {
"id": "322386e.eaa967a",
"type": "function",
"z": "8c044ad3.6aa2e8",
"name": "set var",
"func": "msg.bearer=global.get(\"mielebearer\");\n//msg.device=\"XXXXXXXXXXXX\";\nmsg.action=\"processAction\";\nmsg.parameter=\"2\";\n//msg.action=\"deviceName\";\n//msg.parameter=\"\\\\\\\"myDevice\\\\\\\"\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 370,
"y": 660,
"wires": [["bf22df68.b3972"]]
}, {
"id": "4686037.45bf3fc",
"type": "debug",
"z": "8c044ad3.6aa2e8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 670,
"y": 660,
"wires": []
}, {
"id": "8909e20.acfb22",
"type": "comment",
"z": "8c044ad3.6aa2e8",
"name": "The PUT action is used invoke an action on a single device",
"info": "",
"x": 1010,
"y": 660,
"wires": []
}, {
"id": "4315b3b4.009d8c",
"type": "subflow:8b7bf7f.119a308",
"z": "8c044ad3.6aa2e8",
"name": "",
"env": [],
"x": 390,
"y": 300,
"wires": [["32015fbe.2f516"], []]
}, {
"id": "2b0c40f3.cc07c",
"type": "subflow:d79e6968.80ffa8",
"z": "8c044ad3.6aa2e8",
"name": "",
"env": [],
"x": 510,
"y": 360,
"wires": [["ac0d4f3c.3f422"]],
"info": "This node uses your autorization token, or Bearer your desired language (de and en are supported) to give you information about all of your devices as describes in https://www.miele.com/developer/swagger-ui/index.html#/.\nAll parameters can be set using the incoming message.\nmsg.bearer, msg.lang, basically it's msg.[variable_name]..."
}, {
"id": "679210e5.bb4a1",
"type": "subflow:390beeb8.8a5162",
"z": "8c044ad3.6aa2e8",
"name": "",
"env": [],
"x": 520,
"y": 420,
"wires": [["84b603eb.7fb6d"]],
"info": "This node uses your autorization token, or Bearer your desired language (de and en are supported) to give you information about one specific devices as describes in https://www.miele.com/developer/swagger-ui/index.html#/.\nAll parameters can be set using the incoming message.\nmsg.bearer, msg.lang, basically it's msg.[variable_name]..."
}, {
"id": "69058e24.4db0e",
"type": "subflow:bcad6a16.fbc798",
"z": "8c044ad3.6aa2e8",
"name": "",
"env": [],
"x": 520,
"y": 480,
"wires": [["fc3b7cc5.0ac43"]],
"info": "This node uses your autorization token, or Bearer your desired language (de and en are supported) to give you id-information about one specific devices as describes in https://www.miele.com/developer/swagger-ui/index.html#/.\nAll parameters can be set using the incoming message.\nmsg.bearer, msg.lang, basically it's msg.[variable_name]..."
}, {
"id": "22cd4a84.feb3f6",
"type": "subflow:8755d135.de6bf",
"z": "8c044ad3.6aa2e8",
"name": "",
"env": [],
"x": 520,
"y": 540,
"wires": [["d47b12a8.4c8ab"]],
"info": "This node uses your autorization token, or Bearer your desired language (de and en are supported) to give you the status of one specific devices as describes in https://www.miele.com/developer/swagger-ui/index.html#/.\nAll parameters can be set using the incoming message.\nmsg.bearer, msg.lang, basically it's msg.[variable_name]..."
}, {
"id": "29bb8380.76988c",
"type": "subflow:b4c5c5ea.b2a928",
"z": "8c044ad3.6aa2e8",
"name": "",
"env": [],
"x": 500,
"y": 600,
"wires": [["1903fd7b.0d45a3"]],
"info": "This node uses your autorization token, or Bearer your desired language (de and en are supported) to give you the availible actions of one specific devices in it's current status as describes in https://www.miele.com/developer/swagger-ui/index.html#/.\nAll parameters can be set using the incoming message.\nmsg.bearer, msg.lang, basically it's msg.[variable_name]..."
}, {
"id": "bf22df68.b3972",
"type": "subflow:1d4d5eda.0ea591",
"z": "8c044ad3.6aa2e8",
"name": "",
"env": [],
"x": 500,
"y": 660,
"wires": [["4686037.45bf3fc"]]
}
]
@christopher-lambe
Copy link

christopher-lambe commented Jan 30, 2022

Hi Florian,

Thanks for the fast response. Just solved it with your tip about the country/language.
Using one that does not exist like en-UK will produce a "no vg given" error in the Bearer node.
en-GB, en-IE, de-DE, en-US all produce a {"message":"username/password is invalid"}

However it appears to be essential to remember which country you chose in the miele app/login.
de-CH works fine for me.

Cheers,
Chris

(EDIT: fixed the typo in your name)

@selfmade01
Copy link

selfmade01 commented Dec 12, 2023

Hi Florian,
I have the same problems as @christopher-lambe
I get
"{"message":"username/password is invalid"}"
at the first flow when I want to get an access token.
When I access Home Assistant everything works. This shows that my login information is ok.

I also have under vg=de-DE
but it doesn't bring any success either.

@FlorianDessloch
Copy link
Author

Hi @selfmade01,
I'm not sure, but this might be a problem with a limit to the interval you can use the bearer to refresh itself.
I switched over to using the refresh token a while ago, but I haven't uploaded that flow yet.
Maybe I'll get around to this later today.

@FlorianDessloch
Copy link
Author

FlorianDessloch commented Dec 13, 2023

Hi @selfmade01 ,
is has to be DE-de to work,
at least thats what I use ;-)

@selfmade01
Copy link

@FlorianDessloch
thank you a lot, i will try it , at evening

@selfmade01
Copy link

selfmade01 commented Dec 13, 2023

@FlorianDessloch
sorry, DE-de not help

nr-2

@FlorianDessloch
Copy link
Author

@selfmade01 I delete your first pic, because you forgot to delete the user and password from the debug bar.
Actually that helped a little. your username is supposed to be your e-mail, maybe that's the problem.

@selfmade01
Copy link

selfmade01 commented Dec 13, 2023

@FlorianDessloch oooohh Thanks a lot. Thank you for delete the pics.. but if i not post this misstake maybe i never find this problem...
now run my first step in that miele node
Thank you for help

was the Username... need my mail-adress

What means the Bearer Value? what i have to fill out there

@FlorianDessloch
Copy link
Author

@selfmade01 The bearer is part of your authentication towards miele., You only use your username and so on to get the bearer, all other functions can be called using the bearer, it's basically your api-key.
My flows store it to a variable in the global context and use it, when needed.
It's a bit hard to explain this way, so if you want more info let me know and maybe we can have a teams meeting or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment