jmcollin78 / versatile_thermostat

A full featured Thermostat for Home Assistant: presets, window, motion, presence and overpowering management
MIT License
327 stars 34 forks source link

Wrong energy consumption reported by Versatile Thermostat #438

Closed nicolinuxfr closed 7 months ago

nicolinuxfr commented 7 months ago

Version of the custom_component

Latest version (6.2.1)

Configuration

My VTherm attributes are the following:

hvac_modes: heat, off
min_temp: 7
max_temp: 22
target_temp_step: 0.5
friendly_name: Salle de bain - chauffage
supported_features: 401
hvac_action: idle
preset_modes: none, frost, eco, comfort, boost, activity
temperature: 7
preset_mode: frost
is_on: true
hvac_mode: heat
is_controlled_by_central_mode: true
frost_temp: 7
eco_temp: 15
boost_temp: 19.5
comfort_temp: 17
frost_away_temp: 7
eco_away_temp: 11
boost_away_temp: 19
comfort_away_temp: 15
power_temp: 13
target_temperature_step: 0.5
ac_mode: false
saved_preset_mode: frost
saved_target_temp: 7
motion_sensor_entity_id: binary_sensor.salle_de_bains_mouvements
presence_sensor_entity_id: binary_sensor.maison_presence
window_state: off
window_auto_state: off
window_bypass_state: false
window_delay_sec: 30
window_auto_enabled: false
window_action: window_turn_off
security_delay_min: 120
security_min_on_percent: 0.5
security_default_on_percent: 0.1
last_temperature_datetime: 2024-04-05T13:32:22.558287+02:00
last_ext_temperature_datetime: 2024-04-05T13:36:40.894506+02:00
security_state: false
minimal_activation_delay_sec: 10
device_power: 2
mean_cycle_power: 0
total_energy: 142.8
last_update_datetime: 2024-04-05T13:36:40.897637+02:00
timezone: Europe/Paris
temperature_unit: °C
is_device_active: false
is_used_by_central_boiler: false
is_over_switch: true
is_inversed: false
keep_alive_sec: 0
underlying_switch_0: switch.salle_de_bain_radiateur
on_percent: 0
power_percent: 0
on_time_sec: 0
off_time_sec: 300
cycle_min: 5
function: tpi
tpi_coef_int: 0.6
tpi_coef_ext: 0.01
current_temperature: 20.1
ext_current_temperature: 15.8
presence_state: on
ema_temp: 20.1

Describe the bug

The energy consumption reported by Versatile Thermostat is wrong several times a day, for several days. I'm not sure when it began, but it seems to be regular now.

Here's what happens on the energy dashboard :

Capture d’écran 2024-04-05 à 13 30 20

In the statistic tools, the wrong value is easily findable now and it's always around 140 kWh, which seems to be around the total consumption of the device :

Capture d’écran 2024-04-05 à 11 26 05

Looking at the entity's history, I noticed some drop to 0, which coincides with the wrong value showing on the energy dashboard :

Capture d’écran 2024-04-05 à 12 06 26

Let me know if you need more information.

jmcollin78 commented 7 months ago

Hello @nicolinuxfr ,

Did you do something (in configuration, restart or whatever) when the drops to 0 occurs ? Of course I cannot reproduce this in normal conditions.

nicolinuxfr commented 7 months ago

@jmcollin78

You're right, I did not make the connection myself but I can reproduce : each time I restart Home Assistant, I have the bug. I think the kWh counter goes briefly to 0 during the process and then goes back to the previous value, causing the Energy dashboard to report hundreds of kWh in my case.

It's the only value in my energy dashboard acting this way, I'm not sure what could cause this on my end ?

jmcollin78 commented 7 months ago

Huuum ok. During loading it is possible that all sensors are not totally present and then power goes to 0 and than goes back to the correct value after loading is fully terminated. If it is the case, in your environment, you may use your own energy sensor and not the one of VTherm like I does, so that even if I reset the VTherm (recreate it or whatever) the energy is not resetted. To do that, you create a helper of type Riemann integral and give it the power (and not the energy) of the VTherm: mean_cycle_power.

This could help.

You can also do that by configuration, here is an example of my configuration (I don't use the power of the VTherm but the power given by the switch itself):

- platform: integration
  source: sensor.radiateur_entree_power
  name: energy_radiateur_entree
  unit_prefix: k
  unit_time: h
  method: left
nicolinuxfr commented 7 months ago

Thanks for your detailed answer.

I could do that, but I was wondering why it happens now and am I the only one ? Is there a bug somewhere on my setup ?

jmcollin78 commented 7 months ago

That is why I would recommend to investigate a little bit more. So many questions and not normal behavior.

ben-ty commented 7 months ago

Same issue here, it begin on my instance the 29 march (probably with update to version 6.1.0).

Trace in log : 2024-04-08 19:45:15.959 INFO (Recorder) [homeassistant.components.sensor.recorder] Detected new cycle for sensor.thermostat_chambre_enfant_energy, value dropped from 1517192.5 to 0.0, triggered by state with last_updated set to 2024-04-08T17:44:18.719915+00:00

afternet commented 7 months ago

Version of the custom_component

Latest version (6.2.1)

Configuration

My VTherm attributes are the following:

hvac_modes: heat, off
min_temp: 7
max_temp: 22
target_temp_step: 0.5
friendly_name: Salle de bain - chauffage
supported_features: 401
hvac_action: idle
preset_modes: none, frost, eco, comfort, boost, activity
temperature: 7
preset_mode: frost
is_on: true
hvac_mode: heat
is_controlled_by_central_mode: true
frost_temp: 7
eco_temp: 15
boost_temp: 19.5
comfort_temp: 17
frost_away_temp: 7
eco_away_temp: 11
boost_away_temp: 19
comfort_away_temp: 15
power_temp: 13
target_temperature_step: 0.5
ac_mode: false
saved_preset_mode: frost
saved_target_temp: 7
motion_sensor_entity_id: binary_sensor.salle_de_bains_mouvements
presence_sensor_entity_id: binary_sensor.maison_presence
window_state: off
window_auto_state: off
window_bypass_state: false
window_delay_sec: 30
window_auto_enabled: false
window_action: window_turn_off
security_delay_min: 120
security_min_on_percent: 0.5
security_default_on_percent: 0.1
last_temperature_datetime: 2024-04-05T13:32:22.558287+02:00
last_ext_temperature_datetime: 2024-04-05T13:36:40.894506+02:00
security_state: false
minimal_activation_delay_sec: 10
device_power: 2
mean_cycle_power: 0
total_energy: 142.8
last_update_datetime: 2024-04-05T13:36:40.897637+02:00
timezone: Europe/Paris
temperature_unit: °C
is_device_active: false
is_used_by_central_boiler: false
is_over_switch: true
is_inversed: false
keep_alive_sec: 0
underlying_switch_0: switch.salle_de_bain_radiateur
on_percent: 0
power_percent: 0
on_time_sec: 0
off_time_sec: 300
cycle_min: 5
function: tpi
tpi_coef_int: 0.6
tpi_coef_ext: 0.01
current_temperature: 20.1
ext_current_temperature: 15.8
presence_state: on
ema_temp: 20.1

Describe the bug

The energy consumption reported by Versatile Thermostat is wrong several times a day, for several days. I'm not sure when it began, but it seems to be regular now.

Here's what happens on the energy dashboard : Capture d’écran 2024-04-05 à 13 30 20

In the statistic tools, the wrong value is easily findable now and it's always around 140 kWh, which seems to be around the total consumption of the device :

Capture d’écran 2024-04-05 à 11 26 05

Looking at the entity's history, I noticed some drop to 0, which coincides with the wrong value showing on the energy dashboard :

Capture d’écran 2024-04-05 à 12 06 26

Let me know if you need more information.

a mi me pasa este mismo problema. he notado que al reiniciar HA me salen consumos de 20KWh o más en los dispositivos al verlos desde el panel de energía

This same problem happens to me. I have noticed that when I restart HA I get consumption of 20KWh or more in the devices when viewing them from the energy panel

sleveille4 commented 7 months ago

Same for me, upon restart, the energy meter for all versatile thermostats entity revert back to 0 then goes back up to their value, triggering a consumption spike in the energy dashboard here are the 2 energy entities recorded when a reboot happens image

sleveille4 commented 7 months ago

Huuum ok. During loading it is possible that all sensors are not totally present and then power goes to 0 and than goes back to the correct value after loading is fully terminated. If it is the case, in your environment, you may use your own energy sensor and not the one of VTherm like I does, so that even if I reset the VTherm (recreate it or whatever) the energy is not resetted. To do that, you create a helper of type Riemann integral and give it the power (and not the energy) of the VTherm: mean_cycle_power.

This could help.

You can also do that by configuration, here is an example of my configuration (I don't use the power of the VTherm but the power given by the switch itself):

- platform: integration
  source: sensor.radiateur_entree_power
  name: energy_radiateur_entree
  unit_prefix: k
  unit_time: h
  method: left

this would make sense as the last 2 major updates improved the startup time of HA, and for instance i had other issues where some integrations where now too fast to start , with the sensors or other devices not yet available (mainly my zigbee devices)

jmcollin78 commented 7 months ago

https://github.com/jmcollin78/versatile_thermostat/releases/tag/6.2.2