Advertisement
FlyHigh-Swe

Spotpris med laddning v3

Sep 27th, 2022
994
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 51.46 KB | None | 0 0
  1. [{"id":"971b52f2d1c15479","type":"tab","label":"Solceller","disabled":false,"info":"","env":[]},{"id":"ca753e9ff605f6f8","type":"junction","z":"971b52f2d1c15479","x":860,"y":1020,"wires":[["d493de4d140c1161"]]},{"id":"78f8d4d513043f9a","type":"junction","z":"971b52f2d1c15479","x":1340,"y":1980,"wires":[["9d651844321ff77c"]]},{"id":"4b29778830e11fbd","type":"junction","z":"971b52f2d1c15479","x":300,"y":2940,"wires":[["e8b41b1b.7c5f08","8345138f2428c4dd","de0c601d.40743"]]},{"id":"9c8cbdcf88833b70","type":"poll-state","z":"971b52f2d1c15479","name":"","server":"a0ae687a.b44378","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"5","updateIntervalType":"num","updateIntervalUnits":"seconds","outputinitially":true,"outputonchanged":true,"entity_id":"sensor.battery_level","state_type":"str","halt_if":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"x":140,"y":80,"wires":[["d10d639d9b606827"]]},{"id":"d10d639d9b606827","type":"function","z":"971b52f2d1c15479","name":"","func":"msg.payload= Math.round(msg.payload * 9.6 * 10 ) / 1000;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":80,"wires":[["fd3863bb47b7e159","677ea3b69a4c1f8f"]]},{"id":"fd3863bb47b7e159","type":"debug","z":"971b52f2d1c15479","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":570,"y":40,"wires":[]},{"id":"677ea3b69a4c1f8f","type":"ha-entity","z":"971b52f2d1c15479","name":"","server":"a0ae687a.b44378","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"Batteri kWh"},{"property":"device_class","value":"power"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"kWh"},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"payload","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"","outputPayloadType":"str","x":570,"y":80,"wires":[[]]},{"id":"9be45ddf139b1e5c","type":"comment","z":"971b52f2d1c15479","name":"Batteri % till kWh","info":"","x":100,"y":20,"wires":[]},{"id":"cdc4388ee465542a","type":"moment","z":"971b52f2d1c15479","name":"","topic":"","input":"timestamp","inputType":"flow","inTz":"ETC/UTC","adjAmount":"3","adjType":"hours","adjDir":"add","format":"ISO8601","locale":"se","output":"timestamp3hoffset","outputType":"flow","outTz":"Europe/Stockholm","x":920,"y":260,"wires":[["8b4e03f9c01344b7","7286f9e084390ddd","72bc70ef6e312214"]]},{"id":"fd999cb8ef104429","type":"api-current-state","z":"971b52f2d1c15479","name":"","server":"a0ae687a.b44378","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.date_time_iso","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"timestamp","propertyType":"flow","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":620,"y":260,"wires":[["cdc4388ee465542a","3248a07461d5f8ee"]]},{"id":"8b4e03f9c01344b7","type":"api-current-state","z":"971b52f2d1c15479","name":"","server":"a0ae687a.b44378","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.nordpool_kwh_se3_sek_3_095_025","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":250,"y":400,"wires":[["f0d04eab11cea570"]]},{"id":"7286f9e084390ddd","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"timestamp","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":1160,"y":220,"wires":[["54faf4fecec73f9a"]]},{"id":"72bc70ef6e312214","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"timestamp3hoffset","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":1160,"y":280,"wires":[["53839ac95475814a"]]},{"id":"54faf4fecec73f9a","type":"debug","z":"971b52f2d1c15479","name":"Timestamp","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1330,"y":220,"wires":[]},{"id":"53839ac95475814a","type":"debug","z":"971b52f2d1c15479","name":"offset","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1310,"y":280,"wires":[]},{"id":"d72fd933b169a64c","type":"array-splitter","z":"971b52f2d1c15479","name":"","topic":"","index":"0","x":700,"y":400,"wires":[["3a4b77b747504fa8"]]},{"id":"6255882cb591fd94","type":"switch","z":"971b52f2d1c15479","name":"","property":"payload.start","propertyType":"msg","rules":[{"t":"lte","v":"timestamp3hoffset","vt":"flow"},{"t":"gt","v":"timestamp3hoffset","vt":"flow"}],"checkall":"true","repair":false,"outputs":2,"x":70,"y":520,"wires":[["40dedd95908bb9b1","ae55993b4485ce35","9142a962fb5a8998"],["6f9b4de24e875ca1","9142a962fb5a8998"]]},{"id":"2d0eb479d48af309","type":"debug","z":"971b52f2d1c15479","name":"Tidgare","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1020,"y":400,"wires":[]},{"id":"986a2d5e6b7e37ee","type":"debug","z":"971b52f2d1c15479","name":"NU!","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1110,"y":460,"wires":[]},{"id":"40dedd95908bb9b1","type":"debug","z":"971b52f2d1c15479","name":"Inom 3h","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":300,"y":500,"wires":[]},{"id":"ae55993b4485ce35","type":"counter","z":"971b52f2d1c15479","name":"","init":"0","step":"1","lower":null,"upper":null,"mode":"increment","outputs":"1","x":420,"y":540,"wires":[["b4c306e15154fccb"]]},{"id":"9142a962fb5a8998","type":"counter","z":"971b52f2d1c15479","name":"","init":"0","step":"1","lower":null,"upper":"6","mode":"increment","outputs":1,"x":420,"y":760,"wires":[["a2c266226a13f4f9"]]},{"id":"6f9b4de24e875ca1","type":"debug","z":"971b52f2d1c15479","name":"Senare","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":180,"y":720,"wires":[]},{"id":"e62ca1f30a4cb95b","type":"link in","z":"971b52f2d1c15479","name":"link in 2","links":["35a7b1f91952b4f1"],"x":285,"y":620,"wires":[["ae55993b4485ce35","9142a962fb5a8998"]]},{"id":"b4c306e15154fccb","type":"switch","z":"971b52f2d1c15479","name":"","property":"count","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"},{"t":"eq","v":"4","vt":"num"}],"checkall":"true","repair":false,"outputs":4,"x":590,"y":540,"wires":[["bd199ff172691fb4"],["0c26370ba2192add"],["b4dcc3901ae4a589"],["2792e6737138d05b"]]},{"id":"a2c266226a13f4f9","type":"switch","z":"971b52f2d1c15479","name":"","property":"countUpperLimitReached","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":570,"y":760,"wires":[["addd8bb692498de1"],["b58e511e3303f129","3a5f89a676c1283d","c9b336077c65a8c6","b62a5e099b2977b4","fbe7769bb9a72570"]]},{"id":"af3329e89b922d63","type":"debug","z":"971b52f2d1c15479","name":"ratio nästa timme","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1370,"y":480,"wires":[]},{"id":"79c5f0885e03e1be","type":"debug","z":"971b52f2d1c15479","name":"2 timmar","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1120,"y":560,"wires":[]},{"id":"3c999ed6305bc248","type":"debug","z":"971b52f2d1c15479","name":"3 timmar","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1120,"y":620,"wires":[]},{"id":"b58e511e3303f129","type":"debug","z":"971b52f2d1c15479","name":"debug 14","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":820,"y":680,"wires":[]},{"id":"3a5f89a676c1283d","type":"smooth","z":"971b52f2d1c15479","name":"","property":"payload.value","action":"min","count":"5","round":"","mult":"single","reduce":true,"x":820,"y":760,"wires":[["860de94b08ae44e8"]]},{"id":"c9b336077c65a8c6","type":"smooth","z":"971b52f2d1c15479","name":"","property":"payload.value","action":"mean","count":"5","round":"","mult":"single","reduce":true,"x":820,"y":800,"wires":[["165a3b8b056a4efe"]]},{"id":"b62a5e099b2977b4","type":"counter","z":"971b52f2d1c15479","name":"","init":"0","step":"1","lower":null,"upper":null,"mode":"increment","outputs":"1","x":820,"y":840,"wires":[["a69812c5f5da9781"]]},{"id":"fbe7769bb9a72570","type":"join","z":"971b52f2d1c15479","name":"","mode":"custom","build":"array","property":"payload.value","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"10","count":"6","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":810,"y":720,"wires":[["dd2b9460d6eee15b"]]},{"id":"860de94b08ae44e8","type":"debug","z":"971b52f2d1c15479","name":"Min 6h","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":990,"y":760,"wires":[]},{"id":"165a3b8b056a4efe","type":"debug","z":"971b52f2d1c15479","name":"mean 6h","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1000,"y":800,"wires":[]},{"id":"a69812c5f5da9781","type":"debug","z":"971b52f2d1c15479","name":"count","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":990,"y":840,"wires":[]},{"id":"dd2b9460d6eee15b","type":"calculator","z":"971b52f2d1c15479","name":"","inputMsgField":"payload.value","outputMsgField":"payload","operation":"sorta","constant":"","round":false,"decimals":0,"x":1020,"y":720,"wires":[["ba46a76639208446","9033dd5d7a647073"]]},{"id":"ba46a76639208446","type":"debug","z":"971b52f2d1c15479","name":"debug 15","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1200,"y":780,"wires":[]},{"id":"9033dd5d7a647073","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"kwh_price_6h_acs","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1260,"y":720,"wires":[["b4b036b2b0b1b174","a687c807ac6d60f6"]]},{"id":"b4b036b2b0b1b174","type":"function","z":"971b52f2d1c15479","name":"function 1","func":"\nmsg.payload = (1.10 * msg.payload[0] );\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1500,"y":720,"wires":[["89349077f5a6080e","111c971832ba8a81"]]},{"id":"a687c807ac6d60f6","type":"debug","z":"971b52f2d1c15479","name":"Price 6h","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1500,"y":780,"wires":[]},{"id":"89349077f5a6080e","type":"debug","z":"971b52f2d1c15479","name":"Min price 6h with addon","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1730,"y":660,"wires":[]},{"id":"111c971832ba8a81","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"kwh_price_6h_min_add_offset","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1760,"y":720,"wires":[["f972c4d13350d9ab"]]},{"id":"3c07f3af16d90d05","type":"comment","z":"971b52f2d1c15479","name":"Nordpools spotpriser inkl statistik","info":"","x":150,"y":160,"wires":[]},{"id":"0e3923c9a4a53cbf","type":"poll-state","z":"971b52f2d1c15479","name":"","server":"a0ae687a.b44378","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"20","updateIntervalType":"num","updateIntervalUnits":"seconds","outputinitially":true,"outputonchanged":true,"entity_id":"sensor.battery_level","state_type":"str","halt_if":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"x":140,"y":1020,"wires":[["f4fc2293d9da10a0"]]},{"id":"f4fc2293d9da10a0","type":"switch","z":"971b52f2d1c15479","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"80","vt":"num"},{"t":"btwn","v":"50","vt":"num","v2":"80","v2t":"num"},{"t":"lte","v":"50","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":430,"y":1020,"wires":[["42ec336c8c26d021"],["d3161ca52545e446"],["c928e53f44fa0fb8"]]},{"id":"42ec336c8c26d021","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"pv_battery_hours_to_load","pt":"global","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":980,"wires":[["ca753e9ff605f6f8"]]},{"id":"d3161ca52545e446","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"pv_battery_hours_to_load","pt":"global","to":"2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":1020,"wires":[["ca753e9ff605f6f8"]]},{"id":"c928e53f44fa0fb8","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"pv_battery_hours_to_load","pt":"global","to":"3","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":1060,"wires":[["ca753e9ff605f6f8"]]},{"id":"c5e35463139d6db8","type":"debug","z":"971b52f2d1c15479","name":"Timmar för laddning","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1180,"y":1020,"wires":[]},{"id":"d493de4d140c1161","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"pv_battery_hours_to_load","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":1020,"wires":[["c5e35463139d6db8"]]},{"id":"33af36ad7ae77976","type":"poll-state","z":"971b52f2d1c15479","name":"","server":"a0ae687a.b44378","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"4","updateIntervalType":"num","updateIntervalUnits":"hours","outputinitially":true,"outputonchanged":true,"entity_id":"sensor.nordpool_kwh_se3_sek_3_095_025","state_type":"str","halt_if":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"x":220,"y":1220,"wires":[["7fb2314aa65b88f4"]]},{"id":"7fb2314aa65b88f4","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"move","p":"data.attributes.tomorrow_valid","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":1220,"wires":[["a98b858e848c269e"]]},{"id":"a98b858e848c269e","type":"switch","z":"971b52f2d1c15479","name":"","property":"payload","propertyType":"msg","rules":[{"t":"false"},{"t":"true"}],"checkall":"true","repair":false,"outputs":2,"x":890,"y":1220,"wires":[["3b92d303af7f92f1","a306c9d82dc39e38"],["9beb677ba661976b"]]},{"id":"3b92d303af7f92f1","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"kwh_tomorrow_updated","pt":"global","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1140,"y":1200,"wires":[[]]},{"id":"a157f4a9ab23fb19","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"kwh_tomorrow_updated","pt":"global","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1040,"y":1360,"wires":[[]]},{"id":"9beb677ba661976b","type":"switch","z":"971b52f2d1c15479","name":"","property":"kwh_tomorrow_updated","propertyType":"global","rules":[{"t":"true"},{"t":"false"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":750,"y":1300,"wires":[["804b0a2f76fb8e34"],["baaaef61dffb3c88","a157f4a9ab23fb19"],["a157f4a9ab23fb19","3b91690c40b8318a"]]},{"id":"804b0a2f76fb8e34","type":"debug","z":"971b52f2d1c15479","name":"Redan uppdaterad","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":990,"y":1280,"wires":[]},{"id":"baaaef61dffb3c88","type":"debug","z":"971b52f2d1c15479","name":"Uppdatera","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":970,"y":1320,"wires":[]},{"id":"a306c9d82dc39e38","type":"debug","z":"971b52f2d1c15479","name":"Inte tillgänglig","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1080,"y":1160,"wires":[]},{"id":"3c5aa58ae6eb63be","type":"inject","z":"971b52f2d1c15479","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":1300,"wires":[["96db8ef86292f922"]]},{"id":"96db8ef86292f922","type":"api-current-state","z":"971b52f2d1c15479","name":"","server":"a0ae687a.b44378","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.nordpool_kwh_se3_sek_3_095_025","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":410,"y":1300,"wires":[["7fb2314aa65b88f4"]]},{"id":"3b91690c40b8318a","type":"debug","z":"971b52f2d1c15479","name":"Okänd","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":950,"y":1400,"wires":[]},{"id":"a915914fbc77bcfb","type":"poll-state","z":"971b52f2d1c15479","name":"","server":"a0ae687a.b44378","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"30","updateIntervalType":"num","updateIntervalUnits":"minutes","outputinitially":true,"outputonchanged":true,"entity_id":"input_boolean.pv_force_charge","state_type":"str","halt_if":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"x":160,"y":2300,"wires":[["a57855c4149c1d02"]]},{"id":"a57855c4149c1d02","type":"switch","z":"971b52f2d1c15479","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":430,"y":2300,"wires":[["1b748eaf2c52513d"],["e7b2443b7325cf5c"]]},{"id":"726e719060d19a08","type":"modbus-write","z":"971b52f2d1c15479","name":"battery","showStatusActivities":true,"showErrors":true,"unitid":"1","dataType":"HoldingRegister","adr":"13050","quantity":"1","server":"500c1428d7c545a3","emptyMsgOnFail":true,"keepMsgProperties":false,"x":770,"y":2260,"wires":[["1ee54a32d6a7c688"],["9b76383124786a05"]]},{"id":"42d220096ac11f84","type":"modbus-write","z":"971b52f2d1c15479","name":"battery","showStatusActivities":true,"showErrors":true,"unitid":"1","dataType":"HoldingRegister","adr":"13050","quantity":"1","server":"500c1428d7c545a3","emptyMsgOnFail":false,"keepMsgProperties":false,"x":770,"y":2440,"wires":[["620c273ab35d1372"],["2fa8f6782fa5fdd5"]]},{"id":"515b8330b72ae43f","type":"modbus-write","z":"971b52f2d1c15479","name":"battery","showStatusActivities":true,"showErrors":true,"unitid":"1","dataType":"HoldingRegister","adr":"13049","quantity":"1","server":"500c1428d7c545a3","emptyMsgOnFail":false,"keepMsgProperties":false,"x":1310,"y":2260,"wires":[[],["bf4e738feb21bf81"]]},{"id":"a9b85a17e5509097","type":"modbus-write","z":"971b52f2d1c15479","name":"battery","showStatusActivities":true,"showErrors":true,"unitid":"1","dataType":"HoldingRegister","adr":"13049","quantity":"1","server":"500c1428d7c545a3","emptyMsgOnFail":false,"keepMsgProperties":false,"x":1310,"y":2440,"wires":[[],["4d9179f5781736d1"]]},{"id":"1b748eaf2c52513d","type":"change","z":"971b52f2d1c15479","name":"Charge","rules":[{"t":"set","p":"payload","pt":"msg","to":"170","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":2260,"wires":[["726e719060d19a08"]]},{"id":"e7b2443b7325cf5c","type":"change","z":"971b52f2d1c15479","name":"Battery normal","rules":[{"t":"set","p":"payload","pt":"msg","to":"204","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":2440,"wires":[["42d220096ac11f84"]]},{"id":"1ee54a32d6a7c688","type":"change","z":"971b52f2d1c15479","name":"EMS forced","rules":[{"t":"set","p":"payload","pt":"msg","to":"2","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":2260,"wires":[["515b8330b72ae43f"]]},{"id":"620c273ab35d1372","type":"change","z":"971b52f2d1c15479","name":"EMS normal","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":2440,"wires":[["a9b85a17e5509097"]]},{"id":"324097f4ed751f6e","type":"api-current-state","z":"971b52f2d1c15479","name":"","server":"a0ae687a.b44378","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.nordpool_kwh_se3_sek_3_095_025","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":670,"y":1560,"wires":[["dbd60b59ab29fdb1","9398d996fd8aebde"]]},{"id":"e7b1afb296de25c8","type":"switch","z":"971b52f2d1c15479","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"kwh_price_6h_acs[1]","vt":"global"},{"t":"eq","v":"payload_low6h","vt":"msg"},{"t":"btwn","v":"payload_low6h","vt":"msg","v2":"payload_5h_min_add_offset","v2t":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":4,"x":110,"y":1960,"wires":[["c435fcb4c94fe9d2"],["64d312986e8e1d39","5402d27629bffd94"],["e411176482fb5c7f","b7aaac110dd9517c"],["398772f2da4b07af"]]},{"id":"8d12e476d4eb4b87","type":"api-call-service","z":"971b52f2d1c15479","name":"","server":"a0ae687a.b44378","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.pv_force_charge"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1160,"y":1920,"wires":[["78f8d4d513043f9a"]]},{"id":"49e0558304190825","type":"api-call-service","z":"971b52f2d1c15479","name":"","server":"a0ae687a.b44378","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.pv_force_charge"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1080,"y":2140,"wires":[["78f8d4d513043f9a"]]},{"id":"64d312986e8e1d39","type":"debug","z":"971b52f2d1c15479","name":"Minsta närmsta 5h","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":450,"y":1980,"wires":[]},{"id":"e411176482fb5c7f","type":"debug","z":"971b52f2d1c15479","name":"Inom x procent fråm minsta","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":480,"y":2100,"wires":[]},{"id":"e39428c470ba6f84","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"payload_low6h","pt":"msg","to":"kwh_price_6h_acs[0]","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":1740,"wires":[["ae5384cfd5849107","60064d2ef1100213"]]},{"id":"ae5384cfd5849107","type":"debug","z":"971b52f2d1c15479","name":"payload_low6h","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload_low6h","targetType":"msg","statusVal":"","statusType":"auto","x":440,"y":1840,"wires":[]},{"id":"49dc963e9fc59d86","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"payload_6h_min_add_offset","pt":"msg","to":"kwh_price_6h_min_add_offset","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":190,"y":1740,"wires":[["9e9c52a3af7f1f76","e39428c470ba6f84"]]},{"id":"9e9c52a3af7f1f76","type":"debug","z":"971b52f2d1c15479","name":"payload_5h_min_add_offset","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload_6h_min_add_offset","targetType":"msg","statusVal":"","statusType":"auto","x":180,"y":1840,"wires":[]},{"id":"dbd60b59ab29fdb1","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"payload_average","pt":"msg","to":"data.attributes.average","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":1620,"wires":[["5653891c4ffb85b9"]]},{"id":"5653891c4ffb85b9","type":"function","z":"971b52f2d1c15479","name":"function 2","func":"\nmsg.payload_Average_per_removed = (0.75 * msg.data.attributes.average );\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1000,"y":1620,"wires":[["49dc963e9fc59d86","24a21681fa647367"]]},{"id":"258c31e6808789e7","type":"switch","z":"971b52f2d1c15479","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"msg.payload_Average_per_removed","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":790,"y":2000,"wires":[["8d12e476d4eb4b87"],["28c93f02f86959ed"]]},{"id":"24a21681fa647367","type":"debug","z":"971b52f2d1c15479","name":"payload_Average_per_removed","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload_Average_per_removed","targetType":"msg","statusVal":"","statusType":"auto","x":1130,"y":1560,"wires":[]},{"id":"ddbb13aaf2a67450","type":"comment","z":"971b52f2d1c15479","name":"Batteri ungefärlig tid för laddning","info":"","x":150,"y":920,"wires":[]},{"id":"df8b20e6df5875b5","type":"comment","z":"971b52f2d1c15479","name":"Noordpool morgondagens priser tillgängliga","info":"","x":190,"y":1160,"wires":[]},{"id":"bd199ff172691fb4","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"price_kwh_this_hour","pt":"global","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":890,"y":460,"wires":[["986a2d5e6b7e37ee"]]},{"id":"0c26370ba2192add","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"price_kwh_next_hour","pt":"global","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":890,"y":520,"wires":[["274b7e0974269dbc"]]},{"id":"b4dcc3901ae4a589","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"price_kwh_2_hours","pt":"global","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":890,"y":560,"wires":[["79c5f0885e03e1be"]]},{"id":"2792e6737138d05b","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"price_kwh_3_hours","pt":"global","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":890,"y":620,"wires":[["3c999ed6305bc248"]]},{"id":"274b7e0974269dbc","type":"function","z":"971b52f2d1c15479","name":"function 3","func":"debugger\nvar nexth = global.get('price_kwh_next_hour');\nvar thish = global.get('price_kwh_this_hour');\nmsg.thish = thish;\nmsg.nexth = nexth ;\nmsg.payload = (nexth / thish );\n//(100 / income * outgoing);//or what ever kind of formula you want\n//Math.round(100/Number(context.ylekastmine)*(Number(context.spoon)));\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1120,"y":520,"wires":[["9b1bf35c4dcd0860","af3329e89b922d63","706a174a53fd094a","ec444d505349990b"]]},{"id":"9b1bf35c4dcd0860","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"price_kwh_ratio_this_next_hour","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1440,"y":520,"wires":[[]]},{"id":"726a1448df192d47","type":"switch","z":"971b52f2d1c15479","name":"","property":"price_kwh_ratio_this_next_hour","propertyType":"msg","rules":[{"t":"gt","v":"2","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":870,"y":1820,"wires":[["8ab5e60455e538ac","f13c08c48a2fd3bf"],["e7b1afb296de25c8"]]},{"id":"8ab5e60455e538ac","type":"debug","z":"971b52f2d1c15479","name":"Mycket högre pris nästa timme","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1130,"y":1800,"wires":[]},{"id":"b2617d8c1d9e9ada","type":"server-state-changed","z":"971b52f2d1c15479","name":"","server":"a0ae687a.b44378","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.nordpool_kwh_se3_sek_3_095_025","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"30","forType":"num","forUnits":"seconds","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":230,"y":1620,"wires":[["2a5723c0ea82f3e1"]]},{"id":"0d57350f4ed4b838","type":"cronplus","z":"971b52f2d1c15479","name":"","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"schedule1","topic":"schedule1","payloadType":"default","payload":"","expressionType":"cron","expression":"15 0/15 * * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":100,"y":1560,"wires":[["fd87c0dc9de4a347"]]},{"id":"f0d04eab11cea570","type":"function","z":"971b52f2d1c15479","name":"function 5","func":"var arr1 = msg.data.attributes.raw_today;\nvar arr2 = msg.data.attributes.raw_tomorrow;\n\nmsg.arr1 = arr1\nmsg.arr2 = arr2\nmsg.payload= arr1.concat(arr2);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":400,"wires":[["d72fd933b169a64c"]]},{"id":"3a4b77b747504fa8","type":"switch","z":"971b52f2d1c15479","name":"","property":"payload.end","propertyType":"msg","rules":[{"t":"lt","v":"timestamp","vt":"flow"},{"t":"gte","v":"timestamp","vt":"flow"}],"checkall":"true","repair":false,"outputs":2,"x":850,"y":400,"wires":[["2d0eb479d48af309"],["6255882cb591fd94"]]},{"id":"64be3ae8b2dfc79e","type":"comment","z":"971b52f2d1c15479","name":"Evaluera priser","info":"","x":100,"y":1460,"wires":[]},{"id":"e92fc1654a3610dc","type":"comment","z":"971b52f2d1c15479","name":"Starta / Stoppa tvångsladdning","info":"","x":150,"y":2180,"wires":[]},{"id":"52d89616a599ea4b","type":"file","z":"971b52f2d1c15479","name":"","filename":"/config/www/node_red/forcechargingdebug.txt","filenameType":"str","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":2100,"y":1980,"wires":[[]]},{"id":"edc5274073dbb558","type":"function","z":"971b52f2d1c15479","name":"function 6","func":"msg.payload = \"tid: \" + msg.time2 + \" - Trigger: \" + msg.reason + \" - Eval res:\" + msg.eval + \" - Nu: \" + msg.payload + \" - Medel: \" + msg.payload_average + \" - 6h sort (min): \" + msg.payload_low6h + \" - Min+10%: \" + msg.payload_6h_min_add_offset + \" - Halva snittet: \" + msg.payload_Average_per_removed + \" - Ratio: \" + msg.price_kwh_ratio_this_next_hour;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1820,"y":2080,"wires":[["52d89616a599ea4b"]]},{"id":"fd87c0dc9de4a347","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"reason","pt":"msg","to":"cron","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":1560,"wires":[["324097f4ed751f6e"]]},{"id":"2a5723c0ea82f3e1","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"reason","pt":"msg","to":"state change","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":1620,"wires":[["dbd60b59ab29fdb1"]]},{"id":"9398d996fd8aebde","type":"debug","z":"971b52f2d1c15479","name":"debug 19","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":980,"y":1500,"wires":[]},{"id":"13a65507418129be","type":"moment","z":"971b52f2d1c15479","name":"","topic":"","input":"time","inputType":"msg","inTz":"ETC/UTC","adjAmount":"0","adjType":"hours","adjDir":"add","format":"HH:mm:ss","locale":"SE","output":"time2","outputType":"msg","outTz":"Europe/Stockholm","x":1580,"y":2040,"wires":[["edc5274073dbb558","0f5b26ef68a3735f"]]},{"id":"5402d27629bffd94","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"eval","pt":"msg","to":"Lägsta","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":2020,"wires":[["258c31e6808789e7"]]},{"id":"b7aaac110dd9517c","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"eval","pt":"msg","to":"inom 10%","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":2060,"wires":[["258c31e6808789e7"]]},{"id":"398772f2da4b07af","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"eval","pt":"msg","to":"För högt","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":2140,"wires":[["49e0558304190825"]]},{"id":"d785f1701d08e845","type":"link out","z":"971b52f2d1c15479","name":"kWh calc ready","mode":"link","links":["ce5a01b84f2d5b52"],"x":585,"y":660,"wires":[]},{"id":"ce5a01b84f2d5b52","type":"link in","z":"971b52f2d1c15479","name":"link in 3","links":["d785f1701d08e845"],"x":35,"y":1500,"wires":[["7636392da3cbb111"]]},{"id":"589e73fd94211807","type":"poll-state","z":"971b52f2d1c15479","name":"","server":"a0ae687a.b44378","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"4","updateIntervalType":"num","updateIntervalUnits":"hours","outputinitially":true,"outputonchanged":true,"entity_id":"sensor.nordpool_kwh_se3_sek_3_095_025","state_type":"str","halt_if":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"x":220,"y":200,"wires":[["4cfa5dd0b8376d80"]]},{"id":"7068ba49ed11c229","type":"cronplus","z":"971b52f2d1c15479","name":"","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"schedule1","topic":"schedule1","payloadType":"default","payload":"","expressionType":"cron","expression":"15  2 * * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":100,"y":260,"wires":[["2c576c8ac319a016"]]},{"id":"0f5b26ef68a3735f","type":"debug","z":"971b52f2d1c15479","name":"debug 20","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"time2","targetType":"msg","statusVal":"","statusType":"auto","x":1860,"y":1880,"wires":[]},{"id":"6b5b37e5a90bae09","type":"debug","z":"971b52f2d1c15479","name":"debug 21","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"time","targetType":"msg","statusVal":"","statusType":"auto","x":1840,"y":1820,"wires":[]},{"id":"9d651844321ff77c","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"time","pt":"msg","to":"$now()","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1470,"y":1940,"wires":[["6b5b37e5a90bae09","13a65507418129be"]]},{"id":"fe767c988ba20f93","type":"debug","z":"971b52f2d1c15479","name":"debug 22","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":620,"y":620,"wires":[]},{"id":"addd8bb692498de1","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"last_price","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":700,"wires":[["14855ded3c621689"]]},{"id":"4cfa5dd0b8376d80","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"reason","pt":"flow","to":"state change price","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":200,"wires":[["fd999cb8ef104429"]]},{"id":"2c576c8ac319a016","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"reason","pt":"flow","to":"cron price","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":260,"wires":[["fd999cb8ef104429"]]},{"id":"2bdbebf1d4320a52","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"reason","pt":"msg","to":"reason","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":1500,"wires":[["324097f4ed751f6e"]]},{"id":"14855ded3c621689","type":"debouncer","z":"971b52f2d1c15479","name":"","maxTopics":"1","interval":"5000","x":470,"y":660,"wires":[["d785f1701d08e845","fe767c988ba20f93"]]},{"id":"abd680e1da46a37f","type":"inject","z":"971b52f2d1c15479","d":true,"name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"900","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":320,"wires":[["207e7093ea47c03a"]]},{"id":"207e7093ea47c03a","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"reason","pt":"flow","to":"inject price","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":320,"wires":[["fd999cb8ef104429"]]},{"id":"c435fcb4c94fe9d2","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"eval","pt":"msg","to":"Näst Lägsta","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":1940,"wires":[["310d6be9f5dad012"]]},{"id":"310d6be9f5dad012","type":"switch","z":"971b52f2d1c15479","name":"","property":"pv_battery_hours_to_load","propertyType":"global","rules":[{"t":"gte","v":"2","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":590,"y":1940,"wires":[["258c31e6808789e7"],["3fa97675b5ac4e96"]]},{"id":"3fa97675b5ac4e96","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"eval","pt":"msg","to":"näst lägsta men batt","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":2100,"wires":[["49e0558304190825"]]},{"id":"7636392da3cbb111","type":"delay","z":"971b52f2d1c15479","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":160,"y":1500,"wires":[["2bdbebf1d4320a52"]]},{"id":"f972c4d13350d9ab","type":"api-current-state","z":"971b52f2d1c15479","name":"","server":"a0ae687a.b44378","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.date_time_iso","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"timestamp","propertyType":"flow","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":2140,"y":740,"wires":[[]]},{"id":"f13c08c48a2fd3bf","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"eval","pt":"msg","to":"Mycket högre nästa timme","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1070,"y":1840,"wires":[["8d12e476d4eb4b87"]]},{"id":"60064d2ef1100213","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"price_kwh_ratio_this_next_hour","pt":"msg","to":"price_kwh_ratio_this_next_hour","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":1740,"wires":[["726a1448df192d47"]]},{"id":"706a174a53fd094a","type":"debug","z":"971b52f2d1c15479","name":"debug 25","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1400,"y":580,"wires":[]},{"id":"ec444d505349990b","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"time","pt":"msg","to":"$now()","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1450,"y":340,"wires":[["cd5c1a34b7371a74"]]},{"id":"cd5c1a34b7371a74","type":"moment","z":"971b52f2d1c15479","name":"","topic":"","input":"time","inputType":"msg","inTz":"ETC/UTC","adjAmount":"0","adjType":"hours","adjDir":"add","format":"HH:mm:ss","locale":"SE","output":"time2","outputType":"msg","outTz":"Europe/Stockholm","x":1560,"y":440,"wires":[["82d2edf6d64addf6"]]},{"id":"82d2edf6d64addf6","type":"function","z":"971b52f2d1c15479","name":"function 7","func":"msg.payload = \"tid: \" + msg.time2 + \" - Trigger: \" + msg.reason + \" - This:\" + msg.thish + \" - next: \" + msg.nexth + \" - Ratio: \" + msg.payload;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1800,"y":480,"wires":[["53246857f7442e49"]]},{"id":"53246857f7442e49","type":"file","z":"971b52f2d1c15479","name":"","filename":"/config/www/node_red/forcechargingdebugratio.txt","filenameType":"str","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":2090,"y":380,"wires":[[]]},{"id":"35a7b1f91952b4f1","type":"link out","z":"971b52f2d1c15479","name":"Reset counters kWh price","mode":"link","links":["c606179d2bcc38e0","e62ca1f30a4cb95b"],"x":985,"y":200,"wires":[]},{"id":"3248a07461d5f8ee","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":200,"wires":[["35a7b1f91952b4f1"]]},{"id":"28c93f02f86959ed","type":"change","z":"971b52f2d1c15479","name":"","rules":[{"t":"set","p":"eval","pt":"msg","to":"lågt men över medel","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":2040,"wires":[["49e0558304190825"]]},{"id":"43ee6ada.9b5b64","type":"modbus-flex-connector","z":"971b52f2d1c15479","name":"","maxReconnectsPerMinute":4,"emptyQueue":false,"showStatusActivities":true,"showErrors":true,"server":"500c1428d7c545a3","x":870,"y":3060,"wires":[["661243cf.f9ac0c","867ba9edf0cc699e"]]},{"id":"181e491d.3c6377","type":"inject","z":"971b52f2d1c15479","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":"5","topic":"","payload":"{}","payloadType":"json","x":410,"y":3020,"wires":[["2d395433.b4833c"]]},{"id":"661243cf.f9ac0c","type":"debug","z":"971b52f2d1c15479","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1130,"y":3060,"wires":[]},{"id":"f481a786.fb3df8","type":"change","z":"971b52f2d1c15479","name":"HOST : 192.168.20.2","rules":[{"t":"set","p":"payload.tcpHost","pt":"msg","to":"192.168.86.147","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":3060,"wires":[["43ee6ada.9b5b64"]],"info":"test"},{"id":"2d395433.b4833c","type":"change","z":"971b52f2d1c15479","name":"connectorType : tcp","rules":[{"t":"set","p":"payload.connectorType","pt":"msg","to":"TCP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":3020,"wires":[["f481a786.fb3df8"]],"info":"test"},{"id":"e8b41b1b.7c5f08","type":"debug","z":"971b52f2d1c15479","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":550,"y":2880,"wires":[]},{"id":"e43e2b4a.6b6fd8","type":"trigger","z":"971b52f2d1c15479","name":"","op1":"","op2":"{}","op1type":"nul","op2type":"json","duration":"1","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":800,"y":2960,"wires":[["2d395433.b4833c"]]},{"id":"de0c601d.40743","type":"delay","z":"971b52f2d1c15479","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"19","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":580,"y":2960,"wires":[["e43e2b4a.6b6fd8"]]},{"id":"8345138f2428c4dd","type":"api-call-service","z":"971b52f2d1c15479","name":"","server":"a0ae687a.b44378","version":5,"debugenabled":true,"domain":"notify","service":"mobile_app_sm_s908b","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"Försöker återställa.\",\"title\":\"Solcellsbatteri\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":900,"y":2900,"wires":[[]]},{"id":"c466da861fbfb60c","type":"link call","z":"971b52f2d1c15479","name":"","links":["181c8598da7d18d3"],"linkType":"static","timeout":"60","x":860,"y":2320,"wires":[["1b748eaf2c52513d"]]},{"id":"181c8598da7d18d3","type":"link in","z":"971b52f2d1c15479","name":"Modbus reset","links":[],"x":165,"y":2940,"wires":[["4b29778830e11fbd"]]},{"id":"867ba9edf0cc699e","type":"delay","z":"971b52f2d1c15479","name":"","pauseType":"delay","timeout":"40","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1080,"y":3000,"wires":[["ddd970597510d366"]]},{"id":"ddd970597510d366","type":"link out","z":"971b52f2d1c15479","name":"link out 1","mode":"return","links":[],"x":1245,"y":3000,"wires":[]},{"id":"196a9e08b440d241","type":"link call","z":"971b52f2d1c15479","name":"","links":["181c8598da7d18d3"],"linkType":"static","timeout":"60","x":1320,"y":2340,"wires":[["1ee54a32d6a7c688"]]},{"id":"8da1aacecd94f9dc","type":"link call","z":"971b52f2d1c15479","name":"","links":["181c8598da7d18d3"],"linkType":"static","timeout":"60","x":900,"y":2500,"wires":[["e7b2443b7325cf5c"]]},{"id":"1fbb57a8a02e8ac3","type":"link call","z":"971b52f2d1c15479","name":"","links":["181c8598da7d18d3"],"linkType":"static","timeout":"60","x":1360,"y":2520,"wires":[["620c273ab35d1372"]]},{"id":"9b76383124786a05","type":"switch","z":"971b52f2d1c15479","name":"","property":"error","propertyType":"msg","rules":[{"t":"nempty"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":730,"y":2360,"wires":[["c466da861fbfb60c"],["1ee54a32d6a7c688"]]},{"id":"bf4e738feb21bf81","type":"switch","z":"971b52f2d1c15479","name":"","property":"error","propertyType":"msg","rules":[{"t":"nempty"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1110,"y":2340,"wires":[["196a9e08b440d241"],[]]},{"id":"4d9179f5781736d1","type":"switch","z":"971b52f2d1c15479","name":"","property":"error","propertyType":"msg","rules":[{"t":"nempty"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1150,"y":2520,"wires":[["1fbb57a8a02e8ac3"],[]]},{"id":"2fa8f6782fa5fdd5","type":"switch","z":"971b52f2d1c15479","name":"","property":"error","propertyType":"msg","rules":[{"t":"nempty"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":710,"y":2520,"wires":[["8da1aacecd94f9dc"],["620c273ab35d1372"]]},{"id":"9047fa7beaaac090","type":"change","z":"971b52f2d1c15479","name":"disCharge","rules":[{"t":"set","p":"payload","pt":"msg","to":"187","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":2620,"wires":[["e8bb801e2f7c6c6a"]]},{"id":"e8bb801e2f7c6c6a","type":"modbus-write","z":"971b52f2d1c15479","name":"battery","showStatusActivities":true,"showErrors":true,"unitid":"1","dataType":"HoldingRegister","adr":"13050","quantity":"1","server":"500c1428d7c545a3","emptyMsgOnFail":true,"keepMsgProperties":false,"x":670,"y":2620,"wires":[["69bd48954e03f1ed"],["14f320b19fabab89"]]},{"id":"14f320b19fabab89","type":"switch","z":"971b52f2d1c15479","name":"","property":"error","propertyType":"msg","rules":[{"t":"nempty"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":630,"y":2720,"wires":[["4dc9deefe6b65b50"],["69bd48954e03f1ed"]]},{"id":"4dc9deefe6b65b50","type":"link call","z":"971b52f2d1c15479","name":"","links":["181c8598da7d18d3"],"linkType":"static","timeout":"60","x":800,"y":2700,"wires":[["9047fa7beaaac090"]]},{"id":"cffb613747888bc5","type":"switch","z":"971b52f2d1c15479","name":"","property":"error","propertyType":"msg","rules":[{"t":"nempty"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1010,"y":2700,"wires":[["418c41e6a1fb90c7"],[]]},{"id":"69bd48954e03f1ed","type":"change","z":"971b52f2d1c15479","name":"EMS forced","rules":[{"t":"set","p":"payload","pt":"msg","to":"2","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1030,"y":2620,"wires":[["7f3bcecdb404587c"]]},{"id":"7f3bcecdb404587c","type":"modbus-write","z":"971b52f2d1c15479","name":"battery","showStatusActivities":true,"showErrors":true,"unitid":"1","dataType":"HoldingRegister","adr":"13049","quantity":"1","server":"500c1428d7c545a3","emptyMsgOnFail":false,"keepMsgProperties":false,"x":1210,"y":2620,"wires":[[],["cffb613747888bc5"]]},{"id":"418c41e6a1fb90c7","type":"link call","z":"971b52f2d1c15479","name":"","links":["181c8598da7d18d3"],"linkType":"static","timeout":"60","x":1220,"y":2700,"wires":[["69bd48954e03f1ed"]]},{"id":"bc8720dc95d662c9","type":"switch","z":"971b52f2d1c15479","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":430,"y":2540,"wires":[["9047fa7beaaac090"],["e7b2443b7325cf5c"]]},{"id":"5a688721f089451f","type":"poll-state","z":"971b52f2d1c15479","name":"","server":"a0ae687a.b44378","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"30","updateIntervalType":"num","updateIntervalUnits":"minutes","outputinitially":true,"outputonchanged":true,"entity_id":"input_boolean.pv_force_discharge","state_type":"str","halt_if":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"x":170,"y":2540,"wires":[["bc8720dc95d662c9"]]},{"id":"a0ae687a.b44378","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"},{"id":"500c1428d7c545a3","type":"modbus-client","name":"","clienttype":"tcp","bufferCommands":false,"stateLogEnabled":false,"queueLogEnabled":false,"failureLogEnabled":false,"tcpHost":"192.168.86.147","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"0x3A","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":false}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement