Hello all –
I’m in the midst of (re)implementing a set of template select entities and corresponding universal media players to encapsulate and simplify the functions of my living room AV setup (eventually aiming to realize a post-Harmony-remote control setup that I’m actually happy with).
In working on this I keep running into syntax issues that so far continue to surprise and baffle me. Specifically relating to blocks of actions.
I feel like I do understand why, for example, a choose
block would contain conditions
and why conditions
would contain an action (or sequence etc.). I can also grasp why the default
condition for a choose
block wouldn’t require a separate key to house the actions (because the “condition” is implicit for default
and so the default
block is just really specifying what to do in that case).
Where I start to lose my way is e.g. in the commands:
section of a universal media player. Suppose I want the turn_on:
command of my universal player to perform two actions: turning on the projector and turning on the AVR.
I know how to execute one action or service call in these situations. I can even sort of understand why syntactically it’s not possible to embed a “bare” sequence of actions to be applied in such a block e.g.
media_player:
- platform: universal
# ...
commands:
turn_on: ### NOT VALID BELOW!
- service: media_player.turn_on
target:
entity_id: media_player.lr_av_avr
- service: media_player.turn_on
target:
entity_id: media_player.lr_av_proj
Nor is this valid:
media_player:
- platform: universal
# ...
commands:
turn_on: ### ALSO NOT VALID BELOW!
sequence:
- service: media_player.turn_on
target:
entity_id: media_player.lr_av_avr
- service: media_player.turn_on
target:
entity_id: media_player.lr_av_proj
I know I can just pull out the multi-command sequences into scripts. Maybe there’s also a valid way to just pass more than one target entity_id into the media_player.turn_on service call. But those are workarounds that sidestep my question:
Is there some principle I’m missing about when & why an e.g. “sequence” is considered a viable “action” vs when it’s not possible? If it’s just “certain code is more up-to-date than other code; univeral media player isn’t the most up-to-date”…I get it.
But if there’s some underlying concept I’m missing I’d love to know it because this feels like trial & error currently!