Re: how to add APSystems ECU-3 solar inverter monitor
Posted: Sunday 13 September 2020 20:59
As I was struggling with the same issue for my ECU-R i've made a NodeRed flow which grabs the latest power update and sends it to Domoticz. I'm still hoping someone is albe to make a direct connection using Zigbee, unfortunately I don't have the skills myself.
This is the flow you can import in NodeRed. You need to make a dummy device in Domoticz and you will need the ID of your ECU-R.
This is the flow you can import in NodeRed. You need to make a dummy device in Domoticz and you will need the ID of your ECU-R.
Code: Select all
[{"id":"cee8863.bf63f78","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"42dfa7e5.ca71c","type":"function","z":"cee8863.bf63f78","name":"ToDomoticz","func":"var t_last_update = context.get('t_last_update') || \"00:00:00\";\nif (msg.payload.time != t_last_update) {\n context.set('t_last_update', msg.payload.time);\n \n msg.payload = {\n \"idx\" : 1140, //your domoticz idx here\n \"nvalue\" : 0,\n \"svalue\" : msg.payload.power\n } \n return msg;\n}\nelse {\n return null;\n}\n","outputs":1,"noerr":0,"x":470,"y":160,"wires":[["5f3e0b2e.3d22bc","c318bb7c.1af38"]]},{"id":"ca14cd66.da7b38","type":"inject","z":"cee8863.bf63f78","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":120,"wires":[["d6496cf4.41791"]]},{"id":"5f3e0b2e.3d22bc","type":"debug","z":"cee8863.bf63f78","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":140,"wires":[]},{"id":"fcee29cb.ad2698","type":"http request","z":"cee8863.bf63f78","name":"","method":"POST","ret":"obj","paytoqs":false,"url":"http://api.apsystemsema.com:8073/apsema/v1/ecu/getPowerInfo","tls":"","persist":false,"proxy":"","authType":"","x":110,"y":320,"wires":[["ef465640.e1d738"]]},{"id":"2fb9f417.93002c","type":"function","z":"cee8863.bf63f78","name":"Create POST msg","func":"msg.payload = {\n 'ecuId': xxxxxxxxxxxx, //your 12 digit ecuID here\n 'filter': 'power',\n 'date': msg.payload\n};\nmsg.headers = \n{\n 'Content-Type': 'application/x-www-form-urlencoded',\n }\nreturn msg;","outputs":1,"noerr":0,"x":130,"y":240,"wires":[["fcee29cb.ad2698"]]},{"id":"ef465640.e1d738","type":"change","z":"cee8863.bf63f78","name":"","rules":[{"t":"set","p":"payload.power","pt":"msg","to":"payload.data.power","tot":"msg"},{"t":"set","p":"payload.time","pt":"msg","to":"payload.data.time","tot":"msg"},{"t":"delete","p":"payload.code","pt":"msg"},{"t":"delete","p":"payload.data","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":140,"y":400,"wires":[["d4389253.c45d9"]]},{"id":"d4389253.c45d9","type":"string","z":"cee8863.bf63f78","name":"Power","methods":[{"name":"getRightMost","params":[{"type":"str","value":","}]},{"name":"delRightMost","params":[{"type":"str","value":"]"}]},{"name":"delLeftMost","params":[{"type":"str","value":"\""}]},{"name":"delRightMost","params":[{"type":"str","value":"\""}]}],"prop":"payload.power","propout":"payload.power","object":"msg","objectout":"msg","x":310,"y":400,"wires":[["7ecbae6.bb16cd"]]},{"id":"c318bb7c.1af38","type":"mqtt out","z":"cee8863.bf63f78","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"8faae1ae.a63ee","x":700,"y":220,"wires":[]},{"id":"d6496cf4.41791","type":"moment","z":"cee8863.bf63f78","name":"","topic":"","input":"","inputType":"msg","inTz":"Europe/Amsterdam","adjAmount":"2","adjType":"hours","adjDir":"add","format":"YYYYMMDD","locale":"en_GB","output":"","outputType":"msg","outTz":"Europe/Amsterdam","x":180,"y":160,"wires":[["2fb9f417.93002c"]]},{"id":"c9af0214.5f10f","type":"change","z":"cee8863.bf63f78","name":"Date2Num","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(msg.payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":190,"y":200,"wires":[[]]},{"id":"7ecbae6.bb16cd","type":"string","z":"cee8863.bf63f78","name":"Time","methods":[{"name":"getRightMost","params":[{"type":"str","value":","}]},{"name":"delRightMost","params":[{"type":"str","value":"]"}]},{"name":"delLeftMost","params":[{"type":"str","value":"\""}]},{"name":"delRightMost","params":[{"type":"str","value":"\""}]}],"prop":"payload.time","propout":"payload.time","object":"msg","objectout":"msg","x":450,"y":400,"wires":[["42dfa7e5.ca71c"]]},{"id":"443628e9.fdea08","type":"comment","z":"cee8863.bf63f78","name":"","info":"In Domoticz, add a dummy device (Electric (instant+counter)) and remember the device idx\n\nAdd your ECU ID in \"Create POST msg\" function\nAdd your domoticz dummy idx in \"ToDomoticz\" function\n\nset the timestamp to auto inject and repeat every 5 minutes","x":340,"y":80,"wires":[]},{"id":"8faae1ae.a63ee","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""}]