-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
I have set up multiple variables which work perfect. However there is one variable (see config below) which I'm not able to set its value using the service request.
Entry in my variable YAML-file:
pv_daily_production:
unit_of_measurement: Wh
unique_id: 34823482842848284
value_template: >-
{% if has_value('sensor.system_pv_total_power') and (states('sensor.system_pv_total_power') | float) > 0 %}
{{ (states('sensor.system_pv_today_production') | float) * 1000 }}
{% else %}
{{ states('var.pv_daily_production') }}
{% endif %}
tracked_entity_id:
- sensor.system_pv_today_production
I'd like to set the variable var.pv_daily_production to 0 at midnight and use a service call in an automation.
Action-Part of my automation:
service: var.set
data:
entity_id: var.pv_daily_production
value: 0
But this is not working. Trying to set the variable directly from the services menu does not work either. However, using the python set.state script, I can change the variable at midnight
service: python_script.set_state
data_template:
entity_id: var.pv_daily_production
state: "{{ 0 }}"
I'm not sure if I'm doing something wrong or why setting explicitly this variable does not work. Other variables I set in the same automation are changed like intended.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels