Skip to content

Instantly share code, notes, and snippets.

@csrui
Last active August 17, 2026 11:59
Show Gist options
  • Select an option

  • Save csrui/d0f433ebd7a3023f97a04e72617a7340 to your computer and use it in GitHub Desktop.

Select an option

Save csrui/d0f433ebd7a3023f97a04e72617a7340 to your computer and use it in GitHub Desktop.
Home Assistant Blueprint: Sonoff Detached Lights
blueprint:
name: Sonoff detached button controls a light
description: >
Toggle a light from a physical button on a detached Sonoff M5.
Uses the Sonoff Action sensor rather than the relay entity.
domain: automation
author: Rui
input:
action_sensor:
name: Sonoff Action sensor
selector:
entity:
filter:
- domain: sensor
integration: sonoff
button_action:
name: Physical button
selector:
select:
options:
- label: Button 1
value: button_1_single
- label: Button 2
value: button_2_single
- label: Button 3
value: button_3_single
mode: dropdown
light_target:
name: Corresponding light
selector:
target:
entity:
- domain: light
triggers:
- trigger: state
entity_id: !input action_sensor
to: !input button_action
actions:
- action: light.toggle
target: !input light_target
mode: single
max_exceeded: silent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment