Kühlschrank zahlt seine Stromkosten selbst

PoC für die Erstellung einer StromQuittung auf Basis der Geräteerkennung eines Discovergy Zählers

[{"id":"efc8953adadafa1e","type":"tab","label":"Geräteerkennung zu StromQuittung","disabled":false,"info":"Die Geräteerkennung eines Discovergy Zählers nutzen als Basis von automatisch erstellten Stromquittung(en)."},{"id":"4343353fdd086e8a","type":"inject","z":"efc8953adadafa1e","name":"","props":[{"p":"payload.to","v":"","vt":"date"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":60,"wires":[["a674fbfb58b100aa"]]},{"id":"a674fbfb58b100aa","type":"disaggregation","z":"efc8953adadafa1e","name":"","meterid":"67df30f2256d49a7b6bb6531aa726f5f","credentials":{},"x":300,"y":60,"wires":[["5448d17afe2a78ee"]]},{"id":"a65044de0b2459ed","type":"change","z":"efc8953adadafa1e","name":"","rules":[{"t":"set","p":"payload.tx_energy","pt":"msg","to":"payload.kwh","tot":"msg"},{"t":"set","p":"payload.tx_duration","pt":"msg","to":"payload.minutes","tot":"msg"},{"t":"set","p":"payload.tx_number","pt":"msg","to":"payload.activityId","tot":"msg"},{"t":"set","p":"payload.tx_meter","pt":"msg","to":"payload.deviceName","tot":"msg"},{"t":"set","p":"payload.seller_name","pt":"msg","to":"Mein Stromkunde","tot":"str"},{"t":"set","p":"payload.seller_email","pt":"msg","to":"[email protected]","tot":"str"},{"t":"set","p":"payload.buyer_name","pt":"msg","to":"Kühlschrankhersteller AG","tot":"str"},{"t":"set","p":"payload.seller_zipcode","pt":"msg","to":"69256","tot":"str"},{"t":"set","p":"payload.seller_yrconsumption","pt":"msg","to":"3600","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":60,"wires":[["05de295461af6677"]]},{"id":"cf4a98d73232411e","type":"switch","z":"efc8953adadafa1e","name":"","property":"payload.deviceName","propertyType":"msg","rules":[{"t":"eq","v":"REFRIGERATOR-3","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":610,"y":60,"wires":[["a65044de0b2459ed"],[]]},{"id":"5448d17afe2a78ee","type":"split","z":"efc8953adadafa1e","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":470,"y":60,"wires":[["cf4a98d73232411e"]]},{"id":"8a0c25a15365ef4d","type":"Stromquittung","z":"efc8953adadafa1e","name":"","x":520,"y":160,"wires":[["9f93a61d6b9f9c77"]]},{"id":"9f93a61d6b9f9c77","type":"function","z":"efc8953adadafa1e","name":"","func":"let list = flow.get(\"quittungen\");\n\nif((typeof list == 'undefined')||(list == null)) {\n    list = [];\n}\nlist.push({\n  pdf:'https://api.corrently.io/v2.0/quittung/pdf?token='+msg.payload,\n  html:'https://corrently.de/service/quittung.html?token='+msg.payload,\n  json:'https://api.corrently.io/v2.0/signature/retrieve?sign='+msg.payload,\n  id:msg.payload\n});\n\nflow.set(\"quittungen\",list);\n\nmsg.payload = {\n    sign:msg.payload\n}\n    \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":160,"y":280,"wires":[["87d2c4cd6913eda0"]]},{"id":"05de295461af6677","type":"delay","z":"efc8953adadafa1e","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"x":1000,"y":60,"wires":[["8a0c25a15365ef4d"]]},{"id":"87d2c4cd6913eda0","type":"http request","z":"efc8953adadafa1e","name":"","method":"GET","ret":"obj","paytoqs":"query","url":"https://api.corrently.io/v2.0/signature/retrieve","tls":"","persist":false,"proxy":"","authType":"","x":330,"y":280,"wires":[["1511c9ea6b23ab6a"]]},{"id":"1511c9ea6b23ab6a","type":"json","z":"efc8953adadafa1e","name":"","property":"payload","action":"","pretty":true,"x":510,"y":280,"wires":[["9486d1f741bd3d8e"]]},{"id":"9486d1f741bd3d8e","type":"function","z":"efc8953adadafa1e","name":"","func":"let list = flow.get(\"quittungen\");\n\nif((typeof list == 'undefined')||(list == null)) {\n    list = [];\n}\nif(typeof msg.payload.output !== 'undefined') {\n    list[list.length-1].sum = msg.payload.output.sum;\n    list[list.length-1].tse = msg.payload.tse;\n    flow.set(\"quittungen\",list);\n}\nmsg.payload = {\n    items:list,\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":280,"wires":[["b82fd06876bd6f88"]]},{"id":"b82fd06876bd6f88","type":"ui_template","z":"efc8953adadafa1e","group":"9d8b709cfb4b3994","name":"","order":1,"width":"0","height":"0","format":"<table class=\"table\">\n<tr ng-repeat = \"payload in msg.payload.items\">\n    <td>{{payload.tse.tse.data.end}}</td>\n    <td>{{payload.sum.toFixed(2)}}</td>\n    <td><a href=\"{{payload.html}}\" target=\"_blank\">{{payload.tse.account}}</a></td>\n</tr>\n</table>\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":860,"y":280,"wires":[[]]},{"id":"1677a8fc1988030d","type":"inject","z":"efc8953adadafa1e","name":"","props":[{"p":"payload.to","v":"","vt":"date"},{"p":"topic","vt":"str"},{"p":"payload.from","v":"1627152146299","vt":"num"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":510,"y":360,"wires":[["9486d1f741bd3d8e"]]},{"id":"9d8b709cfb4b3994","type":"ui_group","name":"Standard","tab":"07bc3c8e5b23fb4a","order":1,"disp":true,"width":12,"collapse":false},{"id":"07bc3c8e5b23fb4a","type":"ui_tab","name":"Kühlschrank Rechnung","icon":"dashboard","disabled":false,"hidden":false}]

Flow Info

Created 2 months ago
Rating: not yet rated

Owner

Node Types

Core
  • change (x1)
  • delay (x1)
  • function (x2)
  • http request (x1)
  • inject (x2)
  • json (x1)
  • split (x1)
  • switch (x1)
  • tab (x1)
Other

Tags

  • discovergy
  • smart-meter
  • nilm
  • stromquittung
  • corrently
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option