I recently switched from Domoticz to Homeassistant. In Domoticz I used the Mindergas.nl upload flow. With a minor tweak I made it work with Homeassistant.
-
-
Save limwakra/30858cb01f9b887caa31c94e93f3090b to your computer and use it in GitHub Desktop.
Mindergas upload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"id":"dda103a9942f2359","type":"tab","label":"Mindergas upload","disabled":false,"info":""},{"id":"9936460f87e8f48c","type":"http request","z":"dda103a9942f2359","name":"Mindergas.nl","method":"POST","ret":"txt","paytoqs":"ignore","url":"https://www.mindergas.nl/api/meter_readings","tls":"","persist":false,"proxy":"","authType":"","credentials":{},"x":950,"y":180,"wires":[[]]},{"id":"98655b1332156525","type":"function","z":"dda103a9942f2359","name":"Set values","func":"var debug = true;\nvar token = \"xxxxxxxxxxxxxxxx\";\nvar newmsg = {};\nvar yesterday = new Date(new Date().setDate(new Date().getDate()-1));\nvar day = (\"0\" + yesterday.getDate()).slice(-2);\nvar month = (\"0\" + (yesterday.getMonth() + 1)).slice(-2);\nvar senddate = yesterday.getFullYear() + \"-\" + (month) + \"-\" + (day);\n\nif (debug || ((yesterday.getMinutes() < 10) && (yesterday.getHours() == 0))) {\t\t\t\n\tnewmsg.headers = { \"Content-Type\":\"application/json\" };\n\tnewmsg.headers[\"AUTH-TOKEN\"] = token;\n\t\n\tnewmsg.payload = {};\n newmsg.payload.date = senddate;\n newmsg.payload.reading = msg.payload;\n\treturn newmsg;\n}\n \n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":710,"y":180,"wires":[["9936460f87e8f48c"]]},{"id":"afde4b5d41c96b18","type":"json","z":"dda103a9942f2359","name":"","property":"payload","action":"","pretty":false,"x":530,"y":180,"wires":[["98655b1332156525"]]},{"id":"d41d998eed4f1afb","type":"comment","z":"dda103a9942f2359","name":"Instructions","info":"Create an account at mindergas.nl and lookup the token. \nIn \"Gasmeter\" select your gasmeter entity.\nPut your own token in function \"Set values\" at line 2.\nYou can only send 1 value a day. If more you get a error message returned.\n","x":130,"y":100,"wires":[]},{"id":"ded1402dfdccf5dc","type":"inject","z":"dda103a9942f2359","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"59 23 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":180,"wires":[["4c247ad5156dce96"]]},{"id":"4c247ad5156dce96","type":"api-current-state","z":"dda103a9942f2359","name":"Gasmeter","server":"c4e336ac.6ae518","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.p1_meter_total_gas","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":340,"y":180,"wires":[["afde4b5d41c96b18"]]},{"id":"c4e336ac.6ae518","type":"server","name":"Home Assistant","version":1,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment