I have a switch Input entity on/off and a relay entity.
I want something as simple that the relay always follow the state of the switch input. Currently i need to creat two automation rules for this, one that turn on the relay and one rule that turn it off, depending on the switch inpur entity.
I think this is just a hassel, how can i creat something simpler then this? I need one script/automation that take care of voth on and off switching. How can this be done?
Is this relay entity a switch.xxx? And the input entity has been created by yourself input_boolean.xxx? If so, try the template switch. This will create a switch where you can define what happens when you turn it on/off.
Phil asked you for the entities … to make things easier … you just want a link to the documentation.
The problem is, with an input boolean and a switch there are a million and one things you can do with them, so the documentation can’t cover every possible permutation.
What @Burningstone gave you should work but it’s a bit complicated if you never operate the switch directly (just using the input boolean)
Copy the automations you created and paste them here.
It’s to help the people who wish to help you. It allows them to work with what you already have rather than try to invent code from scratch. Posting automations, for analysis, is very commonly done in this community forum.
If you don’t want to share the automations, it makes it more challenging for others to help you. In other words, fewer people may be willing to help you if you refuse to comply with a simple request to share what you already have.
Input is a switch, aka fibaro smart input, its normaly open so its a boolean, as i noted in second post, both enitys is switch.
The output is also a smart implant but a different one. My intention was to use zwave group association in group 2 on this devices but that failed misserable.
There are no virtual entitys, onl ay the ones created by the devices itself.
Yes that is correct, as the thread header say “tie entity togheter” this applys that the entitys must be of same type. Switch.
Smart implat from fibaro is created that the INPUT 1 and OUTPUT 1 are SAME entity. That means if you set the input to high the output is high. If you turn the switch entity to high the output will be high.
I use two of this implants, one that reads input only and creates switch.entity 1 and the second that uses OUTPUT only and has entity switch.entity2
I want to tie this togheter, in a simple means, that entity 2 always reflect entity 1
I would have solved this by using group association for on/off and put the output smart implant in the input group, but association in HA dont work
I approached this by having a script that does the logic. Then I can reuse the script.
Here’s my script:
# If the leader is on, then turn on the followers.
# Otherwise turn off the followers.
set_to_leader:
sequence:
- service_template: >
{% if (is_state(leader, "on")) %}
homeassistant.turn_on
{% else %}
homeassistant.turn_off
{% endif %}
data_template:
entity_id: "{{followers}}"