@Mutt, unfortunately, I got error when I tried to add automation.
I had to use service_template like so:
- alias: Pump Control
trigger:
- platform: state
entity_id: binary_sensor.bs_pump_enable
action:
- service_template: switch.turn_{{trigger.to_state.state}}
entity_id: switch.floor_pump
and there was a typo in value_template, it should be:
{{ vkit or vbth or vcdr or vbed or vkid }}
It should be vkid instead of vkis
Thank You so much for help. I only tested this on a spare Pi and my test system but it looks like everything works. I’ve changed switches many times and it just works
I’m more and more confused when I start to learn HA more. Automations bypass the delays when you fire them twice, but value_template’s don’t. This all is very confusing
I still think that this behavior (in automation) is a bug.
Sorry about the typos (two ! ), glad you found them and have a working solution
There is a distinction between the two.
One is intended to operate on a value crossing (as discussed), whereas the binary_sensor pretty much always works on a template (never done one that doesn’t) but it’s the delay_on you are in love with.
They are both as design.
But you get an idea how a proper description leads you to a more appropriate solution.
I’m still waiting for Petro or pnbruckner or Teras to come back with a 3 line solution or some such
Are you using an editor (notepad++, atom etc.) or the built-in tools (automation editor ) ? The former is harder but you learn more faster.
Edit: I’ll modify the above so there’s less chance of someone copying bad code.
having a small jump-in, so forgive me if I miss something already discussed, but why won’t you simply use a group with these entities, and use that group’s state to trigger?
you can play with the ‘all’ option if you need them all to be on or off the set the specific behavior
otoh, most certainly novices should get a good grasp of the inner workings of Hassio, groups is among the very basic and powerful aspects of HA.
As this would demonstrate, it wouldn’t even need a template to do as he desires.
tbh, maintainability using the group technique is way beyond (much easier and les error prone because of that) that of the templates of course. Only change the entities in the group, and you’re set.
But unless you have your head round it, the inclination (when changing the logic) is to go to where the logic is written, and not go to where the group is written.
We both ended at the same spot so it’s more down to the OP
But, how would he not need a template ?
Ahh! You mean go back to a simple automation but triggered on the group, so his delay would not be compromised, true
Misiu, if you consider your problem (as posted) solved can you please mark the post you feel helped you the most, as the solution.
This helps people searching for similar solutions AND the people working on the forum trying to help others (they spend less time reading problems that have a solution.
Not a problem, I’m impressed with
a) how you have managed so far
b) the fact that it is obvious that you have tried various things before asking for help
Happy Automating
I’m not ashamed of asking for help, but before I ask for it I always try to do something on my own
It this case the lack of knowledge how HA works in the inside was the reason all my trials failed.
I hope that other newcomers will find this topic helpful like I did.