Simple Switch LEDs with E1743

Hey,
I have a LED stripe in my home using the flux led integration. I also have an Ikea E1743 switch. What I want to do is use the Switch on/off clicks to switch the LED stripe. The switch and the stripe are already connected correctly through HA.

The Way I got this to work is using 2 Automations (Switch click on = turn light on, switch click off = turn light off).
Is this the preferred method or is there a better way to solve this maybe using just 1 automation or some other method?

It’s better if you post the automations you have and we can help you merge them.

1 Like

Automation 1

alias: LED Streifen Wohnzimmer an
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: 029830e1762d4e6d97cfa51de363ca38
    type: action
    subtype: 'on'
    discovery_id: 0x8cf681fffe351958 action_on
condition:
  - condition: device
    type: is_off
    device_id: 2a3ef93abcbe103497ba4d5f015a062d
    entity_id: light.ufo_controller_rgbw_ir_c18ca2
    domain: light
action:
  - type: turn_on
    device_id: 2a3ef93abcbe103497ba4d5f015a062d
    entity_id: light.ufo_controller_rgbw_ir_c18ca2
    domain: light
mode: single

Automation 2

alias: LED Streifen Wohnzimmer aus
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: 029830e1762d4e6d97cfa51de363ca38
    type: action
    subtype: 'off'
    discovery_id: 0x8cf681fffe351958 action_off
condition:
  - condition: device
    type: is_on
    device_id: 2a3ef93abcbe103497ba4d5f015a062d
    entity_id: light.ufo_controller_rgbw_ir_c18ca2
    domain: light
action:
  - type: turn_off
    device_id: 2a3ef93abcbe103497ba4d5f015a062d
    entity_id: light.ufo_controller_rgbw_ir_c18ca2
    domain: light
mode: single

I believe this will work…

alias: LED Streifen Wohnzimmer an und aus
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: 029830e1762d4e6d97cfa51de363ca38
    type: action
    subtype: 'on'
    discovery_id: 0x8cf681fffe351958 action_on
    id: 'turn_on'
  - platform: device
    domain: mqtt
    device_id: 029830e1762d4e6d97cfa51de363ca38
    type: action
    subtype: 'off'
    discovery_id: 0x8cf681fffe351958 action_off
    id: 'turn_off'
condition: []
action:
  - type: {{ trigger.id }} 
    device_id: 2a3ef93abcbe103497ba4d5f015a062d
    entity_id: light.ufo_controller_rgbw_ir_c18ca2
    domain: light
mode: single

I don’t see a need for the condition. But perhaps that is wrong?

1 Like

Hey, sorry for the late reply. Your solution gives me the following error if I try to save the automation in the YAML-Editor:

Message malformed: value must be one of ['brightness_decrease', 'brightness_increase', 'flash', 'toggle', 'turn_off', 'turn_on'] for dictionary value @ data['type']

I tried myself with the trigger IDs and found a solution myself. This works for me and has both Automations merged into one but maybe there is a more elegant solution?

alias: LED Streifen Wohnzimmer an und aus
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: 029830e1762d4e6d97cfa51de363ca38
    type: action
    subtype: 'on'
    discovery_id: 0x8cf681fffe351958 action_on
    id: turn_on
  - platform: device
    domain: mqtt
    device_id: 029830e1762d4e6d97cfa51de363ca38
    type: action
    subtype: 'off'
    discovery_id: 0x8cf681fffe351958 action_off
    id: turn_off
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: turn_on
        sequence:
          - type: turn_on
            device_id: 2a3ef93abcbe103497ba4d5f015a062d
            entity_id: light.ufo_controller_rgbw_ir_c18ca2
            domain: light
      - conditions:
          - condition: trigger
            id: turn_off
        sequence:
          - type: turn_off
            device_id: 2a3ef93abcbe103497ba4d5f015a062d
            entity_id: light.ufo_controller_rgbw_ir_c18ca2
            domain: light
    default: []
mode: single

I thought the solution I posted was going to work.
Glad you solved it anyway! :slight_smile:

1 Like