Closed hmmbob closed 3 months ago
Maybe the update only happens once per hour? And not when tomorrow's price becomes available? Can you check again now?
Yeah, it updated now, but it would be great if an update of the price-sensor attributes also triggers an update of the ev_smart_charging_charging sensor
I think the problem is that the template sensor only updates when the state of the source sensor is updated (in your case sensor.zonneplan_current_electricity_tariff
), and not when the attribute with all the prices are updated (in your case forecast
)
The solution to this is to add triggers in the template sensor. Just reading the documentation for trigger, I think you need to do the following. Will this work?
template:
- trigger:
# This should generate triggers for all changes in the entity, both in it's state and it's attributes.
- platform: state
entity_id: sensor.zonneplan_current_electricity_tariff
sensor:
- name: "Zonneplan template price sensor"
unique_id: zonneplan_template_price_sensor
unit_of_measurement: "€/kWh"
availability: "{{ 'sensor.zonneplan_current_electricity_tariff' | has_value }}"
state: "{{ states('sensoensor.zonneplan_current_electricity_tariff' | has_value }}"
state: "{{ states('sensor.zonneplan_current_electricity_tariff') }}"
attributes:r.zonneplan_current_electricity_tariff') }}"
attributes:
Yes, that worked! It was within milliseconds now 😄
Version of the custom_component
Version 1.11.0-dev2
Configuration
Standard component with Zonneplan template sensor
Describe the bug
sensor.ev_smart_charging_charging
does not update when new template prices are availableDebug log
Attributes of
sensor.zonneplan_template_price_sensor
:Graph based on this sensor:
Attributes of
sensor.ev_smart_charging_charging
Graph based on this sensor: