Skip to content

Separate Battery charge & discharge sensors

Thijs W edited this page Jan 2, 2024 · 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: "{{ -min(0, states('sensor.battery_charge_discharge_power') | float(0)) }}"