Integration of a Fronius Symo Gen 24 plus Inverter via Modbus TCP

Answering my own questions. My mistakes where:

  1. All Modbus SunSpec registers over address 40000 is apparently holding registers not input ones, even if they are read-only.
  2. As Oscar Knapp has pointed out on several occasions, you need to decrease the Modbus register address by “1” for correct results.

Adhering to the above two rules and “everything” now works as expected.

/Jörgen

Hi Per,

Just got confused - you replied to my post and wrote the name of the helper to my post :slight_smile:
Are you interested in my work? Your name indicates you could be a dane? (as I am).
I don’t think the entire work, combined in NodeRED and Home Assistant fit in a short post in here. Maybe we could chat and show work on mail etc? Can try and show some pictures here:




image

It’s tons of pictures with lots of code and thoughts put into it :slight_smile:

Best regards
Steffan

2 Likes

Just installed 2023.10. Breaks @soly3141 's Modbus Fronius integration. Extract of the Error messsages:

*Invalid config for [modbus]: reading_battery_soc_scaled: `count: 1` cannot be combined with `data_type: uint16` @ data['modbus'][0]['sensors'][6]. Got {'name': 'reading_battery_soc_scaled', 'slave': 1, 'count': 1, 'data_type': 'uint16', 'address': 40361, 'scan_interval': 1}*
*reading_battery_storage_control: `count: 1` cannot be combined with `data_type: uint16` @ data['modbus'][0]['sensors'][7]. Got {'name': 'reading_battery_storage_control', 'slave': 1, 'count': 1, 'data_type': 'uint16', 'address': 40358, 'scan_interval': 1}* ...

Rather annoyed by Modbus in Home Assistant now. Considering moving everything to node-red, as all my battery management is broken … now, that I am on my fourth day with Tibber … :frowning:

@steffanlm, would you probably share your flows? Data gathering looks like a heck of work you put into this.

OK, this was an announced breaking change. Removing the count-line für float32, uint16, etc. will do the job and the integrations works again.

Did not have the patience to look into this yesterday …

3 Likes

Hey Steffan,
that looks like a ton of great work. I’m still struggling to get battery control right with Node and HA. Really interested in your flows. Could you share them?

Surely I can share my code/nodes :slight_smile: Hopefully you can get something out of it.

All the data gathering is in this flow.

Data gathering flow

Whenever I have calculated values to send as InWRte, OutWRte, StorCtl_Mod or ChaGriSet then I send the values throug this function:

InWRte, OutWRte, StorCtl_Mod or ChaGriSet

Before sending into the “Modbus execute” group:

Modbus execute group

Likewise I use the function node to send WMaxLim_Ena and WMaxLimPct in the same Modbus command, - also to the Modbus execute group.

WMaxLim_Ena and WMaxLimPct

Lots of the other nodes has been refactored and are primarily used as very specific calculations for our house, and most can only be used coherent with my other flows and specific data from Home Assistant.

Hope the above gives you some ideas - and if you find anything not working out, please write so I can change it :slight_smile:

2 Likes

Wow! Great thread, I’m happy I found it - and thanks to everyone posting!

I’m in a situation were I want to charge the battery on low prices, and use it during peak hours… Same as many of you here. I’ve just setup the Sunspec integration, but question is - does it provide the same functions as a manual YAML file? I haven’t yet found the settings to control the battery…

Any advice would be greatful! I don’t want to dig deep in the wrong direction. :slight_smile:

Hi and welcome to this thread :slight_smile:
The Sunspec integrations, as far as I’m concerned, does only support reading registers and not writing.
Which means you’ll have to either use NodeRED with the Modbus TCP palettes or use Modbus TCP inside Home Assistant to write to the registers.

Keep in mind, that theres some restraints in some of the writeable registers, especialy the battery power commands and storage mode (InWRte, OutWRte and StorCtl_Mod), from the inverter register map, it states:

Blockquote
Please be aware that setting an invalid power window will result in a modbus exception 3 (ILLEGAL DATA VALUE).
Invalid power windows are all windows where condition:
((StorCtl_Mod == 3) AND ((-1) * InWRtg > OutWRtg))
evaluates to true.
This can happen for example if two negative values are written into InWRtg and OutWRtg and both limits are activated by StorCtl_Mod = 3.
Blockquote

Hope this helps you on your way :slight_smile:

1 Like

Ok, so basically the Sunspec integration is useless as I could use the SolarAPI (and the official Fronius app) for the same thing (reading)?

In terms of “I want to change something”, yes. In terms of “read everyhting”, I disagree as the sunspec integrations reads far more sensors that the SolarAPI afaik.

However, I am also looking into how I can steer my two Fronius Inverters and the BYD battery via modbus. Seems like the iobroker community has some solutions in place. GEN24 Modbus TCP - Seite 21 - Fronius - Datenkommunikation - Photovoltaikforum
However, I am still trying to figure out how to transfer this to home assistant.

Edit: Nevermind, I will look into what @steffanlm posted above. Overlooked it the first time. Thanks!

1 Like

Can’t read German, but I’ll have a look with Google translate later - sounds very promising!

1 Like

Agree that the Sunspec integrations is way better than the Solar API. But it can’t control anything

