Closed Lempomat closed 1 year ago
Hi, so i checked the sensors and I changed this:
- name: Battery charging
unique_id: sg_battery_charging
availability: >-
{{states('sensor.battery_power_raw')|is_number and
states('sensor.total_dc_power')|is_number and
states('sensor.load_power')|is_number
}}
state: >-
{% if ( ( states('sensor.total_dc_power')|int > states('sensor.load_power')|int ) ) and states('sensor.battery_power_raw')|int > 0 %}
{# more power generated than consumed. assuming battery charging #}
On
{% else %}
Off
{% endif %}
- name: Battery discharging
unique_id: sg_battery_discharging
availability: >-
{{states('sensor.battery_power_raw')|is_number and
states('sensor.total_dc_power')|is_number and
states('sensor.load_power')|is_number
}}
state: >-
{% if ( ( states('sensor.total_dc_power')|int < states('sensor.load_power')|int ) ) and states('sensor.battery_power_raw')|int > 0 %}
{# more power consumed than generated and some battery power --> assuming battery discharging #}
On
{% else %}
Off
{% endif %}
So this worked for me.
Hi,
I can't comprehend, what was your issue with the two template sensors and how your removal of the case decisions regarding the forced charge / discharge fixed the issue (without this the sensors are giving a false status in forced mode)
Can you give me more information? I guess you are using an RS inverter, that does not support the running_state, because you removed it from the template sensor.
Hi, so the two entities had no values, because some configured entities had not the values that you defined in your "if" statements. The above configuration that I changed works correctly for me. So everything is now fine 😄
But now I am curious - which sensors did not work in the first place?
Hi,
"Battery charging Power" and "Battery discharging Power"
After I changed the if condition by this entities it worked.
Hi, first of all, thanks a lot for your modbus script. I have a problem with the "Battery charging Power" and "Battery discharging Power". I see only 0KW... The "Battery Row" value works.![image](https://github.com/mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant/assets/107390420/893087ee-a030-4c76-a90e-7d2d9b2e5e9c)
Have you got an idea?