your value “40” must be read decimal, which is 0010 1000 binary or 0x28 hexadecimal
the first one from the left corresponds to the “importing power flag”
- name: “Importing power”
unique_id: “sg_importing_power”
state: >
{{ states(‘sensor.running_state’)|int(default=0)|bitwise_and(0x20) > 0 }}
The second 1 shows, if the load is active or reactive (personally, I never saw a reason why anyone should know that, so I did not implement this)
looks like it should be working … haha
Please go to: Developer Tools → Statistics
is there anything related to the export power sensor?
Thanks for the hint to have a look at statistics. I’m new to HA, coming from OH. Anyway, I found two sensors with the same name and deleted the zombie and voilá it is working again.
Nice work! BR
I have a recently installed PV , with sh-5.0rs and sungrow battery. The Ethernet connection with cable but for the Wi-net .
I used the code done By mkai, many thanks to you, and it works well in a LOT of registers. But i had problems with sensor. running_state for evaluating the charge/discharge of battery , exporting/ importing… I solved evaluating vàlues like sensor.total_dc_power for detect in what mode is the inverter.
If someone is interested I can Share MY modifications.
Hi, the easiest solution would be to connect the LAN to the dedicated LAN Port, because some modbus registers can’t be read over WiNet, even if it is connected via hardwired LAN.
However, for the community it would be interesting, if there is a workaround.
I have found that my inverter is flooding my HA log.
When battery is discharging sg_running_state is changing value every few minutes. Stating that inverter is importing power or exporting power for 10 seconds (the register read intervall).
This happens at a short interval of a few minutes. Not a constant interval. Varies from 2 to > 15 minutes.
Is this normal behavior? Or is something wrong with my inverter configuration?
Maybe someone could check the HA logs when battery is discharging. Did this happen to you also?
I am stuck here, too! When I unplug the LAN-Cable from the “WLAN-Port” and put it into the LAN-Port, I don´t get any new IP-Address in my router. Even restarting the router doesn´t help.It seems as if the LAN-Port is dead. Do I have to “activate” it somewhere?
May be 2 points you can check: restart the inverter by shutting down DC, Battery, and AC. I seem to recall that the internal restart from web interface was not sufficient to trigger DHCP. Second, I think you have to activate modbus operation within the local web interface (depending on the firmware). May be that helps?!
?
For me it did run out of the box, except I had an issue with the wire, which I fixed. Also, my inverter had to be substituted due to a malfunctioning communication module which only affected the energy meter.
I tried again last night via the local access. here, i have all the options, too. After several reboots of inverter and router i finally received all three IP-adresses. I cannot exactly say, what helped in the end, but I guess it was the fix ip (other than DHCP). It works fine now.
Thanks for your efforts an support!
Please follow the instructions here and let me know, at which point you have questions. Then I will update the documentation. I want it to be self-explanatory, but as a creator of things you get easily lost in details and things get hard to explain to not-yet-knowing-people
No m8, I did not. I experienced another issue after rebooting my NUC with Home Assistant. I could not reach it anymore over gui. Then I figured out that it may be related to added ssl part of the code, so I acceseed it over https:// and did not try anything from that point. Modbus_sungrow.yaml is just downloaded, so I don’t think I could mess the formatting in it.
Best regards.