I’m trying to make some automations for a utility meter. I use different input_numers to keep values persistent and at certain times I want to reset the different input_numbers. My idea was to use an automation that triggers once a day and then use templating to reset certain values once a day, once a month and once a year. But my automation doesn’t work, the values doesn’t reset.
Error while executing automation automation.energy_-_reset_input_numbers. Invalid data for call_service at pos 1: not a valid value for dictionary value @ data[‘entity_id’]
Templates report their results as strings. In your automation, your template is attempting to report its result as a list. It may look like a list but it’s still a string.
The entity_id option requires multiple entities to be presented either as a list (which is what you tried to do with your template) or as a comma-delimited string. We will choose the second option because a template can only produce a string.
- alias: Energy - Reset input_numbers
initial_state: on
trigger:
platform: time
at: "0:00:03"
action:
- service: input_number.set_value
data_template:
entity_id: >-
{% if now().month == 1 and now().day == 1 %}
input_number.energy_daily, input_number.energy_monthly, input_number.energy_yearly
{% elif now().day == 1 %}
input_number.energy_daily, input_number.energy_monthly
{% else %}
input_number.energy_daily
{% endif %}
value: '0'