Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95925

Direct hard link between switch toggles

$
0
0

@Victorka wrote:

Hi community.

I tried I suppose every solution from this forum but none of them works as I expect. I simply want to hard link 2 toggles in Hass. I have following setup: There are 2 lights in the room and one RF wall switch. I put two lights into one group.

  kitchen_card:
    name: Kitchen Lighting
    entities:
      - light.kitchen_ceiling
      - light.kitchen_worktop

In this way switches can function regardless of group toggle but also with the group toggle I can switch on/off both of them together. The behaviour is exactly what I want.
Recently I added RF wall switch and simply want to control group toggle with it.

light.kitchen_wall_switch

But unfortunately all solutions I found here are suggesting to use service/data templates. In my case it looks as follows:

- alias: Kitchen Light On Wall Switch    
  trigger:
    - platform: state
      entity_id: group.kitchen_card, light.kitchen_wall_switch
  action:
    - service_template: >
        {% if trigger.to_state.state == "on" %}
        light.turn_on
        {% elif trigger.to_state.state == "off" %}
        light.turn_off
        {% endif %}
      data_template: 
        entity_id: >
          {% if trigger.from_state.entity_id == "group.kitchen_card" %}
          light.kitchen_wall_switch
          {% elif trigger.from_state.entity_id == "light.kitchen_wall_switch" %}
          group.kitchen_card
          {% endif %}

But this automation doesn’t work as desired in case when I want to turn on only one of the lights. It changes state of the wall switch which triggers this automation once again setting all lights on. What I want is simply link a group toggle to a wall switch toggle without any workarounds and delays etc.: group.kitchen_card <==> light.kitchen_wall_switch.
I made an illustration for easier understanding what I need:


Maybe someone have already solved this problem?

Thank you for any help in advance.

Posts: 18

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 95925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>