Who likes (to resolve) my energy integration riddle ðŸ¤ª

Hi,

I hope I can excite someone with this puzzle which I try to resolve. For sure we all know the feeling that you go around in circles and you canâ€™t either see the fault nor the solution.

Here it is: I have a few larger energy consumers in the house which I like to track in terms of running hours (h) and energy consumption (kWh).

Here I like to show you 2 examples ( Pool Pump, Game Room Ventilator) which have been programmed exactly identical but one works well (pool pump) and one doesnâ€™t at all(ventilator).

First of all I create a numeric sensor to give a value when the pump or ventilator is running:

``````#---------------------------------------------------------------------------------------------------------------------------------------Running hours prep
ventilator_game_room: # state switch to numeric value 1 = on, 0 = off
friendly_name: Ventilator Game Room
value_template: >-
{% if is_state("switch.sonoff_1000a012cb", "on" ) %}
1.0
{% else %}
0.0
{% endif %}
pool_pump: # state switch to numeric value 1 = on, 0 = off
friendly_name: Pool Pump
value_template: >-
{% if is_state("switch.sonoff_1000bee815", "on" ) %}
1.0
{% else %}
0.0
{% endif %}
``````

I do the same to determine the power (just multiply by the Watts used. I donâ€™t have an actual power measurement sensor, but I know what the Wattage is approx when running):

``````      kw_ventilator_game_room: # state switch to numeric value 56.0 = on, 0 = off
friendly_name: kW Ventilator Game Room
unit_of_measurement: 'W'
unique_id: kw_vntltr_gm_rm
device_class: power
value_template: >-
{% if is_state("switch.sonoff_1000a012cb", "on" ) %}
56.0
{% else %}
0.0
{% endif %}
kw_pool_pump: # state switch to numeric value 1.4 = on, 0 = off
friendly_name: kW Pool Pump
unit_of_measurement: 'kW'
unique_id: kw_pl_pmp
device_class: power
value_template: >-
{% if is_state("switch.sonoff_1000bee815", "on" ) %}
1.400
{% else %}
0.0
{% endif %}
``````

These sensors I use as source for a Riemann Intergration (I know it could be done as well by running hours * Watts, but I wanted to use the Riemann for the energy calculation):

``````  - platform: integration
source: sensor.ventilator_game_room
name: Cum Running Hours Ventilator Game Room
method: left
unique_id: cm_rnng_hrs_vntltr
round: 1
- platform: integration
source: sensor.kw_ventilator_game_room
name: Cum kWh Ventilator Game Room
unit_prefix: k
method: left
unique_id: cm_kwh_vntltr
round: 3
- platform: integration
source: sensor.pool_pump
name: Cum Running Hours Pool Pump
method: left
unique_id: cm_rnng_hrs_pl_pmp
round: 1
- platform: integration
source: sensor.kw_pool_pump #1400W
name: Cum kWh Pool Pump
method: left
unique_id: cm_kwh_pl_pmp
round: 3
``````

Those sensors I use in the utility meter integration both for running hours and Energy:

``````utility_meter:
# Running Hours
running_hours_pool_pump:
source: sensor.cum_running_hours_pool_pump
unique_id: rnng_hrs_pl_pmp
cycle: yearly
running_hours_ventilator_game_room:
source: sensor.cum_running_hours_ventilator_game_room
unique_id: rnng_hrs_vntltr_gm_rm
cycle: yearly
``````

and kWh:

``````# Energy Consumption
util_kwh_cons_vntltr_hourly:
source: sensor.cum_kwh_ventilator_game_room
cycle: hourly
unique_id: cm_kwh_vntyltr_gm_rm_hr
util_kwh_cons_vntltr_daily:
source: sensor.cum_kwh_ventilator_game_room
cycle: daily
unique_id: cm_kwh_vntyltr_gm_rm_dy
util_kwh_cons_vntltr_monthly:
source: sensor.cum_kwh_ventilator_game_room
cycle: monthly
unique_id: cm_kwh_vntyltr_gm_rm_mnth
util_kwh_cons_vntltr_yearly:
source: sensor.cum_kwh_ventilator_game_room
cycle: yearly
unique_id: cm_kwh_vntyltr_gm_rm_yr

util_kwh_cons_pl_pmp_hourly:
source: sensor.cum_kwh_pool_pump
cycle: hourly
unique_id: cm_kwh_pl_pmp_hr
util_kwh_cons_pl_pmp_daily:
source: sensor.cum_kwh_pool_pump
cycle: daily
unique_id: cm_kwh_kwh_pl_pmp_dy
util_kwh_cons_pl_pmp_monthly:
source: sensor.cum_kwh_pool_pump
cycle: monthly
unique_id: cm_kwh_kwh_pl_pmp_mnth
util_kwh_cons_pl_pmp_yearly:
source: sensor.cum_kwh_pool_pump
cycle: yearly
unique_id: cm_kwh_kwh_pl_pmp_yr
``````

Well the spooky thing is that the pool pump works as a charm but the ventilators consistently failsâ€¦
The attentive reader might have seen that the only difference between the two is the unit_prefix but I have tried it without as well with no result. If I check the values of the first sensors measuring the running state for both works fine ( returns 1.0 and 56W respectively 1.4 kWh )

However the utility figures donâ€™t work for the ventilator. The pool pump returns are perfect. if it runs 2 hours then I get 2 hours in the utility meter plus 2.8kWh energy consumption. For the ventilator is a non explainable figure: see screen shots. In this case the ventilator ran for 4 hours but the utility-meter only gives 0,10h and energy 0,008kWh. I attached some screenshots to demonstrate the numbersâ€¦

Another strange issue is that the number in the second picture is 0,008kWh but in the graph it is represented as 0,010 (rounding issue?)

For sure I miss something. I donâ€™t consider myself as a noobie anymore but I stay humble in this case I need helpâ€¦