Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Total energy wrong when using multiple entities with one thermostat #877

Open
rogor opened this issue Jan 30, 2025 · 3 comments
Open

Total energy wrong when using multiple entities with one thermostat #877

rogor opened this issue Jan 30, 2025 · 3 comments
Labels
bug Something isn't working P1 Priority 1 question Further information is requested

Comments

@rogor
Copy link

rogor commented Jan 30, 2025

Hello!

Version of the custom_component

7.1.6

Configuration

My VTherm attributes are the following:

hvac_modes: heat, off
min_temp: -10
max_temp: 50
target_temp_step: 0.1
preset_modes: none, frost, eco, comfort, boost
current_temperature: 17.1
temperature: 17
hvac_action: idle
preset_mode: comfort
is_on: true
hvac_mode: heat
type: null
is_controlled_by_central_mode: false
last_central_mode: null
frost_temp: 1
eco_temp: 14
boost_temp: 18
comfort_temp: 17
frost_away_temp: 1
eco_away_temp: 14
boost_away_temp: 14
comfort_away_temp: 14
target_temperature_step: 0.1
ext_current_temperature: 9.1
ac_mode: false
saved_preset_mode: comfort
saved_target_temp: -10
saved_hvac_mode: null
last_temperature_datetime: 2025-01-30T14:36:09.920502+01:00
last_ext_temperature_datetime: 2025-01-30T14:23:11.102684+01:00
minimal_activation_delay_sec: 10
total_energy: 15.49
last_update_datetime: 2025-01-30T14:46:45.854376+01:00
timezone: Europe/Paris
temperature_unit: °C
is_device_active: false
device_actives: 
nb_device_actives: 0
ema_temp: 17.2
is_used_by_central_boiler: false
temperature_slope: -0.26
hvac_off_reason: null
max_on_percent: null
have_valve_regulation: false
last_change_time_from_vtherm: 2025-01-29T21:37:17.188137+01:00
presence_sensor_entity_id: binary_sensor.maison_occupee
presence_state: on
is_presence_configured: true
power_sensor_entity_id: null
max_power_sensor_entity_id: null
overpowering_state: unavailable
is_power_configured: false
device_power: 3
power_temp: null
current_power: null
current_max_power: null
mean_cycle_power: 0.09
motion_sensor_entity_id: null
motion_state: unavailable
is_motion_configured: false
motion_delay_sec: 0
motion_off_delay_sec: 0
motion_preset: null
no_motion_preset: null
window_state: off
window_auto_state: unavailable
window_action: window_turn_off
is_window_bypass: false
window_sensor_entity_id: input_boolean.fenetre_ouverte
window_delay_sec: 30
window_off_delay_sec: 30
is_window_configured: true
is_window_auto_configured: false
window_auto_open_threshold: null
window_auto_close_threshold: null
window_auto_max_duration: null
is_safety_configured: true
safety_state: off
safety_delay_min: 60
safety_min_on_percent: 0.7
safety_default_on_percent: 0.2
is_over_switch: true
is_inversed: true
keep_alive_sec: 0
underlying_entities: switch.0xa4c1389b5c1b7201, switch.0xa4c138283a9ac34a
on_percent: 0.03
power_percent: 3
on_time_sec: 37
off_time_sec: 1162
cycle_min: 20
function: tpi
tpi_coef_int: 0.6
tpi_coef_ext: 0.01
calculated_on_percent: 0.03
friendly_name: VTherm Salon/Salle à manger
supported_features: 401

Describe the bug

The documentation for the basic settings says "If multiple devices are linked to the same VTherm, specify the total maximum power of all devices here".
But I've noticed that my energy values was way too high compared to what it should be.
Example graph:
Image
The device power (total for 2 heaters) is 3kW, so the energy value would be at 15kWh if the heater was on non-stop for 5 hours. But you can see in this graph that it reached 15kWh after 5 hours while being on only about half the time.

I think I've found why:
I've checked the code a little bit, and I've found that the call to incremente_energy() is done in the UnderlyingSwitch class, which means that it is called separately for each underlying switch. So in my case, it's called twice (one for each switch), so the energy value is double what it should be.

So either the documentation is wrong and we should put as the device power be the average device power between all the heaters used, or the incremente_energy() should divide the added energy by the number of switches used before adding it to the total.

I hope I was clear :)
Thanks!

@rogor
Copy link
Author

rogor commented Jan 30, 2025

I also just noticed that when manually stopping a cycle (by changing to a different preset for example), the energy used in the previous cycle is not added to the total. Given that you don't seem to store the date/time of the start of a cycle I'm not sure you could simply fix that.

I just found out about this custom component to track energy use from switches, so I'm just going to use that instead, since I can use it on other things than just heaters it will be probably simpler to setup.

@jmcollin78
Copy link
Owner

Hello, energy calculation is very approximative but it should not be twice the real value.

I will check you suggestion you found in the code. Thank you for this !

@jmcollin78 jmcollin78 added bug Something isn't working question Further information is requested P1 Priority 1 labels Jan 30, 2025
@nicolaspsps
Copy link

Hi all,
I see the same issue on my side with 2 heaters configured in the same VTherm.
Image
Good luck for the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1 Priority 1 question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants