If I only echo the date to that log it works fine - but when I try to include that scene_id nothing shows up in that log (the file isn’t even created), nor is there any indication that it failed in the home-assistant.log. I have tried a couple different ways of doing the data template, as above, and as trigger.event.data.entity_id, both with the same outcome.
Even just a hardcoded literal for the data template doesn’t work:
data_template:
scene_id: "foo"
So I don’t think that it is the trigger... part (though no guarantees that is right, either)
When I try without any quotes in the shell_command I get an error saying mapping values are not allowed here
I replaced the echo & redirect with a script (which was the actual goal, anyway) and that worked. Something behaves differently when there is a template in the command.
Care to share your final code?
I’m struggling to retrieve the entity_id…
Here is my code:
Automation
- alias: Set Chromecast Radio Picture
trigger:
- platform: state
entity_id: media_player.kitchen
to: 'playing'
- platform: state
entity_id: media_player.bedroom
to: 'playing'
- platform: state
entity_id: media_player.house
to: 'playing'
- platform: state
entity_id: media_player.downstairs
to: 'playing'
- platform: state
entity_id: media_player.onkyo
to: 'playing'
action:
- service: shell_command.chromecast_radio_picture
data_template:
my_media_player: '{{ trigger.event.data.entity_id }}'
- platform: state
entity_id: media_player.kitchen
to: 'playing'
- platform: state
entity_id: media_player.bedroom
to: 'playing'
- platform: state
entity_id: media_player.house
to: 'playing'
- platform: state
entity_id: media_player.downstairs
to: 'playing'
- platform: state
entity_id: media_player.onkyo
to: 'playing'