Read data from Cozytouch (thermor) API
This flow allows to connect to cozytouch API and read data of your equipment
(tested with a Thermor aeromax domestic water heater)
In the 'request token' function, update your cozytouch credentials (email + password for cozytouch android app)
var mylogin = "your_email;
var mypassword = "your_password";
Click on "token" inject node to get your token and read data.
Last line of the flow shall provide a large json where you may find data your are looking for.
example for my water heater, I find water temperature in
msg.payload.devices[2].states[21].value
Thanks to https://github.com/OBone-git/Cozytouch-domoticz which was a great source to understand how to build the various http requests.
[{"id":"f1425cb3d4ad340c","type":"function","z":"60a6047d05860b07","name":"request token","func":"var mylogin = \"youremail\";\nvar mypassword = \"yourpassword\";\n\nvar msg2 = {};\nmsg2.url = \"https://apis.groupe-atlantic.com/token\"\nmsg2.payload = {};\nmsg2.payload = {\n 'grant_type' : 'password',\n 'username' : 'GA-PRIVATEPERSON/' + mylogin,\n 'password' : mypassword\n};\nmsg2.headers = {};\nmsg2.headers['Authorization'] = \"Basic Q3RfMUpWeVRtSUxYOEllZkE3YVVOQmpGblpVYToyRWNORHpfZHkzNDJVSnFvMlo3cFNKTnZVdjBh\";\nmsg2.headers['Content-Type'] = 'application/x-www-form-urlencoded';\nreturn msg2;\n\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"formData","module":"form-data"},{"var":"querystring","module":"querystring"}],"x":340,"y":60,"wires":[["6e9fea6ecc03070b"]]},{"id":"6e9fea6ecc03070b","type":"http request","z":"60a6047d05860b07","name":"","method":"POST","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":530,"y":60,"wires":[["11c214e1b76cb718","439f02d5642b9f35"]]},{"id":"61b64a235aa2983e","type":"inject","z":"60a6047d05860b07","name":"token","props":[{"p":"payload"}],"repeat":"21600","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":60,"wires":[["f1425cb3d4ad340c"]]},{"id":"11c214e1b76cb718","type":"change","z":"60a6047d05860b07","name":"","rules":[{"t":"set","p":"cozytouch_token","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":60,"wires":[[]]},{"id":"439f02d5642b9f35","type":"function","z":"60a6047d05860b07","name":"req jwt","func":"var token = flow.get(\"cozytouch_token\").access_token;\nvar msg2 = {} ;\nmsg2.url = 'https://apis.groupe-atlantic.com/magellan/accounts/jwt';\nmsg2.headers = {};\nmsg2.headers[\"Authorization\"] = \"Bearer \" + token;\nreturn msg2;\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":220,"wires":[["63ae7505708fbae8"]]},{"id":"749cd4c1759f6c38","type":"inject","z":"60a6047d05860b07","name":"get data","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"600","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":220,"wires":[["439f02d5642b9f35"]]},{"id":"63ae7505708fbae8","type":"http request","z":"60a6047d05860b07","name":"","method":"GET","ret":"txt","paytoqs":"body","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":530,"y":220,"wires":[["0d176ab009b6f296","dfcec6b4b41ef82b","136b0b111727e1b2"]]},{"id":"0d176ab009b6f296","type":"debug","z":"60a6047d05860b07","name":"jwt_debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":830,"y":220,"wires":[]},{"id":"dfcec6b4b41ef82b","type":"function","z":"60a6047d05860b07","name":"login","func":"if (msg.statusCode == 200) {\n var jwt = msg.payload.replace(/\"/g,'');\n var msg2 = {};\n msg2.url = 'https://ha110-1.overkiz.com/enduser-mobile-web/enduserAPI/login';\n msg2.payload = {}; \n msg2.payload = { 'jwt' : jwt }\n msg2.headers = {};\n msg2.headers[\"Content-Type\"] = \"application/x-www-form-urlencoded\";\n return msg2;\n}","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":340,"wires":[["c6ecc6a0d9be7c8e"]]},{"id":"c6ecc6a0d9be7c8e","type":"http request","z":"60a6047d05860b07","name":"","method":"POST","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"other","keyValue":"Content-Type","valueType":"other","valueValue":"application/x-www-form-urlencoded"}],"x":530,"y":340,"wires":[["0486fd31ee2c3459","d090b94d087b1e51","dc3520b6b7c82850"]]},{"id":"0486fd31ee2c3459","type":"debug","z":"60a6047d05860b07","name":"login debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":830,"y":360,"wires":[]},{"id":"56ca436718600df1","type":"http request","z":"60a6047d05860b07","name":"","method":"GET","ret":"obj","paytoqs":"body","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":530,"y":460,"wires":[["1de11084f542a15a","136b0b111727e1b2"]]},{"id":"d090b94d087b1e51","type":"function","z":"60a6047d05860b07","name":"setup","func":"if (msg.payload.success == true) {\n var msg2 = {};\n msg2.headers = {};\n msg2.headers['cache-control'] = \"no-cache\";\n msg2.headers['Host'] = \"ha110-1.overkiz.com\";\n msg2.headers['Connection'] = \"Keep-Alive\";\n msg2.url = \"https://ha110-1.overkiz.com/enduser-mobile-web/enduserAPI/setup\";\n msg2.cookies = msg.responseCookies;\n return msg2;\n}\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":460,"wires":[["56ca436718600df1"]]},{"id":"1de11084f542a15a","type":"debug","z":"60a6047d05860b07","name":"setup_debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":830,"y":460,"wires":[]},{"id":"136b0b111727e1b2","type":"switch","z":"60a6047d05860b07","name":"statusCode != 200","property":"statusCode","propertyType":"msg","rules":[{"t":"neq","v":"200","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":850,"y":280,"wires":[["de44123f40745747"]]},{"id":"de44123f40745747","type":"delay","z":"60a6047d05860b07","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"5","nbRateUnits":"1","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1090,"y":300,"wires":[["f1425cb3d4ad340c"]]},{"id":"dc3520b6b7c82850","type":"switch","z":"60a6047d05860b07","name":"success = false","property":"payload.success","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":840,"y":320,"wires":[["de44123f40745747"]]},{"id":"3aaf8ab3bd199766","type":"junction","z":"60a6047d05860b07","x":520,"y":60,"wires":[[]]}]