Hi, I have this script to turn on TV and play a random episode of a kid’s TV show. For whatever reason, it just turns the TV back off immediately.
alias: Turn on TV and play Cicimys
sequence:
- service: media_player.turn_on
target:
entity_id: media_player.samsungtv
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- service: media_player.shuffle_set
target:
entity_id: media_player.libreelec
data:
shuffle: true
- service: media_player.play_media
data:
media_content_type: DIRECTORY
media_content_id: special://profile/playlists/video/CICIMYS.m3u
target:
entity_id: media_player.libreelec
- service: media_player.media_next_track
target:
entity_id: media_player.libreelec
- service: media_player.select_source
data:
source: Kodi
target:
entity_id: media_player.samsungtv
- service: media_player.volume_set
target:
entity_id: media_player.samsungtv
data:
volume_level: 0.09
mode: single
icon: mdi:animation-play
I tried tracing it: I see Turn on TV and play Cicimys (script.turn_on_tv_and_play_cicimys) turned off
- what is doing this last step? When I go to “Step details”, the last step is the volume, correct and as expected. Logbook says just “Turn on TV and play Cicimys turned off
”.
If I call the script with the TV already turned on, it does not turn the TV off
If I call the script with the TV off, it turns the TV on and then immediately off again.
I have no issues turning the TV on/off from HA/Lovelace or otherwise controlling.
Please help.