Skip to content
Luis Miranda edited this page Jun 15, 2022 · 8 revisions

Suggested sensor configurations

Some example sensor configurations to get you started with the Wibeee integration in Home Assistant.

Power sensors

Wibeee exposes *_active_power (a non-negative number) and *_power_factor (ranging from -1 to 1) but if we want a single sensor that has positive (when importing from the grid) and negative (when exporting to the grid) we need to create a new Template sensor.

We also create two separate sensors for integrations that expect non-negative numbers, one for importing from the grid and another for exporting to the grid. We will end up with three sensors::

  • grid_import_export_powerthe active power (+/- depending on energy flow from or to the grid)
  • grid_import_power the active power when importing from the grid (0 otherwise)
  • grid_export_power the active power when exporting to the grid (0 otherwise)

In the examples below make sure to substitute phase4 for the desired phase.

sensor:
  - platform: template
    sensors:
      #####################
      # Power sensors (W) #
      #####################
      grid_import_export_power:   
        friendly_name: "Grid import(+) or export(-) power"
        device_class: power
        unit_of_measurement: 'W'
        value_template: >-
            {% if states('sensor.wibeee_phase4_power_factor') | float < 0 %}
              {{ states('sensor.wibeee_phase4_active_power') | float * -1 | round(0) }}
            {% else %}
              {{ states('sensor.wibeee_phase4_active_power') | float | round(0) }}
            {% endif %}
      grid_import_power:
        friendly_name: "Grid import power"
        device_class: power
        unit_of_measurement: 'W'
        value_template: "{{ [states('sensor.grid_import_export_power') | float, 0] | max | round(0) }}"
      grid_export_power:
        friendly_name: "Grid export power"
        device_class: power
        unit_of_measurement: 'W'
        value_template: "{{ [states('sensor.grid_import_export_power') | float, 0] | min | abs | round(0) }}"

Energy sensors

Power sensors give us an instant value of power being imported or exported but not the total amount of energy in kWh. To calculate the energy we will use the integration platform to calculate the Riemann Sum of the power series.

sensor:
  ########################
  # Energy sensors (kWh) #
  ########################
  - platform: integration
    source: sensor.grid_import_power
    name: grid_import_energy
    unit_prefix: k
    round: 2
  - platform: integration
    source: sensor.grid_export_power
    name: grid_export_energy
    unit_prefix: k
    round: 2

The above sensors can be used in the your Energy Configuration to integrate with Home Energy Management.

Clone this wiki locally