Proscenic m7 Pro vacuum cleaner in NodeRED
I needed to incorporate my Proscenic m7 pro vacuum cleaner into my NodeRED automations, but sadly I found no "out of the box" way of doing it. And the reason for that - Proscenic doesn't provide any publicly available API. Thankfully some people found ways to take control of basic vacuum's functionality by reverse engineering API and this entire flow is based on those findings.
https://github.com/Fluepke/proscenic
https://community.jeedom.com/t/proscenichome-api-reverse-engineering-for-m7-pro/27461
Simply add your login credentials into "Set Auth Data" node and you'll be able to instruct your vacuum robot to start cleaning or go back to recharge. If you find any way of improving this flow, please let me know!
[{"id":"56268459.a95bbc","type":"tab","label":"Proscenic M7 Pro","disabled":false,"info":""},{"id":"4b263c73.d20af4","type":"inject","z":"56268459.a95bbc","name":"","props":[{"p":"payload"},{"p":"func","v":"clean","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":320,"wires":[["efa1ebcc.eb5e68"]]},{"id":"67eb6a55.e67214","type":"http request","z":"56268459.a95bbc","name":"Request Cleaning Start","method":"POST","ret":"obj","paytoqs":"body","url":"","tls":"","persist":false,"proxy":"","authType":"","x":1750,"y":360,"wires":[[]]},{"id":"95c4cda.642a83","type":"function","z":"56268459.a95bbc","name":"Set Parameters","func":"msg.url = \"https://mobile.proscenic.com.de/instructions/cmd21005/\"+msg.proscenic_data.sn+\"?cleanMode=sweepOnly&username=\"+msg.auth.user;\nmsg.headers = {};\nmsg.headers['token'] = msg.payload.data.token;\nmsg.headers['Content-Type'] = 'application/json;charset=UTF-8';\nmsg.headers['Host'] = 'mobile.proscenic.com.de';\nmsg.headers['Connection'] = 'Keep-Alive';\nmsg.headers['Accept-Encoding'] = 'gzip';\nmsg.headers['User-Agent'] = 'okhttp/3.10.0';\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1540,"y":360,"wires":[["67eb6a55.e67214"]]},{"id":"3bddd198.3a1c1e","type":"comment","z":"56268459.a95bbc","name":"Start Cleaning","info":"","x":130,"y":260,"wires":[]},{"id":"1fd45003.cea3a","type":"inject","z":"56268459.a95bbc","name":"","props":[{"p":"payload"},{"p":"func","v":"dock","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":540,"wires":[["efa1ebcc.eb5e68"]]},{"id":"8b9b6bcc.4d7808","type":"comment","z":"56268459.a95bbc","name":"Go Back To Dock","info":"","x":120,"y":480,"wires":[]},{"id":"5afa1836.f0a0b8","type":"http request","z":"56268459.a95bbc","name":"Request Docking","method":"POST","ret":"obj","paytoqs":"body","url":"","tls":"","persist":false,"proxy":"","authType":"","x":1770,"y":480,"wires":[[]]},{"id":"5b4b12d7.4802cc","type":"function","z":"56268459.a95bbc","name":"Set Parameters","func":"msg.url = \"https://mobile.proscenic.com.de/instructions/\"+msg.proscenic_data.sn+\"/21012\";\nmsg.payload = \"username=\"+msg.auth.user+\"&charge=start\";\nmsg.headers = {};\nmsg.headers['Content-Type'] = 'application/x-www-form-urlencoded';\nmsg.headers['Host'] = 'mobile.proscenic.com.de';\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1560,"y":480,"wires":[["5afa1836.f0a0b8"]]},{"id":"27ea687d.66ba98","type":"comment","z":"56268459.a95bbc","name":"https://github.com/Fluepke/proscenic","info":"","x":200,"y":80,"wires":[]},{"id":"5093f915.556028","type":"comment","z":"56268459.a95bbc","name":"https://community.jeedom.com/t/proscenichome-api-reverse-engineering-for-m7-pro/27461","info":"","x":370,"y":120,"wires":[]},{"id":"e026c24e.797c8","type":"http request","z":"56268459.a95bbc","name":"Request Token","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://mobile.proscenic.com.de/user/login","tls":"","persist":false,"proxy":"","authType":"","x":1360,"y":360,"wires":[["95c4cda.642a83"]]},{"id":"93bdc8c5.d27dc8","type":"function","z":"56268459.a95bbc","name":"Set Parameters","func":"if (typeof msg.url !== 'undefined') {\n delete msg.url;\n}\n\nmsg.payload = {\n \"state\":\"欧洲\",\n \"countryCode\":\"49\",\n \"appVer\":\"1.7.8\",\n \"type\":\"2\",\n \"os\":\"IOS\",\n \"password\":msg.auth.pwd_hash,\n \"language\":\"EN\",\n \"username\":msg.auth.user,\n \"pwd\":msg.auth.pwd\n};\nmsg.headers = {};\nmsg.headers['Content-Type'] = 'application/json';\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1180,"y":360,"wires":[["e026c24e.797c8"]]},{"id":"315bde86.507fe2","type":"md5","z":"56268459.a95bbc","name":"Create Password Hash","fieldToHash":"auth.pwd","fieldTypeToHash":"msg","hashField":"auth.pwd_hash","hashFieldType":"msg","x":970,"y":360,"wires":[["93bdc8c5.d27dc8"]]},{"id":"28a7730c.481a4c","type":"comment","z":"56268459.a95bbc","name":"Resources:","info":"","x":130,"y":40,"wires":[]},{"id":"efa1ebcc.eb5e68","type":"function","z":"56268459.a95bbc","name":"Set Auth Data","func":"msg.auth = {};\nmsg.auth.user=\"\"; // your email address\nmsg.auth.pwd=\"\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":360,"y":420,"wires":[["b12e62a4.4f61"]]},{"id":"bd6943cd.d43a4","type":"http request","z":"56268459.a95bbc","name":"Request Device Data","method":"POST","ret":"obj","paytoqs":"body","url":"","tls":"","persist":false,"proxy":"","authType":"","x":1040,"y":480,"wires":[["31d90bd.8b561f4"]]},{"id":"e033c43f.ccdeb8","type":"function","z":"56268459.a95bbc","name":"Set Parameters","func":"msg.url = \"https://mobile.proscenic.com.de/user/getEquips/\"+msg.auth.user;\nmsg.payload = \"username=\"+msg.auth.user;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":840,"y":480,"wires":[["bd6943cd.d43a4"]]},{"id":"31d90bd.8b561f4","type":"function","z":"56268459.a95bbc","name":"Save Device Data","func":"flow.set(\"proscenicData\", msg.payload.data.content[0]);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1250,"y":480,"wires":[["996bd257.17872"]]},{"id":"b12e62a4.4f61","type":"switch","z":"56268459.a95bbc","name":"Do we have a serial number?","property":"proscenicData","propertyType":"flow","rules":[{"t":"nnull"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":580,"y":420,"wires":[["996bd257.17872"],["e033c43f.ccdeb8"]]},{"id":"996bd257.17872","type":"function","z":"56268459.a95bbc","name":"Read Device Data","func":"msg.proscenic_data = flow.get(\"proscenicData\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1493,"y":415,"wires":[["e597d3d6.f6371"]]},{"id":"e597d3d6.f6371","type":"switch","z":"56268459.a95bbc","name":"","property":"func","propertyType":"msg","rules":[{"t":"eq","v":"clean","vt":"str"},{"t":"eq","v":"dock","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1663,"y":415,"wires":[["315bde86.507fe2"],["5b4b12d7.4802cc"]]}]