Skip to content
Luis Miranda edited this page Nov 3, 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_power is the active power (+/- depending on energy flow from or to the grid)
  • grid_import_power is the active power being imported from the grid
  • grid_export_power is the active power being exported to the grid

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

template:
  sensor:
    - unique_id: grid_import_export_power
      device_class: power
      unit_of_measurement: 'W'
      state_class: measurement
      state: >-
        {% 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 %}
      availability: "{{ not states('sensor.wibeee_phase4_active_power') in ('unavailable', 'unknown') and not states('sensor.wibeee_phase4_power_factor') in ('unavailable', 'unknown') }}"
      attributes:
        friendly_name: "Grid import(+) or export(-) power"
    - unique_id: grid_import_power
      device_class: power
      unit_of_measurement: 'W'
      state_class: measurement
      state: "{{ [states('sensor.template_grid_import_export_power') | float, 0] | max | round(0) }}"
      availability: "{{ not states('sensor.template_grid_import_export_power') in ('unavailable', 'unknown') }}"
      attributes:
        friendly_name: "Grid import power"
    - unique_id: grid_export_power
      device_class: power
      unit_of_measurement: 'W'
      state_class: measurement
      state: "{{ [states('sensor.template_grid_import_export_power') | float, 0] | min | abs | round(0) }}"
      availability: "{{ not states('sensor.template_grid_import_export_power') in ('unavailable', 'unknown') }}"
      attributes:
        friendly_name: "Grid export power"

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.template_grid_import_power
    name: grid_import_energy
    unit_prefix: k
    round: 2
  - platform: integration
    source: sensor.template_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