Skip to content

Separate Battery charge & discharge sensors

Andurill edited this page Dec 1, 2023 · 7 revisions

This sensors report only the current charge power or current discharge power of the Battery. Usefull for making nice graphs.

# Sensor that reports the battery charge power - sensor: - name: "Battery Charge Only" unique_id: "battery_charge_only" unit_of_measurement: "W" device_class: power state_class: measurement state: "{{ max(0, states('sensor.battery_charge_discharge_power') | float(0)) }}"

# Sensor that reports the battery discharge power - sensor: - name: "Battery Discharge Only" unique_id: "battery_discharge_only" unit_of_measurement: "W" device_class: power state_class: measurement state: >- {% set batterypower = states('sensor.battery_charge_discharge_power') | float %} {% if batterypower < (0) %} {{ batterypower * -1 }} {% else %} {{ 0 }} {% endif %}