Try this site @ Fronius Modbus TCP, there you can find all the registers (take into consideration, that the actual adress is 1 lower than the number in column A.

Hope you will have som fun with it :slight_smile:

Thanks for the link and effort @steffanlm Sitting with this now, and running some test tool against Modbus, and I can change values and I can read values, but the ones you posted are for not for the Gen24 as it seems (they don’t match).

Does anyone have the docs for Gen24 10 kW (2022)?

Yes, use the Sunspec integration to read all the values available!

1 Like

For Gen24

Heres my implementation in HA with NodeRed and Sunspec Integration with Amber Electric

[{"id":"2460b7dd22fc0358","type":"tab","label":"Fronius Export Control Updated","disabled":false,"info":"","env":[]},{"id":"74dfb6afdf121d19","type":"group","z":"2460b7dd22fc0358","g":"66f0121a8b516555","name":"Enable Modbus Control - Max Output","style":{"label":true},"nodes":["4424e65c47235621","a88ec308cb52529a","f6bd5f54023308ae","8ea2ce8d05922290","d11275dec03844b6"],"x":1234,"y":539,"w":612,"h":162},{"id":"6993516a32a59b71","type":"group","z":"2460b7dd22fc0358","g":"66f0121a8b516555","name":"Disable Modbus Control - Limit Exports","style":{"label":true},"nodes":["e8bc3c34e4cb3f79","091ca0116b29db01","d4b4a54cb4aa17bb","073cc64d0420449c","95cb0b89c5be0909"],"x":1234,"y":739,"w":652,"h":162},{"id":"0cddcf6a8d4b09b6","type":"group","z":"2460b7dd22fc0358","g":"66f0121a8b516555","name":"Main Inverter Connected to Smart Meter","style":{"label":true},"nodes":["275bac20521dd815","31a7f969cf40e341","de8198b8483efb73","690bd84223e55379"],"x":1954,"y":659,"w":552,"h":142},{"id":"87543ce341c9e85d","type":"group","z":"2460b7dd22fc0358","g":"66f0121a8b516555","name":"Check Current WMaxLimEna","style":{"label":true},"nodes":["1859bb751ba0b5f0","4c52d84c52b01173","d06268381d9b1ba0"],"x":654,"y":559,"w":552,"h":142},{"id":"c46c62d7c69ba03a","type":"group","z":"2460b7dd22fc0358","g":"66f0121a8b516555","name":"Check Current WMaxLimEna","style":{"label":true},"nodes":["400182d674067c57","2b0c3617f5138257","5358b681c1fa3106"],"x":654,"y":759,"w":552,"h":122},{"id":"7c23f29e75638c08","type":"group","z":"2460b7dd22fc0358","g":"3e13df5b7039c004","name":"Second Inverter","style":{"label":true},"nodes":["a4d0152614a3671a","a2e60142c5be6a27","b9bccdc929bb7d54","87edb8670d5a32bb"],"x":1974,"y":1099,"w":572,"h":142},{"id":"c2afb15cb81777b8","type":"group","z":"2460b7dd22fc0358","g":"3e13df5b7039c004","name":"Dynamically Adjust the Secondary Inverter","style":{"label":true},"nodes":["95a5082971e6020d","6e0841d7f1b17b23","a84ab0e422e01311","54a89747c60a891d","f795ea8883d2a275","8ee37061c0cb1243","4c7a4b52a6607dac","e848c661cc6a1c9d","a6e826a02ccbc499","bf24288cf494992c","a7562a9309c05f96","27bf33342ce1e2dc","6fae0df315e7a4d1","9e079b793920b391","5acdfe004850534e","9da8d43e08d423c1","4d6165e9a0c55a3c","aaa39d4ab978700b","6e2437edceb64e40","f92ca82c5955f83c"],"x":614,"y":1279,"w":1512,"h":322},{"id":"8a8194d59417d91d","type":"group","z":"2460b7dd22fc0358","name":"Check 1 Minute Intervals","style":{"label":true},"nodes":["605792a73279325e","320786e1166ef1dc","2ed29017e4d3c228","19d4852685542b32","49aecce2493817e0"],"x":14,"y":759,"w":392,"h":227},{"id":"07080c7a21ef1938","type":"group","z":"2460b7dd22fc0358","name":"Check Battery Discharge - If Yes - Max Output","style":{"label":true},"nodes":["26222171c54a8ba8","becb5d2ee3e31bc3","2835bc346487d09c"],"x":14,"y":1139,"w":512,"h":162},{"id":"f7570cd12838d1bc","type":"group","z":"2460b7dd22fc0358","g":"3e13df5b7039c004","name":"Enable Modbus Control - Max Output","style":{"label":true},"nodes":["9262736b24c3dcf6","b26b238368b5fa83","911998946c7fe805","620bc736d07d3a2a","5eff2d6200c379b7"],"x":1214,"y":1099,"w":632,"h":162},{"id":"8022a2d03c6d4139","type":"group","z":"2460b7dd22fc0358","g":"3e13df5b7039c004","name":"Check Current WMaxLimPct","style":{"label":true},"nodes":["52109d151076b72c","72ea2cd944293cf4","1afdb5a6e1052829"],"x":634,"y":1119,"w":572,"h":142},{"id":"66f0121a8b516555","type":"group","z":"2460b7dd22fc0358","name":"Primary Inverter with Smart Meter","style":{"label":true},"nodes":["5658c3ae97fca855","158465a3e54de723","164d38eedc9e7059","93c8592b3ac2c868","74dfb6afdf121d19","6993516a32a59b71","0cddcf6a8d4b09b6","87543ce341c9e85d","c46c62d7c69ba03a"],"x":614,"y":479,"w":1918,"h":482},{"id":"3e13df5b7039c004","type":"group","z":"2460b7dd22fc0358","name":"Secondary Inverter","style":{"label":true},"nodes":["78921d383f9b79ea","1224a2a8f51a13d6","7c23f29e75638c08","c2afb15cb81777b8","f7570cd12838d1bc","8022a2d03c6d4139"],"x":588,"y":1039,"w":1984,"h":588},{"id":"8ea2ce8d05922290","type":"junction","z":"2460b7dd22fc0358","g":"74dfb6afdf121d19","x":1280,"y":640,"wires":[["a88ec308cb52529a"]]},{"id":"690bd84223e55379","type":"junction","z":"2460b7dd22fc0358","g":"0cddcf6a8d4b09b6","x":1980,"y":740,"wires":[["de8198b8483efb73"]]},{"id":"d11275dec03844b6","type":"junction","z":"2460b7dd22fc0358","g":"74dfb6afdf121d19","x":1780,"y":640,"wires":[["690bd84223e55379"]]},{"id":"073cc64d0420449c","type":"junction","z":"2460b7dd22fc0358","g":"6993516a32a59b71","x":1300,"y":780,"wires":[["091ca0116b29db01"]]},{"id":"95cb0b89c5be0909","type":"junction","z":"2460b7dd22fc0358","g":"6993516a32a59b71","x":1802.592529296875,"y":782.6665649414062,"wires":[["690bd84223e55379"]]},{"id":"87edb8670d5a32bb","type":"junction","z":"2460b7dd22fc0358","g":"7c23f29e75638c08","x":2000,"y":1180,"wires":[["b9bccdc929bb7d54"]]},{"id":"4c7a4b52a6607dac","type":"junction","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","x":640,"y":1440,"wires":[["bf24288cf494992c","f795ea8883d2a275","9e079b793920b391"]]},{"id":"620bc736d07d3a2a","type":"junction","z":"2460b7dd22fc0358","g":"f7570cd12838d1bc","x":1260,"y":1200,"wires":[["b26b238368b5fa83"]]},{"id":"5eff2d6200c379b7","type":"junction","z":"2460b7dd22fc0358","g":"f7570cd12838d1bc","x":1760,"y":1200,"wires":[["87edb8670d5a32bb"]]},{"id":"19d4852685542b32","type":"junction","z":"2460b7dd22fc0358","g":"8a8194d59417d91d","x":380,"y":920,"wires":[["1859bb751ba0b5f0","52109d151076b72c"]]},{"id":"49aecce2493817e0","type":"junction","z":"2460b7dd22fc0358","g":"8a8194d59417d91d","x":380,"y":960,"wires":[["400182d674067c57","26222171c54a8ba8"]]},{"id":"275bac20521dd815","type":"debug","z":"2460b7dd22fc0358","g":"0cddcf6a8d4b09b6","name":"PRIMARY: Inverter Set","active":false,"tosidebar":true,"console":true,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":2350,"y":760,"wires":[]},{"id":"4424e65c47235621","type":"inject","z":"2460b7dd22fc0358","g":"74dfb6afdf121d19","name":"ExportLimitOFF","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":"","topic":"","payload":"","payloadType":"str","x":1360,"y":580,"wires":[["a88ec308cb52529a"]]},{"id":"a88ec308cb52529a","type":"function","z":"2460b7dd22fc0358","g":"74dfb6afdf121d19","name":"100% Max Power","func":"var values = [(10000),(0),(0),(0),(1)];\n\nmsg.payload = { \n    'value': values,\n    'fc': 16,\n    'unitid': 1,\n    'address': 40242,\n    'quantity': 5\n} \n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1510,"y":660,"wires":[["f6bd5f54023308ae","d11275dec03844b6"]]},{"id":"f6bd5f54023308ae","type":"debug","z":"2460b7dd22fc0358","g":"74dfb6afdf121d19","name":"PRIMARY: MAX POWA SET","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1680,"y":580,"wires":[]},{"id":"31a7f969cf40e341","type":"modbus-response","z":"2460b7dd22fc0358","g":"0cddcf6a8d4b09b6","name":"","registerShowMax":20,"x":2330,"y":700,"wires":[]},{"id":"de8198b8483efb73","type":"modbus-flex-write","z":"2460b7dd22fc0358","g":"0cddcf6a8d4b09b6","name":"Fronius-Storage","showStatusActivities":true,"showErrors":true,"showWarnings":true,"server":"bcc4229c.180ac","emptyMsgOnFail":false,"keepMsgProperties":false,"delayOnStart":false,"startDelayTime":"10","x":2100,"y":740,"wires":[["31a7f969cf40e341","275bac20521dd815"],["275bac20521dd815"]]},{"id":"e8bc3c34e4cb3f79","type":"inject","z":"2460b7dd22fc0358","g":"6993516a32a59b71","name":"ExportLimitOn","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":"","topic":"","payload":"","payloadType":"str","x":1350,"y":860,"wires":[["091ca0116b29db01"]]},{"id":"091ca0116b29db01","type":"function","z":"2460b7dd22fc0358","g":"6993516a32a59b71","name":"WMaxLim_Ena = 0","func":"msg.payload = { \n    'value': 0,\n    'fc': 6,\n    'unitid': 1,\n    'address': 40246,\n    'quantity': 1\n} \n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1510,"y":780,"wires":[["d4b4a54cb4aa17bb","95cb0b89c5be0909"]]},{"id":"d4b4a54cb4aa17bb","type":"debug","z":"2460b7dd22fc0358","g":"6993516a32a59b71","name":"PRIMARY: Set Export Limit","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1720,"y":860,"wires":[]},{"id":"5658c3ae97fca855","type":"comment","z":"2460b7dd22fc0358","g":"66f0121a8b516555","name":"When Positive Feed In - Max Output","info":"","x":1380,"y":520,"wires":[]},{"id":"158465a3e54de723","type":"comment","z":"2460b7dd22fc0358","g":"66f0121a8b516555","name":"When Negative Feed In - Limit Exports to 0","info":"","x":1400,"y":920,"wires":[]},{"id":"1859bb751ba0b5f0","type":"modbus-getter","z":"2460b7dd22fc0358","g":"87543ce341c9e85d","name":"Read_WMaxLimEna","showStatusActivities":false,"showErrors":false,"showWarnings":false,"logIOActivities":false,"unitid":"1","dataType":"HoldingRegister","adr":"40246","quantity":"1","server":"bcc4229c.180ac","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":true,"delayOnStart":false,"startDelayTime":"","x":780,"y":600,"wires":[["4c52d84c52b01173"],[]]},{"id":"4c52d84c52b01173","type":"switch","z":"2460b7dd22fc0358","g":"87543ce341c9e85d","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":990,"y":600,"wires":[["8ea2ce8d05922290"],["d06268381d9b1ba0"]]},{"id":"400182d674067c57","type":"modbus-getter","z":"2460b7dd22fc0358","g":"c46c62d7c69ba03a","name":"Read_WMaxLimEna","showStatusActivities":false,"showErrors":false,"showWarnings":false,"logIOActivities":false,"unitid":"1","dataType":"HoldingRegister","adr":"40246","quantity":"1","server":"bcc4229c.180ac","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":true,"delayOnStart":false,"startDelayTime":"","x":780,"y":800,"wires":[["2b0c3617f5138257"],[]]},{"id":"2b0c3617f5138257","type":"switch","z":"2460b7dd22fc0358","g":"c46c62d7c69ba03a","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":970,"y":800,"wires":[["073cc64d0420449c"],["5358b681c1fa3106"]]},{"id":"d06268381d9b1ba0","type":"debug","z":"2460b7dd22fc0358","g":"87543ce341c9e85d","name":"PRIMARY: Already Max","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1050,"y":660,"wires":[]},{"id":"5358b681c1fa3106","type":"debug","z":"2460b7dd22fc0358","g":"c46c62d7c69ba03a","name":"PRIMARY: Already Limit","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1050,"y":840,"wires":[]},{"id":"164d38eedc9e7059","type":"comment","z":"2460b7dd22fc0358","g":"66f0121a8b516555","name":"If WMaxLimEna is 0, set it to 1, if 1, then do nothing","info":"","x":850,"y":520,"wires":[]},{"id":"93c8592b3ac2c868","type":"comment","z":"2460b7dd22fc0358","g":"66f0121a8b516555","name":"If WMaxLimEna is 1, set it to 0, if 0, then do nothing","info":"","x":830,"y":920,"wires":[]},{"id":"a4d0152614a3671a","type":"debug","z":"2460b7dd22fc0358","g":"7c23f29e75638c08","name":"SECONDARY: Inverter Set","active":false,"tosidebar":true,"console":true,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":2380,"y":1200,"wires":[]},{"id":"a2e60142c5be6a27","type":"modbus-response","z":"2460b7dd22fc0358","g":"7c23f29e75638c08","name":"","registerShowMax":20,"x":2350,"y":1140,"wires":[]},{"id":"b9bccdc929bb7d54","type":"modbus-flex-write","z":"2460b7dd22fc0358","g":"7c23f29e75638c08","name":"Fronius-Storage","showStatusActivities":false,"showErrors":true,"showWarnings":false,"server":"ecd41b68db8d4254","emptyMsgOnFail":false,"keepMsgProperties":false,"delayOnStart":false,"startDelayTime":"10","x":2120,"y":1180,"wires":[["a2e60142c5be6a27","a4d0152614a3671a"],["a4d0152614a3671a"]]},{"id":"95a5082971e6020d","type":"function","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"Decrease Power to Decrease Exports","func":"var curpower = msg.payload.power;\n\nvar invertermax = 5000;\n\nvar CurWMaxLimPct = msg.payload.WMaxLimPct;\nvar CurWMaxLim_Ena = msg.payload.WMaxLim_Ena;\n\nvar NewWMaxLimPct;\nvar NewWMaxLim_Ena;\n\nif (curpower < 0){\n    \n    curpower = curpower * -1;\n\n    if( curpower > invertermax ){\n\n        NewWMaxLimPct = 100;\n        NewWMaxLim_Ena = 0;\n\n    } else {\n\n        var trim = curpower / invertermax * 10000;\n\n        NewWMaxLimPct = CurWMaxLimPct - trim;\n\n        if (NewWMaxLimPct < 100){\n\n            NewWMaxLimPct = 100;\n            NewWMaxLim_Ena = 0;\n\n        } else {\n            \n            NewWMaxLim_Ena = 1;\n\n        }\n    \n    }\n\n    msg.payload.WMaxLimPct = NewWMaxLimPct;\n    msg.payload.WMaxLim_Ena = NewWMaxLim_Ena;\n\n    if (NewWMaxLimPct == CurWMaxLimPct){\n        msg.newstate = \"donothing\";\n    } else {\n        msg.newstate = \"change\";\n    }\n\n}\n\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1610,"y":1400,"wires":[["e848c661cc6a1c9d","aaa39d4ab978700b"]]},{"id":"6e0841d7f1b17b23","type":"function","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"InWRte","func":"var values = [msg.payload.WMaxLimPct, (0), (0), (0), msg.payload.WMaxLim_Ena]\n\nmsg.payload = { \n    'value': values,\n    'fc': 16,\n    'unitid': 1,\n    'address': 40242,\n    'quantity': 5\n} \n\nmsg.newstate = msg.WMaxLimPct\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":2000,"y":1320,"wires":[["87edb8670d5a32bb"]]},{"id":"a84ab0e422e01311","type":"function","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"Increase Power to Reduce Imports","func":"var importpower = msg.payload.power;\n\nvar invertermax = 5000;\n\nvar CurWMaxLimPct = msg.payload.WMaxLimPct;\nvar CurWMaxLim_Ena = msg.payload.WMaxLim_Ena;\n\nvar NewWMaxLimPct;\nvar NewWMaxLim_Ena;\n\nif (importpower > 0){\n\n    NewWMaxLim_Ena = 1;  \n\n    if( importpower > invertermax ){\n\n        NewWMaxLimPct = 10000;\n\n    } else {\n\n        var add = importpower / invertermax * 10000;\n\n        NewWMaxLimPct = add + CurWMaxLimPct;\n\n        if (NewWMaxLimPct > 10000){\n\n            NewWMaxLimPct = 10000;\n\n        } \n    }\n\n    msg.payload.WMaxLimPct = NewWMaxLimPct;\n    msg.payload.WMaxLim_Ena = NewWMaxLim_Ena;    \n\n    if (CurWMaxLimPct == NewWMaxLimPct){\n        msg.newstate = \"donothing\";\n    } else {\n        msg.newstate = \"change\";\n    }\n}\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1600,"y":1480,"wires":[["e848c661cc6a1c9d","6e2437edceb64e40"]]},{"id":"54a89747c60a891d","type":"switch","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"500w limit","property":"payload.power","propertyType":"msg","rules":[{"t":"lte","v":"-500","vt":"num"},{"t":"btwn","v":"-500","vt":"num","v2":"500","v2t":"num"},{"t":"gte","v":"500","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":1360,"y":1440,"wires":[["95a5082971e6020d"],["8ee37061c0cb1243"],["a84ab0e422e01311"]]},{"id":"f795ea8883d2a275","type":"api-current-state","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"Export Power Check","server":"61d027bd.371248","version":3,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"lt","entity_id":"sensor.ac_meter_watts","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"newstate","propertyType":"msg","value":"","valueType":"str"},{"property":"topic","propertyType":"msg","value":"power","valueType":"str"}],"for":"30","forType":"num","forUnits":"seconds","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":780,"y":1440,"wires":[["6fae0df315e7a4d1"]]},{"id":"8ee37061c0cb1243","type":"debug","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"SECONDARY: Within 500W","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1600,"y":1440,"wires":[]},{"id":"605792a73279325e","type":"api-current-state","z":"2460b7dd22fc0358","g":"8a8194d59417d91d","name":"AmberPrice","server":"61d027bd.371248","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.amber_feed_in_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":170,"y":880,"wires":[["320786e1166ef1dc"]]},{"id":"320786e1166ef1dc","type":"switch","z":"2460b7dd22fc0358","g":"8a8194d59417d91d","name":"Above 0, or Less Equal to 0","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"},{"t":"lte","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":240,"y":940,"wires":[["19d4852685542b32"],["49aecce2493817e0"]]},{"id":"2ed29017e4d3c228","type":"cronplus","z":"2460b7dd22fc0358","g":"8a8194d59417d91d","name":"1 Min Interval","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"schedule1","topic":"topic1","payloadType":"default","payload":"","expressionType":"cron","expression":"30 * 5-20 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":140,"y":800,"wires":[["605792a73279325e"]]},{"id":"e848c661cc6a1c9d","type":"switch","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"","property":"newstate","propertyType":"msg","rules":[{"t":"eq","v":"change","vt":"str"},{"t":"eq","v":"donothing","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1850,"y":1440,"wires":[["6e0841d7f1b17b23"],["a7562a9309c05f96"]]},{"id":"bf24288cf494992c","type":"modbus-getter","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"Read_WMaxLimPct","showStatusActivities":false,"showErrors":false,"showWarnings":false,"logIOActivities":false,"unitid":"1","dataType":"HoldingRegister","adr":"40242","quantity":"1","server":"ecd41b68db8d4254","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":true,"delayOnStart":false,"startDelayTime":"","x":780,"y":1380,"wires":[["a6e826a02ccbc499"],[]]},{"id":"a6e826a02ccbc499","type":"function","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"function 20","func":" \nvar data = msg.payload;\n\nvar limit = data[0];\n\nmsg.payload = limit;\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":970,"y":1380,"wires":[["27bf33342ce1e2dc"]]},{"id":"a7562a9309c05f96","type":"debug","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"SECONDARY: Do nothing","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1970,"y":1500,"wires":[]},{"id":"27bf33342ce1e2dc","type":"change","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"WMaxLimPct","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":1380,"wires":[["6fae0df315e7a4d1"]]},{"id":"6fae0df315e7a4d1","type":"join","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"5","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1230,"y":1440,"wires":[["54a89747c60a891d"]]},{"id":"f92ca82c5955f83c","type":"inject","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":720,"y":1560,"wires":[["4c7a4b52a6607dac"]]},{"id":"26222171c54a8ba8","type":"api-current-state","z":"2460b7dd22fc0358","g":"07080c7a21ef1938","name":"BatteryDischarge","server":"61d027bd.371248","version":3,"outputs":2,"halt_if":"500","halt_if_type":"num","halt_if_compare":"gt","entity_id":"sensor.kw10_mppt_module_3_dc_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"topic","propertyType":"msg","value":"discharge","valueType":"str"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":130,"y":1180,"wires":[["52109d151076b72c"],["becb5d2ee3e31bc3"]]},{"id":"4d6165e9a0c55a3c","type":"inject","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"","props":[{"p":"payload"},{"p":"complete","v":"","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1100,"y":1320,"wires":[["6fae0df315e7a4d1"]]},{"id":"9e079b793920b391","type":"modbus-getter","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"Read_WMaxLimEna","showStatusActivities":false,"showErrors":false,"showWarnings":false,"logIOActivities":false,"unitid":"1","dataType":"HoldingRegister","adr":"40246","quantity":"1","server":"ecd41b68db8d4254","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":true,"delayOnStart":false,"startDelayTime":"","x":780,"y":1500,"wires":[["5acdfe004850534e"],[]]},{"id":"5acdfe004850534e","type":"function","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"function 31","func":" \nvar data = msg.payload;\n\nvar limit = data[0];\n\nmsg.payload = limit;\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":970,"y":1500,"wires":[["9da8d43e08d423c1"]]},{"id":"9da8d43e08d423c1","type":"change","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"WMaxLim_Ena","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":1500,"wires":[["6fae0df315e7a4d1"]]},{"id":"78921d383f9b79ea","type":"comment","z":"2460b7dd22fc0358","g":"3e13df5b7039c004","name":"When Positive Feed In - Max Output","info":"","x":1380,"y":1080,"wires":[]},{"id":"1224a2a8f51a13d6","type":"comment","z":"2460b7dd22fc0358","g":"3e13df5b7039c004","name":"If WMaxLimPct is less than 10000, set it to 10000, if already 10000, then do nothing","info":"","x":910,"y":1080,"wires":[]},{"id":"9262736b24c3dcf6","type":"inject","z":"2460b7dd22fc0358","g":"f7570cd12838d1bc","name":"ExportLimitOFF","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":"","topic":"","payload":"","payloadType":"str","x":1340,"y":1140,"wires":[["b26b238368b5fa83"]]},{"id":"b26b238368b5fa83","type":"function","z":"2460b7dd22fc0358","g":"f7570cd12838d1bc","name":"100% Max Power","func":"var values = [(10000),(0),(0),(0),(1)];\n\nmsg.payload = { \n    'value': values,\n    'fc': 16,\n    'unitid': 1,\n    'address': 40242,\n    'quantity': 5\n} \n\nmsg.newstate = \"max\";\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1490,"y":1220,"wires":[["911998946c7fe805","5eff2d6200c379b7"]]},{"id":"911998946c7fe805","type":"debug","z":"2460b7dd22fc0358","g":"f7570cd12838d1bc","name":"SECONDARY: MAX POWA SET","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1670,"y":1140,"wires":[]},{"id":"52109d151076b72c","type":"modbus-getter","z":"2460b7dd22fc0358","g":"8022a2d03c6d4139","name":"Read_WMaxLimPct","showStatusActivities":false,"showErrors":false,"showWarnings":false,"logIOActivities":false,"unitid":"1","dataType":"HoldingRegister","adr":"40242","quantity":"1","server":"ecd41b68db8d4254","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":true,"delayOnStart":false,"startDelayTime":"","x":760,"y":1160,"wires":[["72ea2cd944293cf4"],[]]},{"id":"72ea2cd944293cf4","type":"switch","z":"2460b7dd22fc0358","g":"8022a2d03c6d4139","name":"","property":"payload","propertyType":"msg","rules":[{"t":"neq","v":"10000","vt":"num"},{"t":"eq","v":"10000","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":970,"y":1160,"wires":[["620bc736d07d3a2a"],["1afdb5a6e1052829"]]},{"id":"1afdb5a6e1052829","type":"debug","z":"2460b7dd22fc0358","g":"8022a2d03c6d4139","name":"SECONDARY: Already Max","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1040,"y":1220,"wires":[]},{"id":"aaa39d4ab978700b","type":"debug","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"SECONDARY: Decrease Power?","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1740,"y":1340,"wires":[]},{"id":"6e2437edceb64e40","type":"debug","z":"2460b7dd22fc0358","g":"c2afb15cb81777b8","name":"SECONDARY: Increase Power?","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1710,"y":1540,"wires":[]},{"id":"becb5d2ee3e31bc3","type":"api-current-state","z":"2460b7dd22fc0358","g":"07080c7a21ef1938","name":"Battery Charge Rate Less Than 4500","server":"61d027bd.371248","version":3,"outputs":2,"halt_if":"4500","halt_if_type":"num","halt_if_compare":"lt","entity_id":"sensor.kw10_mppt_module_2_dc_power","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":190,"y":1260,"wires":[["2835bc346487d09c"],["4c7a4b52a6607dac"]]},{"id":"2835bc346487d09c","type":"api-current-state","z":"2460b7dd22fc0358","g":"07080c7a21ef1938","name":"Battery Not Full","server":"61d027bd.371248","version":3,"outputs":2,"halt_if":"100","halt_if_type":"num","halt_if_compare":"lt","entity_id":"sensor.kw10_storage_chastate","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":420,"y":1200,"wires":[["52109d151076b72c"],["4c7a4b52a6607dac"]]},{"id":"bcc4229c.180ac","type":"modbus-client","name":"Fronius 10kw","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":true,"queueLogEnabled":false,"failureLogEnabled":true,"tcpHost":"192.168.0.179","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true},{"id":"ecd41b68db8d4254","type":"modbus-client","name":"fronius5kw","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":true,"queueLogEnabled":false,"failureLogEnabled":true,"tcpHost":"192.168.0.173","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},{"id":"61d027bd.371248","type":"server","name":"Home Assistant HOME","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":true,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

You can read through my process here:

How To Control and Automate Your Export Limit Your Fronius Gen24 Inverter(s) on Amber Electric with NodeRed and HomeAssistant!

2 Likes

My BYD Battery Control (FLOAT REGISTERS - if you are INT+FLOAT just minus 10 from the register address)

I have another copy of this flow with HA entities to stop charge/discharge from the HA dashboard, with state control and faster interval injections for faster reaction to changes in system like weather forecast. Also have another copy with experimental Solcast Forecast for weather to determine if we should charge batteries in the morning, or export to take advantage of FIT. But Solcast seems to be very optimistic about our power generation during crap weather so still in testing.

But for basic control - this is pretty decent.

Based on Amber Electric - historical pricing suggests we start discharging from 5PM, with max output of the batteries from 6-8pm. BYD HVM 11.0 Batteries have a max output of 4.5kW, so we can do that over the most lucrative 2 hours. After 8pm the price drops dramatically so we just use grid power from then.

No backup power available in blackouts with this setup…

[{"id":"59b5e396d0d948a3","type":"function","z":"3c4c24110b450887","name":"InWRte","func":"var values = [msg.StorCtl_Mod, (65535), (700), (10000), (65535), (65535), (5), (msg.OutWRte), (msg.InWRte)]\n\nmsg.payload = {\n    'value': values,\n    'fc': 16,\n    'unitid': 1,\n    'address': 40358,\n    'quantity': 9\n}\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1920,"y":820,"wires":[["beceba7f58b3cb02"]]},{"id":"7945a9c4ac053607","type":"inject","z":"3c4c24110b450887","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":900,"y":1180,"wires":[["3736c2dba1a5523c"]]},{"id":"51c5c216c0cabe54","type":"cronplus","z":"3c4c24110b450887","name":"Every Hour","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"schedule1","topic":"topic1","payloadType":"default","payload":"","expressionType":"cron","expression":"0 0 * * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":490,"y":880,"wires":[["0548b4b7a9faec3d"]]},{"id":"301866e71b6fb8e2","type":"inject","z":"3c4c24110b450887","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1000,"y":1340,"wires":[["31e1bf481cfbc41e"]]},{"id":"6119d9b8d8745466","type":"junction","z":"3c4c24110b450887","x":1820,"y":820,"wires":[["59b5e396d0d948a3"]]},{"id":"0548b4b7a9faec3d","type":"junction","z":"3c4c24110b450887","x":640,"y":880,"wires":[["f29f84c775e9a3d2","cf084153c1ce3374","29e36fab339f60e4","e0a33eb597a06aae","6d7f19ceaa5f1e72","3736c2dba1a5523c"]]},{"id":"8c91087419d01380","type":"group","z":"3c4c24110b450887","name":"Inverter with Battery Attached","style":{"label":true},"nodes":["180989e6b6be69e1","beceba7f58b3cb02","8257c587efbab683"],"x":2014,"y":739,"w":552,"h":142},{"id":"180989e6b6be69e1","type":"modbus-response","z":"3c4c24110b450887","g":"8c91087419d01380","name":"","registerShowMax":20,"x":2350,"y":780,"wires":[]},{"id":"beceba7f58b3cb02","type":"modbus-flex-write","z":"3c4c24110b450887","g":"8c91087419d01380","name":"Fronius-Storage","showStatusActivities":true,"showErrors":true,"showWarnings":true,"server":"bcc4229c.180ac","emptyMsgOnFail":true,"keepMsgProperties":true,"delayOnStart":false,"startDelayTime":"10","x":2120,"y":820,"wires":[["180989e6b6be69e1","8257c587efbab683"],[]]},{"id":"8257c587efbab683","type":"debug","z":"3c4c24110b450887","g":"8c91087419d01380","name":"Inverter MODBUS Response","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2390,"y":840,"wires":[]},{"id":"bcc4229c.180ac","type":"modbus-client","name":"Fronius 10kw","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":true,"queueLogEnabled":false,"failureLogEnabled":true,"tcpHost":"192.168.0.179","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true},{"id":"366015bdc9dea60f","type":"group","z":"3c4c24110b450887","name":"Get Batteries Charged before 2PM - Charge from Grid if needed","style":{"label":true},"nodes":["cf084153c1ce3374","8bf3fd6bab97b524"],"x":994,"y":739,"w":512,"h":82},{"id":"cf084153c1ce3374","type":"time-of-day","z":"3c4c24110b450887","g":"366015bdc9dea60f","name":"","startTime":"13:00:00","endTime":"14:00:00","outputs":1,"x":1090,"y":780,"wires":[["8bf3fd6bab97b524"]]},{"id":"8bf3fd6bab97b524","type":"function","z":"3c4c24110b450887","g":"366015bdc9dea60f","name":"Force Charge @ Max, No Discharge","func":"\nmsg.StorCtl_Mod = \"3\"\nmsg.OutWRte = \"60536\"\nmsg.InWRte = 5000\n\nmsg.newstate = \"forcechargeonly\"\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1330,"y":780,"wires":[["6119d9b8d8745466"]]},{"id":"772d1899edd388bd","type":"group","z":"3c4c24110b450887","name":"Normal Operation after 2PM","style":{"label":true},"nodes":["29e36fab339f60e4","4dc511900ee3a8c3"],"x":1034,"y":839,"w":392,"h":82},{"id":"29e36fab339f60e4","type":"time-of-day","z":"3c4c24110b450887","g":"772d1899edd388bd","name":"","startTime":"14:00:00","endTime":"17:00:00","outputs":1,"x":1130,"y":880,"wires":[["4dc511900ee3a8c3"]]},{"id":"4dc511900ee3a8c3","type":"function","z":"3c4c24110b450887","g":"772d1899edd388bd","name":"Normal Operation","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":1310,"y":880,"wires":[["6119d9b8d8745466"]]},{"id":"ea0485ab338948d8","type":"group","z":"3c4c24110b450887","name":"Discharge from 5PM","style":{"label":true},"nodes":["e0a33eb597a06aae","f941ac38c439226e"],"x":1034,"y":939,"w":372,"h":82},{"id":"e0a33eb597a06aae","type":"time-of-day","z":"3c4c24110b450887","g":"ea0485ab338948d8","name":"","startTime":"17:00:00","endTime":"18:00:00","outputs":1,"x":1130,"y":980,"wires":[["f941ac38c439226e"]]},{"id":"f941ac38c439226e","type":"function","z":"3c4c24110b450887","g":"ea0485ab338948d8","name":"1kW discharge","func":"\nmsg.StorCtl_Mod = \"3\"\nmsg.OutWRte = 1000\nmsg.InWRte = \"64536\"\n\nmsg.newstate = \"1kWdischarge\"\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1300,"y":980,"wires":[["6119d9b8d8745466"]]},{"id":"5fc2c48660c69235","type":"group","z":"3c4c24110b450887","name":"Operate Normally Overnight","style":{"label":true},"nodes":["3736c2dba1a5523c","d22a850f8aa56e06"],"x":1034,"y":1139,"w":392,"h":82},{"id":"3736c2dba1a5523c","type":"time-of-day","z":"3c4c24110b450887","g":"5fc2c48660c69235","name":"","startTime":"20:00:00","endTime":"10:00:00","outputs":1,"x":1130,"y":1180,"wires":[["d22a850f8aa56e06"]]},{"id":"d22a850f8aa56e06","type":"function","z":"3c4c24110b450887","g":"5fc2c48660c69235","name":"Normal Operation","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":1310,"y":1180,"wires":[["6119d9b8d8745466"]]},{"id":"031ad266c41484cd","type":"group","z":"3c4c24110b450887","name":"Manual Discharge Max Power","style":{"label":true},"nodes":["31e1bf481cfbc41e"],"x":1094,"y":1299,"w":212,"h":82},{"id":"31e1bf481cfbc41e","type":"function","z":"3c4c24110b450887","g":"031ad266c41484cd","name":"5kW discharge","func":"\nmsg.StorCtl_Mod = \"3\"\nmsg.OutWRte = 5000\nmsg.InWRte = \"60536\"\n\nmsg.newstate = \"5kWdischarge\"\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1200,"y":1340,"wires":[["6119d9b8d8745466"]]},{"id":"91f4bc2790dd081b","type":"group","z":"3c4c24110b450887","name":"Discharge from 6PM-8PM","style":{"label":true},"nodes":["6d7f19ceaa5f1e72","3fb0cffabe97a042"],"x":1034,"y":1039,"w":372,"h":82},{"id":"6d7f19ceaa5f1e72","type":"time-of-day","z":"3c4c24110b450887","g":"91f4bc2790dd081b","name":"","startTime":"18:00:00","endTime":"20:00:00","outputs":1,"x":1130,"y":1080,"wires":[["3fb0cffabe97a042"]]},{"id":"3fb0cffabe97a042","type":"function","z":"3c4c24110b450887","g":"91f4bc2790dd081b","name":"5kW discharge","func":"\nmsg.StorCtl_Mod = \"3\"\nmsg.OutWRte = 5000\nmsg.InWRte = \"60536\"\n\nmsg.newstate = \"5kWdischarge\"\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1300,"y":1080,"wires":[["6119d9b8d8745466"]]},{"id":"7696f6bac11b4d26","type":"group","z":"3c4c24110b450887","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["f29f84c775e9a3d2","2468d8245a765d21"],"x":1014,"y":619,"w":432,"h":82},{"id":"f29f84c775e9a3d2","type":"time-of-day","z":"3c4c24110b450887","g":"7696f6bac11b4d26","name":"","startTime":"05:00:00","endTime":"13:00:00","outputs":1,"x":1110,"y":660,"wires":[["2468d8245a765d21"]]},{"id":"2468d8245a765d21","type":"function","z":"3c4c24110b450887","g":"7696f6bac11b4d26","name":"Normal Operation","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":1330,"y":660,"wires":[["6119d9b8d8745466"]]}]
2 Likes

Hi Enoch,
I’m having the Gen24 10kW also, and the documents in the -zip file is identical to the file I’ve been using.

Are you sure, that you have subtracted 1 to the "A " colum (start)? Please also make sure, that your inverter is set up to either INT+SF or FLOAT and use the file according. The file I use is “Gen24_Primo_Symo_Inverter_Register_Map_Int&SF_storage.xlsx” - and my inverter is setup to int + SF

Hopefully it would work out :slight_smile: And the document Heyyiitsal is linking to, is good for understanding how the different registers work out together. Especially when you need to set power orders.
And also remember to set InOutWRte_RvrtTms = 0 (address 40358 on my inverter), else the StorCtrl_Mod cannot be changed and saved.

1 Like

OK, I will download it again. I’ve just setup the Energy Dashboard with Fronius, but I guess I’ll redo everything with Sunspec instead - it’s faster, it’s local, and hopefully more stable.

My current values from Fronius doesn’t match with the Energy dashboard, so well, I guess it’s another day of setup/installation. :nerd_face:

I have the exact same setup in regards of battery. My consumtion is pretty high during the day (not after I’m done tweaking hehe) so it doesn’t last a full day yet.

Here’s a graph from yesterday night when I was debuggning modbus. I ended up just putting a schedule on the battery instead:

image

I want to take down those peaks, but I’ll get there when everything is in place so that I can start tweaking.

Thanks for the Node-Red code. I don’t use it, but it seems like many here does, so maybe I should install it just to be able to copy paste and see what it’s all about. I’m on HAOS btw. :slight_smile:

Yes, I can both write and read, but it changes nothing irl. I will have another go at it today - hopefully my head is more clear now than at 2 AM in the morning. :slight_smile:

EDIT:

Also, quick question (haven’t read the docs yet), when setting up SunSpec, should I choose the default read models?

image