Light control of IHC / LK 2 or 4-button wall switch

Correct - just to use one binary (Switch OH (upper right) to change state of a switch a shelly relay

Yeah that can be done. I have another blueprint I use to control my Ikea fyrtur blinds.

However if you just need it for one relay, then it should be a pretty simple automation.

 alias: ihc switch
  trigger:
  - platform: state
    entity_id: binary_sensor.your_sensor_name
    from: 'Off'
    to: 'on'
  condition: []
  action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.your_switch_name

It needs to turn off the switch when pressed and turn it on when pushed again …

Kip funktion in danish …

The script couldnt be pasted - required key not provided

You could add a small delay and then switch off again.

alias: ihc switch
  trigger:
  - platform: state
    entity_id: binary_sensor.your_sensor_name
    from: 'off'
    to: 'on'
  condition: []
  action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.your_switch_name
  - delay:
      milliseconds: 500
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.your_switch_name

When i put this in as a new automation i get this :

Message malformed: required key not provided @ data[‘trigger’]

It could also just be a “toggel”

Hi,
Is it possible to use 1 button for both on and off?
/Claus

Yeah you would need to change the blueprint, so it toogle’s the light instead of turning the light on.

However I also made this blueprint so you can do single and long press and the choose and action for the button. You can copy this into a yaml file and put it in your blueprint folder in HA.

blueprint:
  name: IHC "Action" controller
  description: Control a device using IHC switch and binary sensors
  domain: automation
  input:
    ihc_turn_on:
      name: Binary Sensor On
      description: This sensor is used to register turn On state
      selector:
        entity:
          domain: binary_sensor
    ihc_turn_off:
      name: Binary Sensor Off
      description: This sensor is used to register turn Off state
      selector:
        entity:
          domain: binary_sensor
    long_click_action_on:
      name: On - Long click action
      description: The action(s) to launch for a ON long click 
      default: []
      selector:
        action: {}
    short_click_action_on:
      name: On - Short click action
      description: The action(s) to launch for a ON single short click
      default: []
      selector:
        action: {}
    long_click_action_off:
      name: Off - Long click action
      description: The action(s) to launch for a OFF long click 
      default: []
      selector:
        action: {}
    short_click_action_off:
      name: Off - Short click action
      description: The action(s) to launch for a OFF single short click
      default: []
      selector:
        action: {}
    hold_threshold:
      name: Hold threshold
      description: Time to consider binary sensor input is being held, instead of just pushed.
      default: "0.4"
      selector:
        number:
          min: "0.05"
          max: "10"
          step: "0.05"
          unit_of_measurement: s

# Trigger when binary_sensor is changed from Off to On
trigger:
  - platform: state
    entity_id: 
      - !input ihc_turn_on
      - !input ihc_turn_off
    to: 'on'
condition: []

# Declare blueprint inputs as variables for use in {{templates}}  
variables:
  ihc_turn_on: !input ihc_turn_on
  ihc_turn_off: !input ihc_turn_off

action:
  - wait_for_trigger:
      - platform: state
        entity_id: !input ihc_turn_on
        id: ihc_on
        to: "off"
        from: "on"
      - platform: state
        entity_id: !input ihc_turn_off
        id: ihc_off
        to: "off"
        from: "on"
    timeout: !input hold_threshold
    continue_on_timeout: true
  - choose:
      - conditions:
        - condition: template
          value_template: '{{ wait.trigger.id == "ihc_on" }}'
        sequence: !input 'short_click_action_on'
      - conditions:
        - condition: template
          value_template: '{{ wait.trigger.id == "ihc_off" }}'
        sequence: !input 'short_click_action_off'
      - conditions:
        - condition: template
          value_template: '{{ ( trigger.entity_id ) == ( ihc_turn_on ) and wait.trigger == none }}'
        sequence: !input 'long_click_action_on'
      - conditions:
        - condition: template
          value_template: '{{ ( trigger.entity_id ) == ( ihc_turn_off ) and wait.trigger == none }}'
        sequence: !input 'long_click_action_off'

I can’t set default brightness, no matter I what I set in settings, brightness is always 51?

That sounds weird. Could it be something about brightness in pixels vs procent?

I get error when I cody your code:

BTW. Does this support IHC wireless?

Bacause I cant see my switches in automation.

Yeah it supports IHC wireless.

Hi Jonas,

Great work!
Is it possible to just use one button to toggle ligt on/off and long press for DIM up/down, so you can use a 4-Button wall switch to toggle and din 4 lights, like when using IHC native?

BR. Martin

Hi Martin,

No, but I can try and see if I can create something that can do that.

So looking at it as a blueprint, I can go to ways.

Either the end user would need to create a helper text for each button. So setting up the blueprinter for 4x IHC buttons would require 4 helpers. This is to keep track if the light was last dimmed or brighten.

Another way would be to set a brightness threshold value. So let’s your brightness is between 0-255 and we set the value at 200.

If the current brightness is 130 it will brighten when you press the button until you release it. Let’s say you stop at 220. Then if you press it again it will dim until you release.

So what would you prefer? I think the cleanest is with the helpers tbh.

Hi Jonas,

Yeah, I think I’d prefer the version with the 4x helper, but think other people would appreciate the help of having both.

Hi Jones,
Did you ever made this blueprint?
Thanks
/Claus

Hi Martin,
Did you managed to get this up and running?
I would like the same functionality as you mention.
Thanks
Regards
Claus

Hi Claus,

Not home at the moment, so can’t check if I ever made it.

But you could just use this blueprint instead:

This is only for one button so you would need to make an automation for each button on the IHC switch.

Hi Jens,

Unfortunately the dimming part dosent work.

/Claus