Chooser condition appears not to be able to identify the “unavailable” state of an entity.
I am having difficulties with a script which turns on the TV, starts the plex app, and then plays a movie. That is, the basic script works, but when adding the chooser to skip turning on the tv and start the plex app if they are already up and running, fails.
The yaml script below works, but if I uncomment the “choose” part, it fails to start Plex (set Plex as source on the TV, and thereby make the plex media player available). I tried to include a not condition, but it then complained about a null value.
Any ideas?
play_frost:
alias: Turn on Tv, start plex and play movie
mode: single
sequence:
- choose:
- conditions:
- condition: state
entity_id: media_player.stue
state: "off"
sequence:
- data: {}
entity_id: media_player.stue
service: media_player.turn_on
- delay: '5'
# - choose:
# - conditions:
# - condition: state
# entity_id: media_player.plex
# state: "unavailable"
# sequence:
# - service: media_player.select_source
# entity_id: media_player.stue
# data:
# entity_id: media_player.stue
# source: Plex
# - delay: '20'
- service: media_player.select_source
entity_id: media_player.stue
data:
entity_id: media_player.stue
source: Plex
- delay: '20'
- service: media_player.play_media
entity_id: media_player.plex
data:
entity_id: media_player.plex
media_content_id: '{ "library_name": "Movies", "video_name": "Frozen" }'
media_content_type: VIDEO