Skip to content

Instantly share code, notes, and snippets.

@R00S
Last active December 18, 2025 20:15
Show Gist options
  • Select an option

  • Save R00S/ec8aa45a79f67e962695991d7a131b61 to your computer and use it in GitHub Desktop.

Select an option

Save R00S/ec8aa45a79f67e962695991d7a131b61 to your computer and use it in GitHub Desktop.
blueprint:
name: Eglo Remote - Area & Light Selection (Store-Based) [include-areas]
description: |
Eglo Remote ZHA area/light cycling with state persistence.
- Uses area IDs consistently (no name/ID mixups).
- Includes only the areas you select; others are ignored.
- Avoids divide-by-zero when cycling.
- Deterministic light cycling and dimming.
- Regex escapes fixed.
domain: automation
input:
remote:
name: Eglo Remote
selector:
device:
integration: zha
manufacturer: AwoX
model: ERCU_3groups_Zm
included_areas:
name: Included Areas
description: Only these areas will be cycled. Leave empty to allow all areas.
default: []
selector:
area:
multiple: true
power_left_entity:
name: Power Left Button Entity
default: ""
selector:
entity: {}
timeout_minutes:
name: Timeout (minutes)
default: 5
selector:
number:
min: 0
max: 60
step: 1
unit_of_measurement: minutes
mode: queued
max: 10
variables:
remote_device: !input remote
remote_device_id: "{{ device_id(remote_device) }}"
included_areas: !input included_areas
power_left_entity: !input power_left_entity
timeout_minutes: !input timeout_minutes
default_area_id: "{{ device_attr(remote_device, 'area_id') }}"
available_areas: >
{% set incl = included_areas if included_areas is iterable and included_areas is not string else [] %}
{% if incl | length > 0 %}
{{ incl | list }}
{% else %}
{{ areas() | list }}
{% endif %}
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "on"
id: power_left
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "off"
id: power_right
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "awox_color"
args: [0, 85]
id: color_green_short
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "move_to_hue_and_saturation"
params:
hue: 85
id: color_green_long
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "awox_color"
args: [0, 255]
id: color_red_short
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "move_to_hue_and_saturation"
params:
hue: 255
id: color_red_long
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "awox_color"
args: [0, 170]
id: color_blue_short
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "move_to_hue_and_saturation"
params:
hue: 170
id: color_blue_long
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "enhanced_move_hue"
params:
move_mode: 1
id: color_cycle_short
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "enhanced_move_hue"
params:
move_mode: 3
id: color_cycle_long
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "awox_refresh"
params:
press: 1
id: candle_mode
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "awox_refresh"
params:
press: 2
id: candle_mode_long
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "step_with_on_off"
params:
step_mode: 0
id: dim_up_short
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "move_to_level_with_on_off"
params:
level: 254
id: dim_up_long
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "step_with_on_off"
params:
step_mode: 1
id: dim_down_short
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "move_to_level_with_on_off"
params:
level: 1
id: dim_down_long
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "step_color_temp"
params:
step_mode: 1
id: color_temp_up_short
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "move_to_color_temp"
params:
color_temp_mireds: 454
id: color_temp_up_long
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "step_color_temp"
params:
step_mode: 3
id: color_temp_down_short
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "move_to_color_temp"
params:
color_temp_mireds: 153
id: color_temp_down_long
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "recall"
params:
scene_id: 1
id: fav_1
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: "recall"
params:
scene_id: 2
id: fav_2
- platform: time_pattern
minutes: "/1"
id: timeout_check
action:
- service: eglo_remote_zha.get_state
data:
device_id: "{{ remote_device_id }}"
key: current_area
default: "{{ default_area_id }}"
response_variable: current_area_data
- service: eglo_remote_zha.get_state
data:
device_id: "{{ remote_device_id }}"
key: current_light
default: "all"
response_variable: current_light_data
- service: eglo_remote_zha.get_state
data:
device_id: "{{ remote_device_id }}"
key: last_activity
default: "{{ now().isoformat() }}"
response_variable: last_activity_data
- variables:
current_area: >
{% set a = current_area_data.value %}
{% if a in available_areas %}
{{ a }}
{% elif default_area_id in available_areas %}
{{ default_area_id }}
{% elif available_areas | length > 0 %}
{{ available_areas[0] }}
{% else %}
{{ None }}
{% endif %}
current_light: "{{ current_light_data.value }}"
last_activity: "{{ last_activity_data.value }}"
current_area_lights: >
{% if current_area %}
{{ area_entities(current_area) | select('match', '^light\\.') | list | sort }}
{% else %}
[]
{% endif %}
- choose:
- conditions: "{{ trigger.id != 'timeout_check' }}"
sequence:
- service: eglo_remote_zha.set_state
data:
device_id: "{{ remote_device_id }}"
key: last_activity
value: "{{ now().isoformat() }}"
default: []
- choose:
# Candle Mode
- conditions: "{{ trigger.id == 'candle_mode' }}"
sequence:
- choose:
- conditions: "{{ current_light != 'all' }}"
sequence:
- service: eglo_remote_zha.set_state
data:
device_id: "{{ remote_device_id }}"
key: current_light
value: "all"
- if: "{{ current_area_lights | length > 0 }}"
then:
- repeat:
count: 2
sequence:
- service: light.turn_on
target: {entity_id: "{{ current_area_lights }}"}
data: {brightness_pct: 100}
- delay: {milliseconds: 200}
- service: light.turn_off
target: {entity_id: "{{ current_area_lights }}"}
- delay: {milliseconds: 200}
default:
- condition: template
value_template: "{{ available_areas | length > 0 }}"
- variables:
current_index: "{{ available_areas.index(current_area) if current_area in available_areas else -1 }}"
next_index: "{{ (current_index + 1) % (available_areas | length) }}"
next_area: "{{ available_areas[next_index] }}"
- service: eglo_remote_zha.set_state
data:
device_id: "{{ remote_device_id }}"
key: current_area
value: "{{ next_area }}"
- service: eglo_remote_zha.set_state
data:
device_id: "{{ remote_device_id }}"
key: current_light
value: "all"
- variables:
next_area_lights: "{{ area_entities(next_area) | select('match', '^light\\.') | list | sort }}"
- if: "{{ next_area_lights | length > 0 }}"
then:
- repeat:
count: 2
sequence:
- service: light.turn_on
target: {entity_id: "{{ next_area_lights }}"}
data: {brightness_pct: 100}
- delay: {milliseconds: 200}
- service: light.turn_off
target: {entity_id: "{{ next_area_lights }}"}
- delay: {milliseconds: 200}
# Middle color: light cycling (deterministic)
- conditions: "{{ trigger.id == 'color_cycle_short' }}"
sequence:
- variables:
current_area_lights: >
{% if current_area %}
{{ area_entities(current_area) | select('match', '^light\\.') | list | sort }}
{% else %}[]{% endif %}
light_options: "{{ ['all'] + current_area_lights }}"
current_index: >
{% if current_light in light_options %}
{{ light_options.index(current_light) }}
{% else %}0{% endif %}
next_index: >
{% if light_options | length > 0 %}
{{ (current_index + 1) % (light_options | length) }}
{% else %}0{% endif %}
next_light: "{{ light_options[next_index] if light_options|length > 0 else 'all' }}"
- service: eglo_remote_zha.set_state
data:
device_id: "{{ remote_device_id }}"
key: current_light
value: "{{ next_light }}"
- variables:
blink_targets: "{{ [next_light] if next_light != 'all' else current_area_lights }}"
- if: "{{ blink_targets | length > 0 }}"
then:
- repeat:
count: 2
sequence:
- service: light.turn_on
target: {entity_id: "{{ blink_targets }}"}
data: {brightness_pct: 100}
- delay: {milliseconds: 200}
- service: light.turn_off
target: {entity_id: "{{ blink_targets }}"}
- delay: {milliseconds: 200}
# Power Left
- conditions: "{{ trigger.id == 'power_left' and power_left_entity != '' }}"
sequence:
- service: homeassistant.toggle
target: {entity_id: "{{ power_left_entity }}"}
# Power Right
- conditions: "{{ trigger.id == 'power_right' }}"
sequence:
- variables:
target_entities: "{{ [current_light] if current_light != 'all' else current_area_lights }}"
- if: "{{ target_entities | length > 0 }}"
then:
- service: light.toggle
target: {entity_id: "{{ target_entities }}"}
# Color short
- conditions: "{{ trigger.id in ['color_green_short','color_red_short','color_blue_short'] }}"
sequence:
- variables:
target_entities: "{{ [current_light] if current_light != 'all' else current_area_lights }}"
color_map:
color_green_short: [85, 100]
color_red_short: [0, 100]
color_blue_short: [240, 100]
selected_color: "{{ color_map[trigger.id] }}"
- if: "{{ target_entities | length > 0 }}"
then:
- service: light.turn_on
target: {entity_id: "{{ target_entities }}"}
data: {hs_color: "{{ selected_color }}"}
# Color long (temp cycle)
- conditions: "{{ trigger.id in ['color_green_long','color_red_long','color_blue_long'] }}"
sequence:
- variables:
target_entities: "{{ [current_light] if current_light != 'all' else current_area_lights }}"
temp_ranges:
color_green_long: [200, 300]
color_red_long: [350, 454]
color_blue_long: [153, 250]
temp_range: "{{ temp_ranges[trigger.id] }}"
current_temp: >
{% if target_entities | length > 0 %}
{{ state_attr(target_entities[0], 'color_temp') | int(250) }}
{% else %}250{% endif %}
step_size: 30
new_temp: >
{% set min_temp = temp_range[0] %}
{% set max_temp = temp_range[1] %}
{% if current_temp < min_temp or current_temp >= max_temp %}
{{ min_temp }}
{% else %}
{{ current_temp + step_size }}
{% endif %}
- if: "{{ target_entities | length > 0 }}"
then:
- service: light.turn_on
target: {entity_id: "{{ target_entities }}"}
data: {color_temp: "{{ new_temp }}"}
# Save state (long press middle color)
- conditions: "{{ trigger.id == 'color_cycle_long' }}"
sequence:
- variables:
target_entities: "{{ [current_light] if current_light != 'all' else current_area_lights }}"
scene_name: "{{ 'eglo_remote_default_' + ('light' if current_light != 'all' else 'area') + '_state' }}"
- if: "{{ target_entities | length > 0 }}"
then:
- service: scene.create
data:
scene_id: "{{ scene_name }}"
snapshot_entities: "{{ target_entities }}"
- repeat:
count: 3
sequence:
- service: light.turn_on
target: {entity_id: "{{ target_entities }}"}
data: {brightness_pct: 100}
- delay: {milliseconds: 200}
- service: light.turn_off
target: {entity_id: "{{ target_entities }}"}
- delay: {milliseconds: 200}
# Dimming short
- conditions: "{{ trigger.id in ['dim_up_short','dim_down_short'] }}"
sequence:
- variables:
target_entities: "{{ [current_light] if current_light != 'all' else current_area_lights }}"
step: "{{ 5 if trigger.id == 'dim_up_short' else -5 }}"
- if: "{{ target_entities | length > 0 }}"
then:
- service: light.turn_on
target: {entity_id: "{{ target_entities }}"}
data: {brightness_step_pct: "{{ step }}"}
# Dimming long
- conditions: "{{ trigger.id in ['dim_up_long','dim_down_long'] }}"
sequence:
- variables:
target_entities: "{{ [current_light] if current_light != 'all' else current_area_lights }}"
target_level: "{{ 254 if trigger.id == 'dim_up_long' else 1 }}"
- if: "{{ target_entities | length > 0 }}"
then:
- service: light.turn_on
target: {entity_id: "{{ target_entities }}"}
data: {brightness: "{{ target_level }}", transition: 2}
# Color temp short
- conditions: "{{ trigger.id in ['color_temp_up_short','color_temp_down_short'] }}"
sequence:
- variables:
target_entities: "{{ [current_light] if current_light != 'all' else current_area_lights }}"
current_temp: >
{% if target_entities | length > 0 %}
{{ state_attr(target_entities[0], 'color_temp') | int(250) }}
{% else %}250{% endif %}
step: "{{ -20 if trigger.id == 'color_temp_up_short' else 20 }}"
new_temp: "{{ [153, [454, current_temp + step] | min] | max }}"
- if: "{{ target_entities | length > 0 }}"
then:
- service: light.turn_on
target: {entity_id: "{{ target_entities }}"}
data: {color_temp: "{{ new_temp }}"}
# Color temp long
- conditions: "{{ trigger.id in ['color_temp_up_long','color_temp_down_long'] }}"
sequence:
- variables:
target_entities: "{{ [current_light] if current_light != 'all' else current_area_lights }}"
target_temp: "{{ 153 if trigger.id == 'color_temp_up_long' else 454 }}"
- if: "{{ target_entities | length > 0 }}"
then:
- service: light.turn_on
target: {entity_id: "{{ target_entities }}"}
data: {color_temp: "{{ target_temp }}", transition: 1}
# Fav 1
- conditions: "{{ trigger.id == 'fav_1' }}"
sequence:
- if:
- condition: template
value_template: "{{ states('scene.eglo_remote_default_area_state') != 'unknown' }}"
then:
- service: scene.turn_on
target:
entity_id: scene.eglo_remote_default_area_state
# Fav 2
- conditions: "{{ trigger.id == 'fav_2' }}"
sequence:
- if:
- condition: template
value_template: "{{ states('scene.eglo_remote_default_light_state') != 'unknown' }}"
then:
- service: scene.turn_on
target:
entity_id: scene.eglo_remote_default_light_state
# Timeout
- conditions:
- "{{ trigger.id == 'timeout_check' }}"
- "{{ timeout_minutes > 0 }}"
- "{{ last_activity not in ['unknown','unavailable',''] }}"
- >
{% set last_time = last_activity | as_datetime %}
{{ last_time is not none and (now() - last_time).total_seconds() > (timeout_minutes * 60) }}
- "{{ current_area not in [default_area_id] }}"
sequence:
- choose:
- conditions: "{{ default_area_id in available_areas }}"
sequence:
- service: eglo_remote_zha.set_state
data:
device_id: "{{ remote_device_id }}"
key: current_area
value: "{{ default_area_id }}"
default:
- if:
- condition: template
value_template: "{{ available_areas | length > 0 }}"
then:
- service: eglo_remote_zha.set_state
data:
device_id: "{{ remote_device_id }}"
key: current_area
value: "{{ available_areas[0] }}"
- service: eglo_remote_zha.set_state
data:
device_id: "{{ remote_device_id }}"
key: current_light
value: "all"
- variables:
default_area_lights: "{{ area_entities(default_area_id) | select('match', '^light\\.') | list | sort if default_area_id else [] }}"
- if: "{{ default_area_lights | length > 0 }}"
then:
- service: light.turn_on
target: {entity_id: "{{ default_area_lights }}"}
data: {brightness_pct: 50}
- delay: {milliseconds: 200}
- service: light.turn_off
target: {entity_id: "{{ default_area_lights }}"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment