OK, so I think this is close to the final result:
[{"id":"effce8e2e8a9f43c","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"62fbd666c7c7b20d","type":"group","z":"effce8e2e8a9f43c","name":"BATTERY INSTRUCTIONS","style":{"label":true},"nodes":["7b45bdf5d2c774a4","d93cd01b0135c571","7a2e734eead34d16","b9ef723c9e5d6e8c","f1579354c1921264"],"x":1728,"y":233,"w":564,"h":714},{"id":"f155037011aa0d79","type":"group","z":"effce8e2e8a9f43c","name":"Write changes!","style":{"label":true},"nodes":["0cc39af6d8b8dc0f","9f84293f8db8abd4","e0414ba507e24b27","3bffd91c351286ee"],"x":2734,"y":459,"w":672,"h":122},{"id":"fbe0abfb3ee0e088","type":"group","z":"effce8e2e8a9f43c","name":"Payload","style":{"label":true},"nodes":["fad803646bcd93ee"],"x":2414,"y":479,"w":292,"h":82},{"id":"7a697ccd23e6b3cb","type":"group","z":"effce8e2e8a9f43c","name":"START CHARGE 1H BEFORE CAR START BASED ON SPOT PRICE - CHEAP HOURS","style":{"label":true,"stroke":"#92d04f","color":"#000000"},"nodes":["1bdbeec9beec4666","7ba45c1373d6db9c","ec6756e96722cebb","ee12a627340871cc"],"x":14,"y":53,"w":1092,"h":148},{"id":"e209b9134d0bb2d2","type":"group","z":"effce8e2e8a9f43c","name":"DISCHARGE ON THE MOST EXPENSIVE HOURS","style":{"label":true,"color":"#000000","stroke":"#ff0000"},"nodes":["adbc3aa9cf52d50f","02b26ef1b0a8b08d","7f4903812faedc8c","d02c29a8f72609bd","c8e0d9aa9ca9caeb","34990cd67c990907","d3317acef2826bb6","1af0741d36ec6e93","f8111ebed4317fd9","fee34c327c9cea95","1aab75cc0f069305","2b9f4c9abc1148dd","de05bf4c517ce32a","7f55b776f0b34a54"],"x":14,"y":639,"w":1092,"h":382},{"id":"0bd67f9e3d7f071c","type":"group","z":"effce8e2e8a9f43c","name":"SCHELUDED CAR CHARGING","style":{"label":true,"color":"#000000","stroke":"#ffC000"},"nodes":["1c8a755bac3130a0","f049899799f7f431","19a007dca869d5ac","2f6678d42b0de023","906228c962c8c1e3","e47b6a6830c96cef"],"x":14,"y":239,"w":852,"h":282},{"id":"72b918efda5f705f","type":"group","z":"effce8e2e8a9f43c","name":"DO SOMETHING WHEN BATTERY IS FULL","style":{"stroke":"#000000","label":true,"color":"#000000"},"nodes":["213549e7b854d62a","b6852c6123b496b0","f27f1ab3f8eb58bf"],"x":1214,"y":19,"w":432,"h":162},{"id":"7ba45c1373d6db9c","type":"group","z":"effce8e2e8a9f43c","g":"7a697ccd23e6b3cb","name":"Check current price/kWh","style":{"label":true},"nodes":["d5351cdc453ee22e","3b6d2b1103a7ee5c"],"x":334,"y":79,"w":472,"h":82},{"id":"7b45bdf5d2c774a4","type":"group","z":"effce8e2e8a9f43c","g":"62fbd666c7c7b20d","name":"NORMAL","style":{"label":true},"nodes":["7a60a2b45d28626d","8c9613cac1965ae9"],"x":1774,"y":419,"w":492,"h":82},{"id":"d93cd01b0135c571","type":"group","z":"effce8e2e8a9f43c","g":"62fbd666c7c7b20d","name":"FORCED CHARGE","style":{"label":true},"nodes":["66d147c4d9a586f8","62364dcb3387db2b","96365e785c02b8ce","21da80d2a0e2aa42"],"x":1774,"y":519,"w":492,"h":142},{"id":"7a2e734eead34d16","type":"group","z":"effce8e2e8a9f43c","g":"62fbd666c7c7b20d","name":"HOLD (No charge or discharge)","style":{"label":true},"nodes":["5d370aec7b2aa1ce","f888ef1ef01b3e83"],"x":1774,"y":679,"w":492,"h":82},{"id":"02b26ef1b0a8b08d","type":"group","z":"effce8e2e8a9f43c","g":"e209b9134d0bb2d2","name":"Check current price/kWh","style":{"label":true},"nodes":["0cc692ab6f439fdf","f032a97315254445"],"x":234,"y":724,"w":432,"h":112},{"id":"b9ef723c9e5d6e8c","type":"group","z":"effce8e2e8a9f43c","g":"62fbd666c7c7b20d","name":"FORCED DISCHARGE","style":{"label":true},"nodes":["f52c691bee1e0932","3fccdd784ca45eca","bc399a85c5ad3281","7b05462e688a5afd"],"x":1774,"y":779,"w":492,"h":142},{"id":"f1579354c1921264","type":"group","z":"effce8e2e8a9f43c","g":"62fbd666c7c7b20d","name":"POWER FROM SUN","style":{"label":true},"nodes":["79428347ba72398e","b77df5e20a3eff97","b30d06bcfe2e62de"],"x":1754,"y":259,"w":512,"h":142},{"id":"fee34c327c9cea95","type":"junction","z":"effce8e2e8a9f43c","g":"e209b9134d0bb2d2","x":1080,"y":720,"wires":[["3fccdd784ca45eca"]]},{"id":"1af0741d36ec6e93","type":"junction","z":"effce8e2e8a9f43c","g":"e209b9134d0bb2d2","x":1080,"y":680,"wires":[["7b05462e688a5afd"]]},{"id":"e47b6a6830c96cef","type":"junction","z":"effce8e2e8a9f43c","g":"0bd67f9e3d7f071c","x":580,"y":440,"wires":[["f888ef1ef01b3e83"]]},{"id":"de05bf4c517ce32a","type":"junction","z":"effce8e2e8a9f43c","g":"e209b9134d0bb2d2","x":1080,"y":800,"wires":[["b77df5e20a3eff97"]]},{"id":"7f55b776f0b34a54","type":"junction","z":"effce8e2e8a9f43c","g":"e209b9134d0bb2d2","x":1080,"y":740,"wires":[["8c9613cac1965ae9"]]},{"id":"d5351cdc453ee22e","type":"api-current-state","z":"effce8e2e8a9f43c","g":"7ba45c1373d6db9c","name":"Spotpris","server":"afa7e6c.89d5e18","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.energi_data_service","state_type":"num","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":420,"y":120,"wires":[["3b6d2b1103a7ee5c"]]},{"id":"3b6d2b1103a7ee5c","type":"switch","z":"effce8e2e8a9f43c","g":"7ba45c1373d6db9c","name":"LESS than $LOWPEAKPRICE","property":"payload","propertyType":"msg","rules":[{"t":"lte","v":"LOWPEAKPRICE","vt":"env"}],"checkall":"true","repair":false,"outputs":1,"x":650,"y":120,"wires":[["ec6756e96722cebb"]]},{"id":"1bdbeec9beec4666","type":"ha-time","z":"effce8e2e8a9f43c","g":"7a697ccd23e6b3cb","name":"TESLA START OFFSET -1H","server":"afa7e6c.89d5e18","version":3,"exposeAsEntityConfig":"","entityId":"sensor.tesla_start_charging_time","property":"","offset":"-3580","offsetType":"num","offsetUnits":"seconds","randomOffset":false,"repeatDaily":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"sunday":true,"monday":true,"tuesday":true,"wednesday":true,"thursday":true,"friday":true,"saturday":true,"x":160,"y":100,"wires":[["d5351cdc453ee22e"]]},{"id":"1c8a755bac3130a0","type":"ha-time","z":"effce8e2e8a9f43c","g":"0bd67f9e3d7f071c","name":"TESLA STOP (NOW)","server":"afa7e6c.89d5e18","version":3,"exposeAsEntityConfig":"","entityId":"sensor.tesla_stop_charging_time","property":"","offset":"0","offsetType":"num","offsetUnits":"hours","randomOffset":false,"repeatDaily":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"sunday":true,"monday":true,"tuesday":true,"wednesday":true,"thursday":true,"friday":true,"saturday":true,"x":140,"y":420,"wires":[["e47b6a6830c96cef"]]},{"id":"7a60a2b45d28626d","type":"function","z":"effce8e2e8a9f43c","g":"7b45bdf5d2c774a4","name":"NORMAL","func":"\nmsg.StorCtl_Mod = \"0\"\nmsg.OutWRte = \"10000\"\nmsg.InWRte = \"10000\"\n\nmsg.newstate = \"normal\"\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":2180,"y":460,"wires":[["fad803646bcd93ee"]],"info":"This puts the battery in normal operation.\nMeaningn that it will both charge and discharge to\nits set limits at 100%,\n"},{"id":"66d147c4d9a586f8","type":"function","z":"effce8e2e8a9f43c","g":"d93cd01b0135c571","name":"4500W CHARGE","func":"msg.StorCtl_Mod = \"2\"\n// 4500W (65536-4500)\nmsg.OutWRte = \"61036\"\n\nmsg.newstate = \"forcecharge4500w\"\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":2150,"y":560,"wires":[["fad803646bcd93ee"]],"info":"Example 1: Only permit energy storage charging\nThis behavior can be achieved by limiting the maximum discharge capacity to 0%\n=> results in window [-3300 W, 0 W]\n- OutWRte = 0% (set discharge limit of WchaMax to 0%)\n- StorCtl_Mod = 2 (activates discharge limit, bit pattern: 10)\n- InWRte is not relevant in this case"},{"id":"5d370aec7b2aa1ce","type":"function","z":"effce8e2e8a9f43c","g":"7a2e734eead34d16","name":"HOLD","func":"msg.StorCtl_Mod = \"3\"\nmsg.OutWRte = \"0\"\nmsg.InWRte = \"0\"\n\nmsg.newstate = \"hold_state\"\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":2190,"y":720,"wires":[["fad803646bcd93ee"]],"info":"Example 3: Do not permit charging or discharging\nThis behavior can be achieved by limiting the maximum charge capacity to 0%\nand the maximum discharge capacity to 0%\n=> results in window [0 W, 0 W]\n- InWRte = 0% (set charge limit of WchaMax to 0%)\n- OutWRte = 0% (set discharge limit of WchaMax to 0%)\n- StorCtl_Mod = 3 (activate both limit values, bit pattern: 11)"},{"id":"0cc39af6d8b8dc0f","type":"modbus-response","z":"effce8e2e8a9f43c","g":"f155037011aa0d79","name":"","registerShowMax":20,"x":3190,"y":540,"wires":[]},{"id":"9f84293f8db8abd4","type":"modbus-flex-write","z":"effce8e2e8a9f43c","g":"f155037011aa0d79","name":"Fronius Storage","showStatusActivities":true,"showErrors":true,"showWarnings":true,"server":"ecd41b68db8d4254","emptyMsgOnFail":true,"keepMsgProperties":true,"delayOnStart":false,"startDelayTime":"10","x":3000,"y":520,"wires":[["0cc39af6d8b8dc0f","e0414ba507e24b27"],[]]},{"id":"e0414ba507e24b27","type":"debug","z":"effce8e2e8a9f43c","g":"f155037011aa0d79","name":"Inverter MODBUS Response","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":3230,"y":500,"wires":[]},{"id":"fad803646bcd93ee","type":"function","z":"effce8e2e8a9f43c","g":"fbe0abfb3ee0e088","name":"Modbus Payload Template","func":"var values = [msg.StorCtl_Mod, (65535), (500), (10000), (65535), (65535), (5), (msg.OutWRte), (msg.InWRte)]\n\nmsg.payload = {\n 'value': values,\n 'fc': 16,\n 'unitid': 1,\n // INT+SF = -10\n 'address': 40348,\n 'quantity': 9\n}\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":2560,"y":520,"wires":[["3bffd91c351286ee"]]},{"id":"f049899799f7f431","type":"ha-time","z":"effce8e2e8a9f43c","g":"0bd67f9e3d7f071c","name":"TESLA START (NOW)","server":"afa7e6c.89d5e18","version":3,"exposeAsEntityConfig":"","entityId":"sensor.tesla_start_charging_time","property":"","offset":"","offsetType":"num","offsetUnits":"hours","randomOffset":false,"repeatDaily":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"sunday":true,"monday":true,"tuesday":true,"wednesday":true,"thursday":true,"friday":true,"saturday":true,"x":140,"y":280,"wires":[["19a007dca869d5ac"]]},{"id":"adbc3aa9cf52d50f","type":"debug","z":"effce8e2e8a9f43c","g":"e209b9134d0bb2d2","name":"MORE THAN 240","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":700,"y":680,"wires":[]},{"id":"0cc692ab6f439fdf","type":"api-current-state","z":"effce8e2e8a9f43c","g":"02b26ef1b0a8b08d","name":"Spotpris","server":"afa7e6c.89d5e18","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.energi_data_service","state_type":"num","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":320,"y":780,"wires":[["f032a97315254445"]]},{"id":"f032a97315254445","type":"switch","z":"effce8e2e8a9f43c","g":"02b26ef1b0a8b08d","name":"Price switch","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"240","vt":"num"},{"t":"gte","v":"MAXPEAKPRICE","vt":"env"},{"t":"lte","v":"MAXPEAKPRICE","vt":"env"},{"t":"lte","v":"100","vt":"env"}],"checkall":"false","repair":false,"outputs":4,"x":570,"y":780,"wires":[["1af0741d36ec6e93","adbc3aa9cf52d50f"],["fee34c327c9cea95","c8e0d9aa9ca9caeb"],["34990cd67c990907","7f55b776f0b34a54"],["2b9f4c9abc1148dd","de05bf4c517ce32a"]]},{"id":"7f4903812faedc8c","type":"time-of-day","z":"effce8e2e8a9f43c","g":"e209b9134d0bb2d2","name":"","startTime":"16:00:00","endTime":"20:01:00","outputs":1,"x":130,"y":800,"wires":[["0cc692ab6f439fdf"]]},{"id":"d02c29a8f72609bd","type":"time-of-day","z":"effce8e2e8a9f43c","g":"e209b9134d0bb2d2","name":"","startTime":"06:00:00","endTime":"09:01:00","outputs":1,"x":130,"y":740,"wires":[["0cc692ab6f439fdf"]]},{"id":"19a007dca869d5ac","type":"api-current-state","z":"effce8e2e8a9f43c","g":"0bd67f9e3d7f071c","name":"GRID LOAD less than 5500W?","server":"afa7e6c.89d5e18","version":3,"outputs":2,"halt_if":"5500","halt_if_type":"num","halt_if_compare":"lte","entity_id":"sensor.gen24_ac_meter_watts","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":710,"y":340,"wires":[["21da80d2a0e2aa42"],["96365e785c02b8ce"]]},{"id":"62364dcb3387db2b","type":"function","z":"effce8e2e8a9f43c","g":"d93cd01b0135c571","name":"1500W CHARGE","func":"msg.StorCtl_Mod = \"2\"\n// 4500W (65536-1500)\nmsg.OutWRte = \"64036\"\n\nmsg.newstate = \"forcecharge1500w\"\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":2150,"y":620,"wires":[["fad803646bcd93ee"]],"info":"Example 5: Charging in the range of 50% to 75% of the nominal power\nThis behavior can be achieved by limiting the maximum charge capacity to 75%\nand the maximum discharge capacity to -50%\n=> results in window [1650 W, 2475 W]\n- InWRte = 75% (set charge limit of WchaMax to 75%)\n- OutWRte = -50% (set discharge limit of WchaMax to -50%)\n- StorCtl_Mod = 3 (activate both limit values, bit pattern: 11)\n- Battery status in Fronius Solar.web will change to Forced Recharge"},{"id":"213549e7b854d62a","type":"server-state-changed","z":"effce8e2e8a9f43c","g":"72b918efda5f705f","name":"State Check Battery MORE THAN 60%","server":"afa7e6c.89d5e18","version":5,"outputs":2,"exposeAsEntityConfig":"","entityId":"sensor.gen24_storage_chastate","entityIdType":"exact","outputInitially":true,"stateType":"num","ifState":"60","ifStateType":"num","ifStateOperator":"gt","outputOnlyOnStateChange":true,"for":"0","forType":"num","forUnits":"minutes","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":1390,"y":60,"wires":[["b6852c6123b496b0"],["f27f1ab3f8eb58bf"]]},{"id":"b6852c6123b496b0","type":"time-of-day","z":"effce8e2e8a9f43c","g":"72b918efda5f705f","name":"","startTime":"09:01:00","endTime":"16:01:00","outputs":1,"x":1330,"y":140,"wires":[["8c9613cac1965ae9"]]},{"id":"1aa259781a6e2913","type":"debug","z":"effce8e2e8a9f43c","name":"IS SOMETHING WRITTEN?","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":3070,"y":640,"wires":[]},{"id":"6f57fd58660bf7dc","type":"inject","z":"effce8e2e8a9f43c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":2840,"y":640,"wires":[["1aa259781a6e2913"]]},{"id":"cb05b2a950f8de3d","type":"cronplus","z":"effce8e2e8a9f43c","name":"Every second","outputField":"payload","timeZone":"","storeName":"","commandResponseMsgOutput":"output1","defaultLocation":"","defaultLocationType":"default","outputs":1,"options":[{"name":"schedule1","topic":"topic1","payloadType":"default","payload":"","expressionType":"cron","expression":"* * * * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":540,"y":560,"wires":[[]]},{"id":"c8e0d9aa9ca9caeb","type":"debug","z":"effce8e2e8a9f43c","g":"e209b9134d0bb2d2","name":"MORE THAN $MAXPEAKPRICE","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":900,"y":820,"wires":[]},{"id":"34990cd67c990907","type":"debug","z":"effce8e2e8a9f43c","g":"e209b9134d0bb2d2","name":"LESS THAN $MAXPEAKPRICE","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":880,"y":880,"wires":[]},{"id":"f52c691bee1e0932","type":"function","z":"effce8e2e8a9f43c","g":"b9ef723c9e5d6e8c","name":"1500W DISCHARGE","func":"msg.StorCtl_Mod = \"1\"\n// 65536 - 1500\nmsg.InWRte = \"64036\"\n\nmsg.newstate = \"1kWdischarge\"\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":2140,"y":820,"wires":[["fad803646bcd93ee"]]},{"id":"3fccdd784ca45eca","type":"api-current-state","z":"effce8e2e8a9f43c","g":"b9ef723c9e5d6e8c","name":"InWRte already -15?","server":"afa7e6c.89d5e18","version":3,"outputs":2,"halt_if":"-15","halt_if_type":"num","halt_if_compare":"is","entity_id":"sensor.gen24_storage_inwrte","state_type":"num","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":1900,"y":820,"wires":[[],["f52c691bee1e0932"]]},{"id":"f888ef1ef01b3e83","type":"api-current-state","z":"effce8e2e8a9f43c","g":"7a2e734eead34d16","name":"ChaSt already HOLDING?","server":"afa7e6c.89d5e18","version":3,"outputs":2,"halt_if":"HOLDING","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.gen24_storage_chast","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":1920,"y":720,"wires":[[],["5d370aec7b2aa1ce"]]},{"id":"96365e785c02b8ce","type":"api-current-state","z":"effce8e2e8a9f43c","g":"d93cd01b0135c571","name":"OutWRte already -15?","server":"afa7e6c.89d5e18","version":3,"outputs":2,"halt_if":"-15","halt_if_type":"num","halt_if_compare":"is","entity_id":"sensor.gen24_storage_outwrte","state_type":"num","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":1900,"y":620,"wires":[[],["62364dcb3387db2b"]]},{"id":"21da80d2a0e2aa42","type":"api-current-state","z":"effce8e2e8a9f43c","g":"d93cd01b0135c571","name":"OutWRte already -45?","server":"afa7e6c.89d5e18","version":3,"outputs":2,"halt_if":"-45","halt_if_type":"num","halt_if_compare":"is","entity_id":"sensor.gen24_storage_outwrte","state_type":"num","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":1900,"y":560,"wires":[[],["66d147c4d9a586f8"]]},{"id":"8c9613cac1965ae9","type":"api-current-state","z":"effce8e2e8a9f43c","g":"7b45bdf5d2c774a4","name":"OutWRte already 100?","server":"afa7e6c.89d5e18","version":3,"outputs":2,"halt_if":"100","halt_if_type":"num","halt_if_compare":"is","entity_id":"sensor.gen24_storage_outwrte","state_type":"num","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":1900,"y":460,"wires":[[],["7a60a2b45d28626d"]]},{"id":"bc399a85c5ad3281","type":"function","z":"effce8e2e8a9f43c","g":"b9ef723c9e5d6e8c","name":"4500W DISCHARGE","func":"\nmsg.StorCtl_Mod = \"1\"\n// 65536 - 4500\nmsg.InWRte = \"61036\"\n\nmsg.newstate = \"3kWdischarge\"\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":2140,"y":880,"wires":[["fad803646bcd93ee"]]},{"id":"7b05462e688a5afd","type":"api-current-state","z":"effce8e2e8a9f43c","g":"b9ef723c9e5d6e8c","name":"InWRte already -45?","server":"afa7e6c.89d5e18","version":3,"outputs":2,"halt_if":"-45","halt_if_type":"num","halt_if_compare":"is","entity_id":"sensor.gen24_storage_inwrte","state_type":"num","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":1900,"y":880,"wires":[[],["bc399a85c5ad3281"]]},{"id":"ec6756e96722cebb","type":"api-current-state","z":"effce8e2e8a9f43c","g":"7a697ccd23e6b3cb","name":"GRID LOAD less than 5500W?","server":"afa7e6c.89d5e18","version":3,"outputs":2,"halt_if":"5500","halt_if_type":"num","halt_if_compare":"lte","entity_id":"sensor.gen24_ac_meter_watts","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":950,"y":140,"wires":[["21da80d2a0e2aa42"],["96365e785c02b8ce"]]},{"id":"2f6678d42b0de023","type":"ha-time","z":"effce8e2e8a9f43c","g":"0bd67f9e3d7f071c","name":"VW START (NOW)","server":"afa7e6c.89d5e18","version":3,"exposeAsEntityConfig":"","entityId":"sensor.volkswagen_start_charging_time","property":"","offset":"30","offsetType":"num","offsetUnits":"seconds","randomOffset":false,"repeatDaily":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"sunday":true,"monday":true,"tuesday":true,"wednesday":true,"thursday":true,"friday":true,"saturday":true,"x":130,"y":340,"wires":[["19a007dca869d5ac"]]},{"id":"906228c962c8c1e3","type":"ha-time","z":"effce8e2e8a9f43c","g":"0bd67f9e3d7f071c","name":"VW STOP (NOW)","server":"afa7e6c.89d5e18","version":3,"exposeAsEntityConfig":"","entityId":"sensor.volkswagen_stop_charging_time","property":"","offset":"30","offsetType":"num","offsetUnits":"seconds","randomOffset":false,"repeatDaily":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"sunday":true,"monday":true,"tuesday":true,"wednesday":true,"thursday":true,"friday":true,"saturday":true,"x":130,"y":480,"wires":[["e47b6a6830c96cef"]]},{"id":"ee12a627340871cc","type":"ha-time","z":"effce8e2e8a9f43c","g":"7a697ccd23e6b3cb","name":"VW START OFFSET -1H","server":"afa7e6c.89d5e18","version":3,"exposeAsEntityConfig":"","entityId":"sensor.volkswagen_start_charging_time","property":"","offset":"-3570","offsetType":"num","offsetUnits":"seconds","randomOffset":false,"repeatDaily":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"sunday":true,"monday":true,"tuesday":true,"wednesday":true,"thursday":true,"friday":true,"saturday":true,"x":150,"y":160,"wires":[["d5351cdc453ee22e"]]},{"id":"3bffd91c351286ee","type":"delay","z":"effce8e2e8a9f43c","g":"f155037011aa0d79","name":"Rate limit","pauseType":"rate","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":2820,"y":520,"wires":[["9f84293f8db8abd4"]]},{"id":"79428347ba72398e","type":"function","z":"effce8e2e8a9f43c","g":"f1579354c1921264","name":"ALLOW SUN CHARGE","func":"msg.StorCtl_Mod = \"3\"\nmsg.OutWRte = \"65536\"\nmsg.InWRte = \"10000\"\n\nmsg.newstate = \"allow_suncharge\"\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":2130,"y":360,"wires":[["fad803646bcd93ee"]],"info":"Example 3: Do not permit charging or discharging\nThis behavior can be achieved by limiting the maximum charge capacity to 0%\nand the maximum discharge capacity to 0%\n=> results in window [0 W, 0 W]\n- InWRte = 0% (set charge limit of WchaMax to 0%)\n- OutWRte = 0% (set discharge limit of WchaMax to 0%)\n- StorCtl_Mod = 3 (activate both limit values, bit pattern: 11)"},{"id":"f27f1ab3f8eb58bf","type":"time-of-day","z":"effce8e2e8a9f43c","g":"72b918efda5f705f","name":"","startTime":"09:01:00","endTime":"16:01:00","outputs":1,"x":1550,"y":140,"wires":[["b77df5e20a3eff97"]]},{"id":"d3317acef2826bb6","type":"ha-time","z":"effce8e2e8a9f43c","g":"e209b9134d0bb2d2","name":"MAX DISCHARGE @ PEAK","server":"afa7e6c.89d5e18","version":3,"exposeAsEntityConfig":"","entityId":"sensor.peak_48_hours_time","property":"","offset":"2","offsetType":"num","offsetUnits":"minutes","randomOffset":false,"repeatDaily":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"sunday":true,"monday":true,"tuesday":true,"wednesday":true,"thursday":true,"friday":true,"saturday":true,"x":160,"y":940,"wires":[["f8111ebed4317fd9"]]},{"id":"f8111ebed4317fd9","type":"api-current-state","z":"effce8e2e8a9f43c","g":"e209b9134d0bb2d2","name":"PEAK PRICE (170)","server":"afa7e6c.89d5e18","version":3,"outputs":2,"halt_if":"170","halt_if_type":"num","halt_if_compare":"gt","entity_id":"sensor.peak_48_hours_price","state_type":"num","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":940,"wires":[["7b05462e688a5afd"],["f032a97315254445"]]},{"id":"b77df5e20a3eff97","type":"api-current-state","z":"effce8e2e8a9f43c","g":"f1579354c1921264","name":"InWRte already 100?","server":"afa7e6c.89d5e18","version":3,"outputs":2,"halt_if":"100","halt_if_type":"num","halt_if_compare":"is","entity_id":"sensor.gen24_storage_inwrte","state_type":"num","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":1880,"y":300,"wires":[[],["b30d06bcfe2e62de"]]},{"id":"1aab75cc0f069305","type":"cronplus","z":"effce8e2e8a9f43c","g":"e209b9134d0bb2d2","name":"Every hour","outputField":"payload","timeZone":"","storeName":"","commandResponseMsgOutput":"output1","defaultLocation":"","defaultLocationType":"default","outputs":1,"options":[{"name":"schedule1","topic":"topic1","payloadType":"default","payload":"","expressionType":"cron","expression":"15 0 * * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":130,"y":680,"wires":[["d02c29a8f72609bd","7f4903812faedc8c"]]},{"id":"8306b11f2939be75","type":"cronplus","z":"effce8e2e8a9f43c","name":"Every minute","outputField":"payload","timeZone":"","storeName":"","commandResponseMsgOutput":"output1","defaultLocation":"","defaultLocationType":"default","outputs":1,"options":[{"name":"schedule1","topic":"topic1","payloadType":"default","payload":"","expressionType":"cron","expression":"0 * * * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":810,"y":560,"wires":[[]]},{"id":"b30d06bcfe2e62de","type":"api-current-state","z":"effce8e2e8a9f43c","g":"f1579354c1921264","name":"ChaSt already HOLDING?","server":"afa7e6c.89d5e18","version":3,"outputs":2,"halt_if":"HOLDING","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.gen24_storage_chast","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":2120,"y":300,"wires":[[],["79428347ba72398e"]]},{"id":"2b9f4c9abc1148dd","type":"debug","z":"effce8e2e8a9f43c","g":"e209b9134d0bb2d2","name":"LESS THAN 100","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":790,"y":980,"wires":[]},{"id":"afa7e6c.89d5e18","type":"server","name":"Home Assistant","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":true,"heartbeatInterval":"30","statusSeparator":"","enableGlobalContextStore":false},{"id":"ecd41b68db8d4254","type":"modbus-client","name":"Fronius Gen24","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":true,"queueLogEnabled":false,"failureLogEnabled":true,"tcpHost":"10.10.10.4","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":true,"showWarnings":true,"showLogs":true}]
Any suggestions of improvments?