Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save phoeagon/1c3c2c7a260d701bc9fb1e2530b23819 to your computer and use it in GitHub Desktop.

Select an option

Save phoeagon/1c3c2c7a260d701bc9fb1e2530b23819 to your computer and use it in GitHub Desktop.
blueprint:
name: ZG-101ZS Tuya 4-Button Scene Switch (context-id trigger)
description: >
Reliable trigger for Tuya ZG-101ZS event.* entities.
Uses context.id (always changes) to detect presses.
domain: automation
input:
event_entity:
name: Scene event entity
selector:
entity:
domain: event
event_action:
name: Event Type
default: Any
selector:
select:
options:
- Any
- click
- double_click
- press
actions:
name: Actions
selector:
action: {}
mode: single
trigger:
- platform: state
entity_id: !input event_entity
attribute: context
condition:
- condition: template
value_template: >
{% set sel = event_action %}
{% set t = trigger.to_state.attributes.event_type | default('') %}
{{ sel == 'Any' or sel == t }}
action:
- sequence: !input actions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment