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'