I want to select the correct tariff on home assistant startup. So far I have this one here but I get this error:
Error while executing automation automation.change_utility_meter_tariff_on_startup_weekdays. Invalid data for call_service at pos 1: Entity ID - utility_meter.daily_energy - utility_meter.monthly_energy - utility_meter.yearly_energy
tariff: partial_peak is an invalid entity id for dictionary value @ data[‘entity_id’]
Can somebody help?
- alias: 'Change utility meter tariff on startup weekdays'
trigger:
- platform: homeassistant
event: start
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
action:
- service: utility_meter.select_tariff
data_template:
entity_id: >-
- utility_meter.daily_energy
- utility_meter.monthly_energy
- utility_meter.yearly_energy
{% if now().hour < 7 %}
tariff: offpeak
{% elif now().hour < 14 %}
tariff: partial_peak
{% elif now().hour < 21 %}
tariff: peak
{% elif now().hour < 23 %}
tariff: partial_peak
{% else %}
tariff: offpeak
{% endif %}