Really? It says “The integration sensor is updated upon changes of the source” in the docs. Meaning, if I create a new integration sensor at the end of the day and set the source to a sensor that has been producing values all day, they are not picked up and retroactively consumed by the integration sensor, no? I just tried that and the value of the integration is 0.
Ah, yeah, I’m mixing up the integrations. So no, you can’t use historical data.
Appreciate all your replies, In my country the tariffs depends on consumed KW/h as follows:
1-160 = 0.33
161-300 = 0.72
301-500 = 0.86
501-600 = 1.14
601-750 = 1.58
751-1000 = 1.88
1001 and above = 2.65
My question is can we use Utility Meter to do such math? I already have sonoff POW R2 which has a sensors for current, voltage and watts.
Hello,
I was make:
ups_realtime_power_w:
friendly_name: "UPS Realtime Power W"
unit_of_measurement: "W"
value_template: >-
{% set V = states('sensor.ups_smart_input_voltage') | float %}
{% set A = states('sensor.ups_smart_output_current') | float %}
{{ (0,8 * A * V) | round(2) }}
ups_realtime_power_kw:
friendly_name: "UPS Realtime Power kW"
unit_of_measurement: 'kW'
value_template: >-
{% set W = states('sensor.ups_realtime_power_w') | float %}
{{ W / 1000 }}
- platform: integration
source: sensor.ups_realtime_power_w
name: Energy Spent UPS
unit_prefix: k
method: trapezoidal
round: 2
- platform: statistics
name: UPS kW Daily
entity_id: sensor.ups_realtime_power_w
sampling_size: 100
max_age:
hours: 24
But power in W is wrong
Why ?
Jinja uses periods for numbers, not commas.
0.8
THX!! Working
Hi,
I have a energy meter (Tibber Pulse) which provides me with the total consumption and works well being integrated to Home Assistant.
In addition I have my heatpump from Nibe integrated to Home Assistant, and my intention is to track the Nibe heatpump as an individual device from a power consumption perspective.
The Nibe integration provides me with the current per phase and the energy meter give me voltage per phase and power factor.
From this thread, I have created a sensor and an integration (and yes the phases may seem mixed, they are not). My configuration.yaml contains the following:
sensor:
- platform: template
sensors:
heatpump_power_watts:
friendly_name: "Heatpump Power Watts"
unit_of_measurement: 'W'
value_template: >
{% set PF = states('sensor.power_factor_oland') | float %}
{% set V1 = states('sensor.voltage_phase1_oland') | float %}
{% set V2 = states('sensor.voltage_phase2_oland') | float %}
{% set V3 = states('sensor.voltage_phase3_oland') | float %}
{% set BE1 = states('sensor.nibe_94720_40083') | float %}
{% set BE2 = states('sensor.nibe_94720_40081') | float %}
{% set BE3 = states('sensor.nibe_94720_40079') | float %}
{{ ((PF/100*BE2*V1)+(PF/100*BE1*V2)+(PF/100*BE3*V2)) | round(2) }}
- platform: integration
source: sensor.heatpump_power_watts
name: Energy Spent Heatpump
unit_prefix: k
method: trapezoidal
round: 2
As you can see below, the sensor integration provides relevant data:
However, I cannot get it integrated as individual device:
When attempting to add it, it does not show in the list:
I’ve tried to google and read, but I apparently miss something basic. Appreciate guidance and directions (and obvious corrections).
Thanks, Marcus
Solved after some more googling.
By adding device_class: power
to the sensor, then the Integration - Riemann sum integral will generate an device_class: energy
sensor.
I.e.:
sensor:
- platform: template
sensors:
heatpump_power_watts:
friendly_name: "Heatpump Power Watts"
unit_of_measurement: 'W'
device_class: power
value_template: >
{% set PF = states('sensor.power_factor_oland') | float %}
{% set V1 = states('sensor.voltage_phase1_oland') | float %}
{% set V2 = states('sensor.voltage_phase2_oland') | float %}
{% set V3 = states('sensor.voltage_phase3_oland') | float %}
{% set BE1 = states('sensor.nibe_94720_40083') | float %}
{% set BE2 = states('sensor.nibe_94720_40081') | float %}
{% set BE3 = states('sensor.nibe_94720_40079') | float %}
{{ ((PF/100*BE2*V1)+(PF/100*BE1*V2)+(PF/100*BE3*V2)) | round(2) }}
- platform: integration
source: sensor.heatpump_power_watts
name: Energy Spent Heatpump
unit_prefix: k
method: trapezoidal
round: 2
/Marcus