I am a bit new at home assistant.
I have a automation that if someone changes the channel to 3FM that it has to play 538. (Becouse my colleague doesnt like radio 538). However that doesnt work. When i execute the automation manually it works. But it looks like the trigger doesnt get fired. I think sensor.sonos_media_play_it is the error in this automation. Is someone similair with this problem or can help me solving it?
This is what i have.
id: eab049f0d63c4c70a3cd81e26734b69f
alias: Geen 3FM afspelen
trigger:
- entity_id: sensor.sonos_media_player_it
platform: state
to: 3FM
action:
- data:
entity_id: media_player.it
source: '538'
service: media_player.select_source
- alias: Sonos IT inschakelen
description: Sonos IT inschakelen
trigger:
- at: '7:40'
platform: time
condition: []
action:
- data:
entity_id: media_player.it
service: media_player.media_play
id: e42224af466b41f28a04765d4e091a0e
Manually triggering an automation skips the trigger and the condition. To test your automation you will have to ensure the state of sensor.sonos_media_player_itchanges to 3FM.
Please post the configuration for sensor.sonos_media_player_it
Hello @123 thanks for your asnver. where can i see the configuration of sensor.sonos_media_player_it? Do you mean in the automations panel? i changed 3fm to ‘3fm’
There’s nothing in the Sonos integration indicating that it automatically creates a Sonos-related sensor so I assumed you defined it manually in configuration.yaml (or in a separate file like sensors.yaml).
In your automation you defined it using capitalized letters like this: 3FM
For Home Assistant, 3FM and 3fm are not the same. Ensure you are using the correct one.
Go to Developer > Tools > States, find sensor.sonos_media_player_it in the list and confirm how it is spelled (3FM or 3fm).
@123 I am at my internship and didnt configure it. The automation doesnt work so they asked me to fix it.
In the list states there is no sensor.sonos_media_player_it so i think that is probely the problem.
I assume that sensor.sonos_media_player_it is a template sensor (probably defined somewhere in a file called sensors.yaml or in configuration.yaml in the section:) that extracts the attribute source from media_player.it. For this automation, you shouldn’t need this sensor.
If my assumptions are correct, try changing your trigger part to this and see if it works:
If you go to the sidebar then select Developer Tools -> States, search for media_player.it. Please post a screenshot from this when “3FM” is playing on this media player.