Starting a new thread as this was getting lost in the Hints, Tips & Troubleshooting thread.
Post details of your integration with Home Assistant etc.
Right, what I'm actually looking for is code, i.e. whatever is behind producing the entities shown here: https://www.boards.ie/discussion/comment/118887422/#Comment_118887422. Would be great if it could be shared rather than being left to re-invent the wheel.
That's actually coming from node-red https://flows.nodered.org/flow/1a1e2bac1ecfe8f40527ad930fe788f0
Aha, ok, and that's cloud scraping which is not ideal. So is anyone pulling MODBUS data and displaying it in HA? If so, could you share your code? Not just the libraries, but the actual implementation.
Read back through the thread. Local Modbus polling via the Solarman V5 protocol is what is being worked on at the moment. My PR adding the groundwork for Solis integration to the existing Solarman local polling integration was merged yesterday. I'm working on mapping the registers at the moment.
If you're happy with Cloud scraping, just use this integration and be done with it.
Thanks, I pulled that repo out as one to dig into. Definitely not happy with cloud scraping, I'm polling my own inverters over modbus already. It'll be a week or so until I get a machine on the network with the inverter but once I do I can help out.
Don't use the v2 one, the old platform always falls behind with updating, sometimes a full day of bad values until it refreshes.
Works fine for me for now since I have 1 min updates in Solis cloud and I will probably set the modbus ones to refresh around the same.
Bit slow for me, I'm reading my inverters every 5 seconds. All about that fine grained power usage.
I used to do that but that results in a lot of data and honestly I have no real use for that granularity. I do it every 30s and that is sufficient for my automations. Although I do admin data is addictive. :)
My shellyem does real time monitoring for me.
Not sure I can see you pulling data every 5 seconds via pymodbus wifi if reading a lot of registers.
Both the SolaX and SolarEdge MODBUS readers do it via a multi-register read function, not sure of the details but Home Assistant's built in MODBUS sensor can do it. Here's a sample: https://github.com/wills106/homeassistant-config/blob/51552bc99efa1b1de1d8f1675d6fde8193a75387/packages/solax_x1_hybrid_g3_group_read_pre_2021_7.yaml#L29. There's a native python version too: https://github.com/wills106/homsassistant-solax-modbus/blob/main/custom_components/solax_modbus/__init__.py#L232
I'm Polling my inverter every 10 seconds via wifi, and it seems fine,
The rest of my system is setup for about 10 seconds too.
As mine is just a normal inverter, they had different addresses, all im pulling is the string voltages, current, grid, temp, AC power and DC Power.
Im just triggering the script from nodered and processing the output Json then into mqtt.
I have a Home assistant instance running but havent really dug into it yet. Mostly working in emoncms.
+1 Same here.
I'm polling the inverter every 10 seconds from a script outside HA, and publishing via mqtt. Was doing every 5 secs for a period previously too, and no issues so far. On Solis hybrid 5G.
Also polling MyEnergi every 10 seconds to get Eddi heater loads/totals and publishing that via mqtt. Using https://github.com/CJNE/pymyenergi, keeping same MyenergiClient/Connection between invocations (lib modified locally to extract independent history for heater1 and heater2, so can use as Appliance1/2 in tesla-style-card)
Why go through hoops of python->mqtt->HA when you can just use the existing HA integration (which you could also modify)? https://github.com/CJNE/ha-myenergi. Less moving parts.
Easier modify. It didn't give what I needed out of the box. Would have had to modify both HA and the lib to get it.
Also, have all the infrastructure in place already for other events so was easy. And I find running outside HA is so much easier/less finicky to setup, debug, etc...
Does any inverter provide the ability to control the charging of a battery via an API ? For example if tomorrow is promised sunny can you set your battery to charge to x percent over night, but if tomorrow is expected to be cloudy you would fully charge your battery at offpeak rates ?
I don't think so out-of-the-box.
I am currently doing it with Node-Red to my Sofar ME3000 Storage Inverter.
The RS485:port is connected to an sofar2mqtt which sends the data to Node-Red - and receives instructions back. The ME3000 is set to passive mode, which allows commands to then be sent to the inverter.
So it can be told to start charging at midnight, and stop when SOC% reaches xx%, discharge overnight or go into Standby unit maybe 09:00.
So passive mode turns the inverter into a dumb device. You can tell the inverter to Charge, Discharge, or go into Auto or Standby.
I also use Node-Red to control my Eddi and Zappi, only turning them on when my batteries SOC hits 98%
Very interesting thanks ! I have been given the option of a solis, goodwee or a Huawei Inverter.
Afaik with the solis inverter the api doesn't support this capability, so I need to see what type of api the other two have.
You can interface with the solis over modbus though the wifi module (over IP)
You can change most if not all of the settings on the hybrids
I have the Huawei SUN 2000, you need a higher level account (installer) on fusion solar to mess w/ the battery config. Mine is set for time of use (TOU) and you can configure what times it charges from the grid and what time it discharges.
Right now I have it discharging all teh time except Saturdays (BG smart tariff with a free weekend day), so I draw from the grid on saturdays even if the battery is full. You can't set "50%" but you can set it to charge from the grid for an hour or so, and that's the same. The 5kW takes ~2h to charge.
Yup the GivEnergy ones have a nice (new) API where you can query and modify settings.
GivEnergy API Documentation (v1.5.2)
I actually still use the old API, but it doesn't look that much difficult to swap. I'll probably keep using the old API until they deprecate it and break me and then I'll have to get off my arse and migrate to the new one :-)
I had a look at trying to read data over modbus via a PLC that I have on my network on port 502. I can ping the wifi stick (192.168.8.100) and have my PLC at (192.168.8.101).
does below look right?
I would say the main reason for not allowing remote control is security. The other thing is that the communication between inverter and cloud is not direct and instant. Since inverters are connected to the cloud it is ussually one way street, the data is going out. There is no direct connection to the inverter from outside unless you configure port forwarding(security risk). Solis has OTA firmware upgrades but in this case inverter still initiating the connection at certain time and checks if there is a firmware available for it in the cloud.
It is still possible to control solis settings through modbus using Solarman V5. I have posted earlier my code https://github.com/NosIreland/solismod that allows to modify modbus registers remotely. It subscribes to mqtt topics that you define and then makes changes in inverter. I use node-red to send desired mqtt topics to broker. I use it to change charging intervals and charging current based on next days weather forcast.
No. It isn't Modbus TCP. It's Modbus RTU encapsulated in the proprietary Solarman V5 protocol.
Check out pysolarmanv5 which handles the encapsulation for you.
Ah Ok, that a pity. I could remove the cloud service and connect to my PLC over RS485 but ideally would like to hold onto the app for remote viewing.
I'm not one bit familiar with python but what would be the best/easiest way to add this to my HA.
I have HA running on Windows 10 VM on a QNAP NAS
Read back the last two pages of this thread.
Hi All,
Just got Jonathan's pysolarmanv5 running - and can query the registers of my solis inverter (starting at 33000..).
To get this integrated into HA are these the options as it stands:
(Jesus formatting is a dose on this new site, tried to simply have an indented list and couldn't get it to work....)
See page 1 of this thread. @reklamos shared a script that pulls from pysolarmanv5 and publishes via mqtt
Hey guys is there a register for PV1 and PV2 power or just have to get it by pv1 A * pv1 V?
Couldn't get @reklamos' register writing to work for my Solis inverter. Wasn't able to scan the registers properly.
Was chancing a 'modbus.read_input_register_formatted(register_addr=43144, quantity=1)' to see if I can also modify my charging times, but it's throwing the below.
Will crawl into the attic like an animal so! :D
Exception has occurred: error
unpack requires a buffer of 2 bytes
File "C:\Users\home\Python\solismon3\pysolarmanv5\pysolarmanv5.py", line 154, in _get_modbus_response
modbus_values = rtu.parse_response_adu(mb_response_frame, mb_request_frame)
File "C:\Users\home\Python\solismon3\pysolarmanv5\pysolarmanv5.py", line 199, in read_input_registers
modbus_values = self._get_modbus_response(mb_request_frame)
File "C:\Users\home\Python\solismon3\pysolarmanv5\pysolarmanv5.py", line 212, in read_input_register_formatted
modbus_values = self.read_input_registers(register_addr, quantity)
File "C:\Users\home\Python\solismon3\client_example.py", line 17, in main
data = modbus.read_input_register_formatted(register_addr=43143, quantity=1)
File "C:\Users\home\Python\solismon3\client_example.py", line 45, in <module>
main()
Not on the Solis, no. Either multiply them, or use the total DC power for all strings in 33057/33058.
I pushed my draft yaml to GitHub yesterday. Have a few more changes to make before I file a PR, but it should be good enough for testing.