Guest User

Consumption price

a guest
Oct 28th, 2021
32
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [{"id":"a9a85f202fc752c3","type":"tab","label":"Test Flow","disabled":false,"info":""},{"id":"da91b523524f7060","type":"api-current-state","z":"a9a85f202fc752c3","name":"Washing machine consumtion kWh","server":"2bb542db.1de8ee","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.vaskemaskin_consumed_kwh","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"x":400,"y":260,"wires":[["41a5409570391e33"]]},{"id":"596c68c4ccbe280a","type":"join","z":"a9a85f202fc752c3","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":510,"y":180,"wires":[["af9e028674e58faa"]]},{"id":"af9e028674e58faa","type":"function","z":"a9a85f202fc752c3","name":"Multiply","func":"msg.payload = msg.payload[1] * msg.payload[0] ;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":140,"wires":[["bd9387fb8d7c91a9"]]},{"id":"38f6a0666568f4f5","type":"api-current-state","z":"a9a85f202fc752c3","name":"Electricity price kWh","server":"2bb542db.1de8ee","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.strompris_kwh","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"x":360,"y":140,"wires":[["596c68c4ccbe280a"]]},{"id":"d94406888b2326c8","type":"inject","z":"a9a85f202fc752c3","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":170,"y":200,"wires":[["38f6a0666568f4f5","da91b523524f7060"]]},{"id":"9a7252ccd1bf314e","type":"ha-entity","z":"a9a85f202fc752c3","name":"Price","server":"2bb542db.1de8ee","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":""},{"property":"device_class","value":""},{"property":"icon","value":"mdi:cash-100"},{"property":"unit_of_measurement","value":"kr"}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"","outputPayloadType":"str","x":810,"y":220,"wires":[[]]},{"id":"bd9387fb8d7c91a9","type":"calculator","z":"a9a85f202fc752c3","name":"Rounding","inputMsgField":"payload","outputMsgField":"payload","operation":"rdec","constant":"2","round":false,"decimals":"0","x":680,"y":220,"wires":[["9a7252ccd1bf314e"]]},{"id":"c9e2244fe6c9165a","type":"comment","z":"a9a85f202fc752c3","name":"Washing machine Consumption","info":"","x":230,"y":80,"wires":[]},{"id":"eef55b04ef16644a","type":"api-current-state","z":"a9a85f202fc752c3","name":"Toster Consumption kWh","server":"2bb542db.1de8ee","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.toster_consumed_kwh","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"x":370,"y":640,"wires":[["40c4350e3d81c736"]]},{"id":"73bf25af09a069b7","type":"join","z":"a9a85f202fc752c3","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":550,"y":580,"wires":[["c1e42d4a085a586f"]]},{"id":"c1e42d4a085a586f","type":"function","z":"a9a85f202fc752c3","name":"Multiply","func":"msg.payload = msg.payload[1] * msg.payload[0] ;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":700,"y":520,"wires":[["f765812eaa95bc1c"]]},{"id":"621ab8efc6da3159","type":"api-current-state","z":"a9a85f202fc752c3","name":"Electricity price kWh","server":"2bb542db.1de8ee","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.strompris_kwh","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"x":360,"y":540,"wires":[["73bf25af09a069b7"]]},{"id":"686c101164a90f6c","type":"inject","z":"a9a85f202fc752c3","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":170,"y":600,"wires":[["eef55b04ef16644a","621ab8efc6da3159"]]},{"id":"d8fc6139009e4b05","type":"ha-entity","z":"a9a85f202fc752c3","name":"Price","server":"2bb542db.1de8ee","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":""},{"property":"device_class","value":""},{"property":"icon","value":"mdi:cash-100"},{"property":"unit_of_measurement","value":"kr"}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"","outputPayloadType":"str","x":870,"y":620,"wires":[[]]},{"id":"f765812eaa95bc1c","type":"calculator","z":"a9a85f202fc752c3","name":"Rounding","inputMsgField":"payload","outputMsgField":"payload","operation":"rdec","constant":"2","round":false,"decimals":"0","x":720,"y":620,"wires":[["d8fc6139009e4b05"]]},{"id":"349f0a14fa62fd0a","type":"comment","z":"a9a85f202fc752c3","name":"Toster Consumption","info":"","x":190,"y":500,"wires":[]},{"id":"36e4db34987e50a9","type":"inject","z":"a9a85f202fc752c3","name":"reset database","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"59 23 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"reset","payloadType":"str","x":180,"y":320,"wires":[["081972686f2ef3f4"]]},{"id":"081972686f2ef3f4","type":"change","z":"a9a85f202fc752c3","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":320,"wires":[["41a5409570391e33"]]},{"id":"41a5409570391e33","type":"counter","z":"a9a85f202fc752c3","name":"","init":0,"step":1,"lower":null,"upper":null,"mode":"increment","outputs":1,"x":480,"y":320,"wires":[["7eb6ebd1a8a3cd2a","b5a639e63c6f190e"]]},{"id":"b5a639e63c6f190e","type":"function","z":"a9a85f202fc752c3","name":"get count on reset","func":"// Grab the last saved total count:\nmsg.ycount = flow.get(\"ycount\")||0;\n// If the count just reset, display the old total:\nif (msg.reset === 0) return msg;\n// otherwise just update the new saved value,\nelse {\n flow.set(\"ycount\", msg.payload);\n // and end the program:\n return null;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":690,"y":320,"wires":[["885e50f1f421556f","596c68c4ccbe280a"]]},{"id":"885e50f1f421556f","type":"debug","z":"a9a85f202fc752c3","name":"yesterdays total count","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"ycount","targetType":"msg","statusVal":"ycount","statusType":"auto","x":760,"y":380,"wires":[]},{"id":"7eb6ebd1a8a3cd2a","type":"debug","z":"a9a85f202fc752c3","name":"todays count","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":510,"y":380,"wires":[]},{"id":"deb9fe74295059d4","type":"debug","z":"a9a85f202fc752c3","name":"todays count","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":530,"y":800,"wires":[]},{"id":"ddf9008eae7e204d","type":"debug","z":"a9a85f202fc752c3","name":"yesterdays total count","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"ycount","targetType":"msg","statusVal":"ycount","statusType":"auto","x":780,"y":800,"wires":[]},{"id":"bd5340f16f7b0045","type":"function","z":"a9a85f202fc752c3","name":"get count on reset","func":"// Grab the last saved total count:\nmsg.ycount = flow.get(\"ycount\")||0;\n// If the count just reset, display the old total:\nif (msg.reset === 0) return msg;\n// otherwise just update the new saved value,\nelse {\n flow.set(\"ycount\", msg.payload);\n // and end the program:\n return null;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":670,"y":740,"wires":[["ddf9008eae7e204d","73bf25af09a069b7"]]},{"id":"40c4350e3d81c736","type":"counter","z":"a9a85f202fc752c3","name":"","init":0,"step":1,"lower":null,"upper":null,"mode":"increment","outputs":1,"x":460,"y":740,"wires":[["deb9fe74295059d4","bd5340f16f7b0045"]]},{"id":"de160af2ceab2157","type":"change","z":"a9a85f202fc752c3","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":740,"wires":[["40c4350e3d81c736"]]},{"id":"e68d8b29f1739e36","type":"inject","z":"a9a85f202fc752c3","name":"reset database","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"59 23 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"reset","payloadType":"str","x":160,"y":740,"wires":[["de160af2ceab2157"]]},{"id":"2bb542db.1de8ee","type":"server","name":"Home Assistant sony","version":1,"legacy":true,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
RAW Paste Data