Your automation’s action is designed to turn on the input_boolean and then immediately turn it off.
Based on that behavior (on then off), how are you checking if the input_boolean was ever turned on? It won’t show in the States page so are you checking the Logbook?
Thanks for all the support!
The last solutions looks great if the state name and the input_boolean name are identical! In my case this is not so because the state names contain spaces.
Actually, it is designed to meet your situation where the two are different (i.e. state’s value contains a space but the input_boolean’s name does not).
I see. But this is not my situation. I am rather talking about something like:
input_boolean.bla_blibbblubb
input_select.dork state: “Blibb to Blubb”
Sure if I rename the input_booleans (blibbblubb -> blibbtoblubb) a little bit it can be done with some string operations (to lower case, remove spaces).
If you have the string ops from the top of your head I will happily go ahead and implement it like that. (It is running now for me, but the overall code is rather lengthy and repetitive).
Also the other direction takes a lot of repetitive code, but I thought it is not possible to use a template for the trigger itself, right?
So I have a number of auch repetitive code blocks for the other “direction”:
The example I offered is based on what you originally posted, where it’s simply ‘act 1’ and ‘act1’. We can only help you with what you share with us, so no one could’ve guessed your situation is more like the ‘blibbblubb’ example. So let’s see what can be done to help you with that.
I suggest you make the input_boolean’s name match an option in the input_select.
This simplifies using them in an automation. In the following example, trigger.to_state.name will contain the input_boolean’s name (Blibb Blubb or Flipp Flopp or Flimm Flamm).
- alias: Set input_select from any input_boolean
trigger:
- platform: state
entity_id: input_boolean.blibb_blubb
- platform: state
entity_id: input_boolean.flipp_flopp
- platform: state
entity_id: input_boolean.flimm_flamm
condition:
condition: template
value_template: "{{ trigger.to_state.state == 'on' }}"
action:
- service: input_select.select_option
data_template:
entity_id: input_select.harmony_hub_living_room_activities
option: "{{trigger.to_state.name}}
Actually, it’s not obvious because no one else but you knows how you’ve named your entities and options.
To help us help you, please post the configuration of your input_select and input_booleans so we can make informed suggestions on how best to handle them.
with all due respect and thankfulness for your help - the config is not at he core of the question.
the core of the question actually is:
if a state contains characters that are not allowed for entity_id’s, will trigger_to.state.name automatically translate such characters into a syntactically allowed replacement character, and which is that? “_” ?
when I know the replacement character I know how to rename my input boolean entity_id’s so that they will match the translated state names.
Oh I misunderstood that part. Sorry. That means that I have to choose the input_select option strings as friendly name for the according input booleans?
and would something like this also work for the other direction?
Yes, that’s how I designed the example I posted above. If you do that, it simplifies the automation’s template.
trigger.to_state.name represents the friendly_name of whichever input_boolean triggered the automation. If it was input_boolean.flipp_flopp then option is assigned Flipp Flopp.