Forgot to expalin issue, when using input select, nothing happens, but also no error
From logs:
Error while executing automation automation.remote_start_activity_from_input_select_living_room_tv. Invalid data for call_service at pos 1: extra keys not allowed @ data['activity']
while parsing a block mapping
in "/config/automations.yaml", line 9, column 3
expected <block end>, but found '<scalar>'
in "/config/automations.yaml", line 9, column 39
Any idea with mine why Iâm getting âError while executing automation automation.tv_source_automation_from_input_select. Invalid data for call_service at pos 1: not a valid value for dictionary value @ data[âentity_idâ]â when Iâm trying to turn on an activity from the input_select pulldown and it doesnât work?
automations:
- alias: "TV Source Automation From Input Select"
initial_state: on
trigger:
platform: state
entity_id: input_select.harmonytvsource
action:
- service: remote.turn_on
data_template:
entity_id: >
{% if is_state('input_select.harmonytvsource', 'Watch TV') %}
script.turn_on_watch_tv_activity
{% elif is_state('input_select.harmonytvsource', 'Listen To Music') %}
script.turn_on_listen_to_music_activity
{% elif is_state('input_select.harmonytvsource', 'PowerOff') %}
script.turn_off_activity
{% endif %}
# Update input_select for TV Source
- alias: "Update Hub TV Source From Remote"
initial_state: on
trigger:
platform: state
entity_id: remote.familyroom_hub
condition:
condition: template
value_template: "{{ trigger.to_state.attributes.current_activity in state_attr('input_select.harmonytvsource', 'options') }}"
action:
service: input_select.select_option
data_template:
entity_id: input_select.harmonytvsource
option: "{{ trigger.to_state.attributes.current_activity }}"
input_select:
harmonytvsource:
name: Harmony Activities
options:
- Select Activity
- Watch TV
- Listen To Music
- PowerOff
initial: Select Activity
- alias: "TV Source Automation From Input Select"
initial_state: on
trigger:
platform: state
entity_id: input_select.harmonytvsource
action:
- service: script.turn_on
data_template:
entity_id: >-
{% if is_state('input_select.harmonytvsource', 'Watch TV') %}
script.turn_on_watch_tv_activity
{% elif is_state('input_select.harmonytvsource', 'Listen To Music') %}
script.turn_on_listen_to_music_activity
{% elif is_state('input_select.harmonytvsource', 'PowerOff') %}
script.turn_off_activity
{% endif %}
Should note when I turn on the TV from the remote I get this also:
Error while executing automation automation.tv_source_automation_from_input_select. Invalid data for call_service at pos 1: not a valid value for dictionary value @ data[âentity_idâ]
So I just triggered the input_select pulldown. TV was on and it showed Watch TV. I changed to PowerOff and nothing happened. Again error:
Error while executing automation automation.tv_source_automation_from_input_select. Invalid data for call_service at pos 1: not a valid value for dictionary value @ data[âentity_idâ]
Also when you mean trigger state, havenât tried it other than creating it but something like this?
- alias: "TV Source Automation From Input Select"
initial_state: on
trigger:
platform: state
entity_id: input_select.harmonytvsource
action:
- service: script.turn_on
data_template:
entity_id: >
{% if trigger.to_state.state == 'Watch TV' %}
script.turn_on_watch_tv_activity
{%-elif trigger.to_state.state == 'Listen To Music' %}
script.turn_on_listen_to_music_activity
{%-elif trigger.to_state.state == 'PowerOff' %}
script.turn_off_activity
{% endif %}
Let me know here or the other thread what you want me to include, just the scripts tied to Harmony or everything as there are a lot. That said, do you know the difference between homeassistant.turn_on vs script.turn_on?
Should mention changing it to this works but is directly calling the hub and running the activity, not the HA script:
Thanks Petro, so this is weird, Before seeing your post, I copied my automation from a separate input_select for selecting my favorite channels and tweaked it for this one and it is working right now. The weird part I canât tell apart.
I did try it with the homeassistant.turn_on before and didnât do anything. Only difference here is the PowerOff was first in my if statement so not entirely sure if there was something from the cut and paste that fixed it or if there was a single quote character that was wrong and couldnât see it or what.