Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add battery sensors #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Duell10111
Copy link

Based on the PR #30 , but only with code to add the battery sensors to split this feature up.
Additionally I rebased it on the current master ;)

Already tested on new local SolarEdge installation 😊:

image

@Duell10111 Duell10111 mentioned this pull request Jun 1, 2022
@blowk
Copy link

blowk commented Jun 2, 2022

Hi, thanks for sharing the code.
I've just installed it and on SolarEdge SE4000H with an LG RESU10H Prime.
I got the following result:
image

Need to figure out the battery state code.
0 – Off; 1 – Standby; 2 – Init; 3 – Charge; 4 – Discharge; 5 – Fault; 7 - Idle
Don't know what state 6 means. Not active?

@Duell10111
Copy link
Author

Hi,
first of thanks for trying it out on your side. 😊
I must say, that I did not really debug the Battery state, since my battery showed yesterday only the statuscode 3 or 10.
Now it is also showing the state 6. 😅

@blowk
Copy link

blowk commented Jun 3, 2022

Don't know what statuscode 10 means.
If that happens, can you check what you get in MySolaredge app?

I've create some custom sensor.

  solaredge_battery_energy_flow:
    friendly_name: "Battery Energy Flow"
    value_template: "{{ state_attr('sensor.solaredge_modbus_battery', 'battery_power') }}"
    unit_of_measurement: 'W'
  solaredge_battery_percentage:
    friendly_name: "Battery Percentage"
    value_template: "{{ state_attr('sensor.solaredge_modbus_battery', 'battery_state_of_charge') | round(2) }}"
    unit_of_measurement: '%'
    icon_template: mdi:battery
  solaredge_battery_status:
    friendly_name: "Battery Status"
    value_template: >-
      {% if state_attr('sensor.solaredge_modbus_battery', 'battery_state') == 0 %}
        Off
      {% elif state_attr('sensor.solaredge_modbus_battery', 'battery_state') == 1 %}
        Standby
      {% elif state_attr('sensor.solaredge_modbus_battery', 'battery_state') == 2 %}
        Init
      {% elif state_attr('sensor.solaredge_modbus_battery', 'battery_state') == 3 %}
        Charge
      {% elif state_attr('sensor.solaredge_modbus_battery', 'battery_state') == 4 %}
        Discharge
      {% elif state_attr('sensor.solaredge_modbus_battery', 'battery_state') == 5 %}
        Fault
      {% elif state_attr('sensor.solaredge_modbus_battery', 'battery_state') == 6 %}
        Not active
      {% elif state_attr('sensor.solaredge_modbus_battery', 'battery_state') == 7 %}
        Idle
      {% else %}
        Unknown
      {% endif %}`

Only need to find out custom sensors to use in Energy Dashboard.
One for discharge and charge values.
Maybe battery_energy_discharged_sum and battery_energy_charged_sum but I think those values are daily values.

@Duell10111
Copy link
Author

Sadly the code did not happen again as long as I looked it my values.
But if it happen again I will look into it 😊

@blowk
Copy link

blowk commented Jul 25, 2022

I added two other sensor templates with it.
This can be used in the Energy dashboard to see what has been charged and discharged from battery.
In may case when first installed, those values where daily values and now has changed to total values after an update from SolarEdge.

      solaredge_battery_energy_discharged_sum:
        friendly_name: "Battery Energy Discharged"
        value_template: "{{ (state_attr('sensor.solaredge_modbus_battery', 'battery_energy_discharged_sum') / 1000.0) | round(2) }}"
        unit_of_measurement: 'kWh'
      solaredge_battery_energy_charged_sum:
        friendly_name: "Battery Energy Charged"
        value_template: "{{ (state_attr('sensor.solaredge_modbus_battery', 'battery_energy_charged_sum') / 1000.0) | round(2) }}"
        unit_of_measurement: 'kWh'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants