Had an automation / script that worked great for about two hours then stopped after trying to add a second automation for another remote, now I cannot get the original script or automation to work.
Errors thrown are:
Invalid config for [automation]: template value should be a string for dictionary value @ data[‘action’][0][‘data’]. Got None.
and
Invalid config for [script]: not a valid value for dictionary value @ data[‘sequence’][0][‘choose’][1][‘sequence’][0][‘target’][‘entity_id’]. Got None.
Automation Code:
- id: "1662220652179"
alias: Audio test remote script test
description: "test to send var to script"
trigger:
- platform: state
entity_id: sensor.remotes_test
from: "0"
condition: []
action:
service: script.audio_remote
data:
variables:
button: "{{ states.sensor.remotes_test.state }}"
zone: "{{ media_player.zone_11 }}"
zone_source: "{{state_attr('media_player.zone_11', 'source'}}"
mode: single
Script Code:
audio_remote:
alias: audio remote script
mode: parallel
variables:
button_pressed: "{{ button | int(0) }}"
speaker_zone: "{{ zone }}"
zone_source_int: "{{ zone_source | int(0) }}"
sequence:
- choose:
- conditions: "{{ button_pressed in [1, 4] }}"
# button play/pause (1) or next (4) pressed
sequence:
- service: media_player.select_source
data:
source: "{{ iif(zone_source_int == '1', '2', '1') }}"
target:
entity_id: "{{ zone }}"
- conditions: "{{ button_pressed == 2 }}"
# button center (2) pressed
sequence:
- service: media_player.toggle
target:
entity_id: speaker_zone
- conditions: "{{ button_pressed in [8, 16] }}"
# button volume up (8) or down (16) pressed
sequence:
- service: "media_player.volume_{{ iif(button_pressed == 8, 'up', 'down') }}"
target:
entity_id: speaker_zone
default: []
I have gone over spacing a bunch of times and even re-type everything by hand just incase cut and paste was doing weird things with no luck. What I don’t get is why it worked and now it throws the error, maybe there is a cache or something that needs to be cleared out? I have restarted services as well as full server several times in between troubleshooting changes.
Thanks in advance for any insights.