Created
July 1, 2026 12:48
-
-
Save Gr8z/e5f16c28164ce056591d92d2ec7f28fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blueprint: | |
| name: Aqara H2 Wireless Switch (2 gang) — 2 Lights (Z2M MQTT) | |
| description: > | |
| Two lights via Aqara H2 wireless 2-gang switch over Zigbee2MQTT (raw MQTT trigger). | |
| Left rocker → Light 1, Right rocker → Light 2. | |
| • Single click → toggle on/off | |
| • Double click → step brightness up; wraps back down after 100% | |
| Setup: enter topic zigbee2mqtt/<friendly name>; set click_mode = "multi" in Z2M. | |
| Pick a specific light ENTITY for each (not an area/device) so brightness can be read. | |
| domain: automation | |
| input: | |
| mqtt_topic: | |
| name: MQTT topic | |
| description: "e.g. zigbee2mqtt/H2 Switch Living Room" | |
| selector: | |
| text: | |
| light_left: | |
| name: Light 1 (Left rocker) | |
| selector: | |
| entity: | |
| domain: light | |
| light_right: | |
| name: Light 2 (Right rocker) | |
| selector: | |
| entity: | |
| domain: light | |
| dim_step: | |
| name: Brightness step per double-click (%) | |
| default: 25 | |
| selector: | |
| number: | |
| min: 5 | |
| max: 50 | |
| step: 5 | |
| unit_of_measurement: "%" | |
| mode: queued | |
| max: 10 | |
| max_exceeded: silent | |
| trigger: | |
| - platform: mqtt | |
| topic: !input mqtt_topic | |
| variables: | |
| action: "{{ trigger.payload_json.action }}" | |
| dim_step: !input dim_step | |
| ent_left: !input light_left | |
| ent_right: !input light_right | |
| condition: | |
| - "{{ trigger.payload_json.action is defined and trigger.payload_json.action not in [None, ''] }}" | |
| action: | |
| - choose: | |
| # ---------------- LEFT ROCKER → Light 1 ---------------- | |
| - conditions: "{{ action == 'single_left' }}" | |
| sequence: | |
| - service: light.toggle | |
| target: | |
| entity_id: "{{ ent_left }}" | |
| - conditions: "{{ action == 'double_left' }}" | |
| sequence: | |
| - variables: | |
| cur_pct: "{{ ((state_attr(ent_left, 'brightness') or 0) / 255 * 100) | round(0) | int }}" | |
| - service: light.turn_on | |
| target: | |
| entity_id: "{{ ent_left }}" | |
| data: | |
| brightness_pct: "{{ dim_step if cur_pct >= 100 else [cur_pct + dim_step, 100] | min }}" | |
| transition: 0.4 | |
| # ---------------- RIGHT ROCKER → Light 2 ---------------- | |
| - conditions: "{{ action == 'single_right' }}" | |
| sequence: | |
| - service: light.toggle | |
| target: | |
| entity_id: "{{ ent_right }}" | |
| - conditions: "{{ action == 'double_right' }}" | |
| sequence: | |
| - variables: | |
| cur_pct: "{{ ((state_attr(ent_right, 'brightness') or 0) / 255 * 100) | round(0) | int }}" | |
| - service: light.turn_on | |
| target: | |
| entity_id: "{{ ent_right }}" | |
| data: | |
| brightness_pct: "{{ dim_step if cur_pct >= 100 else [cur_pct + dim_step, 100] | min }}" | |
| transition: 0.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment