Consumed Energy only updated every two hours
Hi,
On both the latest stable and the latest Beta version I experience the following:
Consumed kWh for heating or water is only updated every two hours, other data Like the current energy consumption is updated in real time. The local webserver shows more frequent updates.
is this expected behavior? If not what information do you require to debug?
Im a developer so I can change some source code as well to help debugging.
Thanks
I can confirm this behaviour. It does not depend on changing the update interval in the config of the integration.
I figured something out:
The data is not really updated on the socket api, thus the integration is working fine.
I am currently working on building an API for the websocket api, which the web UI itself uses (on port 8214). I already managed to parse it into structured hierarchical data,
All thats left, is to map it into the same structure as the current python library to be compatible with. I will try to make it an drop-in replacement, if possible. (There the values updates almost in realtime)
I am currently working on building an API for the websocket api
I also tried this. But the ids are random in the websocket api and it only works with names and they are with a local translation. Please note that Luxtronik work on another, new API.
I noticed that as well.
My approach would have been to look up what value it is based on the name (providing a list of translations and mapping it based on these values)
Sample:
temperature_group: list[str] = [
'Temperaturen'
'Another translation'
]
def get_property_name(name: str) -> str:
if name in temperature_group:
return 'temperatures'
Of course this is not ideal, but better than the two hour window screwing over my dashboard with negative power consumption because of the big jumps ;)
Do you have any more information/timelines in regards towards the new Api? I must decide, if it would be better to wait for it ^^
I am currently working on building an API for the websocket api
I also tried this. But the ids are random in the websocket api and it only works with names and they are with a local translation. Please note that Luxtronik work on another, new API.
Is there any official or unofficial documentation for this new API? I'm curious to read more about it.
FYI: I managed to get a workaround for the time being.
My heatpump exposes the current power consumption (albeit only for the total draw, not separate for heating/water), which updates with every pull interval. I created an helper counting the total consumption based on that, which I then use in the energy dashboard.
the only thing thus missing is the separation of heating / warm water energy draw.
this works for me for now, I think we can close this with the fix being the new api (which hopefully does expose the data).
nevertheless do you know any ETA for the release of that API ? (I would be interested to help implement it)
the only thing thus missing is the separation of heating / warm water energy draw.
You can do this by using two template sensors - so you can separate the current power consumption into two sensors:
- one for hot water: this one is equal to the build-in sensor 'current power consumption' when the WP prepares hot water, otherwise zero
- one for heating: this one is equal to the build-in sensor 'current power consumption' when the WP is heating, otherwise zero
By using some helper (two integral sensors for calculating the energy in kWh using for hot water preparation and heating, and the energy counter) you have all you need. PS: in the options of the integral sensors you have to choose a time-based integration (e.g. 30 sec) for unchanged power values.
(xxxxxx_xxxx has to be replaced by the number in your installation)
- name: "Leistung WW"
unique_id: xxxxxx_xxxx_power_ww
device_class: power
unit_of_measurement: "W"
state: >-
{% set power = states('sensor.luxtronik_xxxxxx_xxxx_current_power_consumption') | float %}
{% set mode = states('sensor.luxtronik_xxxxxx_xxxx_status') %}
{% if power > 0 and mode == "hot water" %}
{{ states('sensor.luxtronik_xxxxxx_xxxx_current_power_consumption') | float }}
{% else %}
{{ 0 }}
{% endif %}
- name: "Leistung Heizung"
unique_id: xxxxxx_xxxx_power_heizung
device_class: power
unit_of_measurement: "W"
state: >-
{% set power = states('sensor.luxtronik_xxxxxx_xxxx_current_power_consumption') | float %}
{% set mode = states('sensor.luxtronik_xxxxxx_xxxx_status') %}
{% if power > 0 and mode == "heating" %}
{{ states('sensor.luxtronik_xxxxxx_xxxx_current_power_consumption') | float }}
{% else %}
{{ 0 }}
{% endif %}
By using some helper (two integral sensors for calculating the energy in kWh using for hot water preparation and heating, and the energy counter) you have all you need. PS: in the options of the integral sensors you have to choose a time-based integration (e.g. 30 sec) for unchanged power values.
@blue-bean I use a similar setup, but to avoid the time-based integration I went with additional triggers for the template sensor instead. The standard trigger for a change in the power sensor, one for the startup and two for when the mode changes
- trigger:
- platform: homeassistant
event: start
- platform: state
entity_id: sensor.luxtronik_xxxxxx_xxxx_current_power_consumption
- platform: state
entity_id: sensor.luxtronik_xxxxxx_xxxx_status
from: heating
- platform: state
entity_id: sensor.luxtronik_xxxxxx_xxxx_status
to: heating
sensor:
- name: "Current Power Consumption Heating"
unique_id: current_power_consumption_heating
device_class: power
unit_of_measurement: "W"
state: >-
{% set status = states('sensor.luxtronik_xxxxxx_xxxx_status') -%}
{% if status == 'heating' -%} {{ states('sensor.luxtronik_xxxxxx_xxxx_current_power_consumption') | float }}
{% else -%} {{ 0 }}
{% endif -%}
availability: "{{ is_number( states('sensor.luxtronik_xxxxxx_xxxx_current_power_consumption') ) }}"
@s-kurz So it's just another way for the template sensor definition. But for the Energy Dashboard you need energy sensors, no power sensors. How do you calculate the energy from your current_power_consumption_heating sensor?
@s-kurz So it's just another way for the template sensor definition. But for the Energy Dashboard you need energy sensors, no power sensors. How do you calculate the energy from your current_power_consumption_heating sensor?
Its also with an integral sensors, but you don't need use the time-based integration option anymore.
Since this issue is cause by the Luxtronik controller, this cannot be solved by this integration. Changing the integration to use the websocket api is not planned. Therefore I close this issue. The information in this thread about a workaround may be something to add to the documentation.