Though it passes the config check, I keep getting this error:
Error while executing automation automation.ac_auto_on. Invalid data for call_service at pos 1: not a valid value for dictionary value @ data['entity_id']
So, if I use:
trigger.entity_id
{ trigger.entity_id }
{{ trigger.entity_id }}
they all fail a config check. I have to put it in quotes, though that still generates the error (both single and double quotes). I also used the developer tools to trigger the automation, and still got the error.
Just for fun, here’s another way to perform the action using a dictionary instead of if-elif branching:
- id: '95'
alias: ac auto on
trigger:
- platform: numeric_state
entity_id: sensor.aeotec_trisensor_temperature_measurement
above: '74'
- platform: numeric_state
entity_id: sensor.family_room_sensor_temperature
above: '74'
- platform: numeric_state
entity_id: sensor.attic_sensor_temperature_measurement
above: '74'
condition: []
action:
- service: switch.turn_on
data_template:
entity_id: >-
{% set map = {"aeotec_trisensor_temperature_measurement": "master_bedroom_ac",
"attic_sensor_temperature_measurement": "kelseys_room_ac",
"family_room_sensor_temperature": "family_room_ac"} %}
switch.{{ map[trigger.to_state.object_id] if trigger.to_state.object_id in map.keys() else 'unknown' }}
In your original example, the trigger is monitoring 4 sensors. However, action only handles 3 of them so I removed sensor.washer_temperature from trigger.