I like to check my variable mediaplayer statues. Options are idle and standby
I got it working for one option, but more than one option is ok.
Can somebody help?
this one works for one value
- wait_for_trigger:
- platform: template
value_template: "{{ is_state(mplayer, \"idle\") }}"
enabled: true
tried more values
- wait_for_trigger:
- platform: template
value_template: "{{ states(mplayer) in ["standby", "idle"] }}"
enabled: true
The issue is your use of double-quotes both inside and outside the curly braces. You can use either single quotes or double quotes in either location, just make sure you use a one kind outside and the other kind inside:
The the answer to the in() test renders true or false, the states() function alone provides the string to be tested. You can also use a list of states when using the is_state() function:
When i put it all together, it still does not work ok.
I want to set te volume for my nest and wait till its ready.
When i disable the sequence nr 2, wait for trigger and use a delay it works. But a delay isnt a good option. When i disable the delay and use the trigger is does not sound…
alias: Play_alarm_wav
variables:
beep: "{{ beep if beep is defined else 1 }}"
wacht: "{{ wacht if wacht is defined else 1 }}"
beeps: "{{ beeps if beeps is defined else 0 }}"
wachts: "{{ wachts if wachts is defined else 0 }}"
volume: "{{ volume if volume is defined else 0.5 }}"
mplayer: >-
{{ mplayer if mplayer is defined else
'media_player.chromecast_huiskamer_nest' }}
sequence:
- service: media_player.volume_set
data:
volume_level: "{{volume}}"
target:
entity_id: "{{mplayer}}"
enabled: true
- wait_for_trigger:
- platform: template
value_template: "{{ is_state(mplayer, ['standby', 'idle']) }}"
enabled: true
- delay:
hours: 0
minutes: 0
seconds: "{{wacht}}"
milliseconds: 0
enabled: false
Are you sure this is the right type of trigger for what you are trying to do? What state is the media player in prior and/or during the volume change? For the template trigger to work, the media player must change from a state that is not either ‘standby’ or ‘idle’ to ‘standby’ or ‘idle’… a change between those two states or remaining in either of those states will not cause the trigger to fire.
exactly!
problem seems to be the mediaplayer and its state changes…
good news is that i can reuse your solutions in another part.
for this part i use the delay