blueprint: name: "Multi Switch Light Control Pro v1.10.1" description: > Turn a supported switch or remote into a smart light controller. Supports Inovelli Zigbee switches (via Zigbee2MQTT or ZHA), Zooz/Inovelli Z-Wave switches, and Lutron Pico remotes. Features intelligent hardware auto-detection that identifies specific device models (Zooz ZEN7x series, Inovelli Blue/Red, Lutron Pico 2/3/4/5-button) and auto-configures trigger mappings and control strategies based on device capabilities. Logs detected device profile with capabilities when diagnostics are enabled. domain: automation author: "Jeremy Carter" source_url: > https://github.com/schoolboyqueue/home-assistant-blueprints/blob/main/ multi-switch-light-control/multi_switch_light_control_pro.yaml input: core: name: Device & Lights icon: mdi:light-switch input: switch_device: name: "Switch or remote device" description: > REQUIRED. Select any Inovelli Zigbee switch (Zigbee2MQTT/ZHA), Zooz/Inovelli Z-Wave switch, or Lutron Pico remote. The blueprint auto-detects the protocol (Zigbee/Z-Wave/Lutron) and adapts triggers accordingly. selector: device: multiple: false zigbee_action_sensor: name: "Zigbee action sensor (auto-detected)" description: > OPTIONAL. For Zigbee switches only. The blueprint tries to auto-detect this, but if auto-detection fails, manually select the action sensor entity (e.g., sensor.switch_name_action). Leave at default (sun.sun) for Z-Wave/Lutron devices - the triggers will never match sun state values. default: sun.sun selector: entity: {} hold_release_helper: name: "Hold release helper (optional)" description: > OPTIONAL. For Z-Wave switches: Create a UNIQUE input_boolean helper for THIS automation to enable release detection during hold-to-dim. Without this, dim loops run until brightness limits. With this helper, releasing the button stops dimming immediately. Create via Settings | Devices & Services | Helpers | Toggle (e.g., input_boolean.kitchen_dimming_release). IMPORTANT: Each automation instance needs its own dedicated helper - do not share helpers across rooms. Leave at placeholder for Zigbee/Lutron (they have native release detection). default: input_boolean.placeholder_hold_release selector: entity: domain: input_boolean light_target: name: "Light entities" description: "Select one or more target lights. The first entry is used for brightness reads." selector: entity: domain: light multiple: true light_area: name: "Optional: Area target" description: "If set, actions target this area instead of the single light entity." default: "" selector: area: {} dimming: name: Dimming parameters icon: mdi:brightness-6 input: brightness_step_pct: name: "Brightness step (%)" description: "Amount to change the light each time the hold loop steps." default: 5 selector: number: min: 1 max: 50 step: 1 mode: slider unit_of_measurement: "%" dim_interval_ms: name: "Dim interval (ms)" description: "Delay between each brightness step while holding the paddle or a Lutron raise/lower button." default: 200 selector: number: min: 50 max: 1000 step: 10 mode: slider unit_of_measurement: "ms" min_on_brightness_pct: name: "Min on brightness when holding up (%)" description: "When the light is off, hold Up ensures it starts at least this bright." default: 10 selector: number: min: 1 max: 50 step: 1 mode: slider unit_of_measurement: "%" clamp_min_pct: name: "Clamp minimum brightness (%)" description: "Light turns off when dimming reaches this level or lower." default: 1 selector: number: min: 0 max: 50 step: 1 mode: slider unit_of_measurement: "%" clamp_max_pct: name: "Clamp maximum brightness (%)" description: "Logical cap for verbose logging and hold loops." default: 100 selector: number: min: 50 max: 100 step: 1 mode: slider unit_of_measurement: "%" scene_actions: name: Central Scene actions icon: mdi:gesture-tap input: up_press_1_action: name: "Up button press (1x)" description: "Optional custom action when the Up button is pressed once." selector: action: {} default: [] up_press_2_action: name: "Up button press (2x)" description: "Optional custom action when the Up button is pressed twice." selector: action: {} default: [] up_press_3_action: name: "Up button press (3x)" description: "Optional custom action when the Up button is pressed three times." selector: action: {} default: [] up_press_4_action: name: "Up button press (4x)" description: "Optional custom action when the Up button is pressed four times." selector: action: {} default: [] up_press_5_action: name: "Up button press (5x)" description: "Optional custom action when the Up button is pressed five times." selector: action: {} default: [] down_press_1_action: name: "Down button press (1x)" description: "Optional custom action when the Down button is pressed once." selector: action: {} default: [] down_press_2_action: name: "Down button press (2x)" description: "Optional custom action when the Down button is pressed twice." selector: action: {} default: [] down_press_3_action: name: "Down button press (3x)" description: "Optional custom action when the Down button is pressed three times." selector: action: {} default: [] down_press_4_action: name: "Down button press (4x)" description: "Optional custom action when the Down button is pressed four times." selector: action: {} default: [] down_press_5_action: name: "Down button press (5x)" description: "Optional custom action when the Down button is pressed five times." selector: action: {} default: [] lutron: name: Lutron Pico tuning icon: mdi:remote input: lutron_middle_button_action: name: "Middle (favorite) button action" description: "Optional sequence to run when the Pico favorite button is pressed." selector: action: {} default: [] lutron_middle_button_brightness_pct: name: "Middle button brightness" description: "Brightness level when the favorite button uses the default action." default: 80 selector: number: min: 1 max: 100 unit_of_measurement: "%" lutron_middle_button_kelvin: name: "Middle button color temperature" description: "Color temperature used when the default favorite action fires." default: 2800 selector: number: min: 1500 max: 40000 unit_of_measurement: kelvin lutron_middle_button_transition_s: name: "Middle button transition (seconds)" description: "Fade time when the favorite button executes the default action." default: 1 selector: number: min: 0 max: 10 unit_of_measurement: seconds lutron_on_transition_s: name: "Lutron On transition (seconds)" description: "Fade time when the Pico or a Central Scene on command turns the lights on." default: 1 selector: number: min: 0 max: 10 unit_of_measurement: seconds lutron_off_transition_s: name: "Lutron Off transition (seconds)" description: "Fade time when the Pico or a Central Scene off command turns the lights off." default: 2 selector: number: min: 0 max: 10 unit_of_measurement: seconds state_sync: name: Switch state sync icon: mdi:toggle-switch input: enable_state_sync: name: "Mirror switch state with lights" description: > When enabled, the blueprint watches the target lights and keeps the selected switch/light entity in sync (lights > 0% | switch on, all lights off | switch off). Useful when the physical switch controls smart lights via automations instead of a direct load. default: false selector: boolean: {} state_sync_switch_entity: name: "Switch entity override" description: > Optional override for the switch/light entity that should mirror the target lights. Leave blank to auto-detect the first `switch.` or `light.` entity that belongs to the selected device. default: switch.placeholder_state_sync selector: entity: multiple: false filter: - domain: switch - domain: light diagnostics: name: Diagnostics icon: mdi:bug-outline input: debug_level: name: "Debug level" description: "off: none, basic: key transitions, verbose: detailed brightness/clamp logging." default: "off" selector: select: mode: dropdown options: - "off" - "basic" - "verbose" variables: blueprint_version: "1.10.1" switch_device: !input switch_device zigbee_action_sensor_input: !input zigbee_action_sensor hold_release_helper_input: !input hold_release_helper hold_release_placeholder: "input_boolean.placeholder_hold_release" hold_release_helper_enabled: >- {{ hold_release_helper_input != hold_release_placeholder }} light_targets: !input light_target light_target_sequence: >- {% set lt = light_targets | default('') %} {% if lt is string and lt | length > 0 %} [lt] {% elif lt is sequence and (lt | length > 0) %} {{ lt }} {% else %} [] {% endif %} light_entity: >- {% set lt = light_targets | default('') %} {% if lt is string %} {{ lt }} {% elif lt is sequence and (lt | length > 0) %} {{ lt[0] }} {% else %} "" {% endif %} light_area_in: !input light_area step_pct_in: !input brightness_step_pct interval_ms_in: !input dim_interval_ms min_on_brightness_pct_in: !input min_on_brightness_pct clamp_min_pct_in: !input clamp_min_pct clamp_max_pct_in: !input clamp_max_pct up_press_1_action_input: !input up_press_1_action up_press_2_action_input: !input up_press_2_action up_press_3_action_input: !input up_press_3_action up_press_4_action_input: !input up_press_4_action up_press_5_action_input: !input up_press_5_action down_press_1_action_input: !input down_press_1_action down_press_2_action_input: !input down_press_2_action down_press_3_action_input: !input down_press_3_action down_press_4_action_input: !input down_press_4_action down_press_5_action_input: !input down_press_5_action lutron_middle_button_action_input: !input lutron_middle_button_action lutron_middle_button_brightness_pct_in: !input lutron_middle_button_brightness_pct lutron_middle_button_kelvin_in: !input lutron_middle_button_kelvin lutron_middle_button_transition_s_in: !input lutron_middle_button_transition_s lutron_on_transition_s_in: !input lutron_on_transition_s lutron_off_transition_s_in: !input lutron_off_transition_s debug_level_v: !input debug_level state_sync_enabled_input: !input enable_state_sync state_sync_switch_entity_input: !input state_sync_switch_entity state_sync_placeholder_entity: "switch.placeholder_state_sync" state_sync_autodetect_entity: >- {% if state_sync_switch_entity_input != state_sync_placeholder_entity %} {{ state_sync_switch_entity_input }} {% else %} {% set entities = device_entities(switch_device) %} {% set light_entities = entities | select('match', '^light\\.') | list %} {% set switch_entities = entities | select('match', '^switch\\.') | list %} {% if light_entities | length > 0 %} {{ light_entities[0] }} {% elif switch_entities | length > 0 %} {{ switch_entities[0] }} {% else %} "" {% endif %} {% endif %} state_sync_switch_entity: "{{ state_sync_autodetect_entity | default('', true) }}" state_sync_enabled: "{{ state_sync_enabled_input and (state_sync_switch_entity | length > 0) }}" step_pct: "{{ step_pct_in | float(5) }}" interval_ms: "{{ interval_ms_in | int(200) }}" min_on_brightness_pct_v: "{{ min_on_brightness_pct_in | float(10) }}" clamp_min_pct_v: "{{ clamp_min_pct_in | float(1) }}" clamp_max_pct_v: "{{ clamp_max_pct_in | float(100) }}" step_abs_value: "{{ (step_pct / 100.0 * 255) | round(0) | int }}" min_abs_brightness: "{{ (clamp_min_pct_v / 100.0 * 255) | round(0) | int }}" min_on_abs_brightness: "{{ (min_on_brightness_pct_v / 100.0 * 255) | round(0) | int }}" max_abs_brightness: "{{ (clamp_max_pct_v / 100.0 * 255) | round(0) | int }}" lutron_middle_button_brightness_pct: "{{ lutron_middle_button_brightness_pct_in | float(80) }}" lutron_middle_button_kelvin: "{{ lutron_middle_button_kelvin_in | int(2800) }}" lutron_middle_button_transition_s: "{{ lutron_middle_button_transition_s_in | float(1) }}" lutron_on_transition_s: "{{ lutron_on_transition_s_in | float(1) }}" lutron_off_transition_s: "{{ lutron_off_transition_s_in | float(2) }}" detected_name: "{{ device_attr(switch_device, 'name') | default('Unknown device') }}" detected_manufacturer: "{{ device_attr(switch_device, 'manufacturer') | default('Unknown vendor') }}" detected_model: "{{ device_attr(switch_device, 'model') | default('Unknown model') }}" detected_label: > {{ detected_name }} | {{ detected_manufacturer }} {{ detected_model }} lutron_serial: "{{ device_attr(switch_device, 'serial_number') | default('') }}" # Auto-detect or use manual Zigbee2MQTT/ZHA action sensor entity action_sensor_placeholder: "sun.sun" action_sensor_detection: >- {% set entities = device_entities(switch_device) %} {% set action_sensors = entities | select('match', '^sensor\\..*_action$') | list %} {% if action_sensors | length == 1 %} {{ action_sensors[0] }} {% elif action_sensors | length > 1 %} {% set slug = detected_name | default('') | lower | replace(' ', '_') %} {% set narrowed = namespace(items=[]) %} {% for sensor in action_sensors %} {% set sensor_l = sensor | lower %} {% if slug | length > 0 and (slug in sensor_l) %} {% set narrowed.items = narrowed.items + [sensor] %} {% endif %} {% endfor %} {% if narrowed.items | length == 1 %} {{ narrowed.items[0] }} {% else %} {{ '' }} {% endif %} {% else %} {{ '' }} {% endif %} action_sensor_entity: >- {% set provided = zigbee_action_sensor_input | default(action_sensor_placeholder) %} {% if provided != action_sensor_placeholder %} {{ provided }} {% elif action_sensor_detection is string and (action_sensor_detection | length > 0) %} {{ action_sensor_detection }} {% else %} {{ '' }} {% endif %} has_action_sensor: >- {% set ent = action_sensor_entity %} {{ ent is string and ent | length > 0 }} action_sensor_hint: > {% if not has_action_sensor and action_sensor_detection | length > 0 %} {{ action_sensor_detection }} {% else %} "" {% endif %} # Enhanced protocol detection: Zigbee2MQTT/ZHA, Z-Wave, or Lutron switch_type: > {% if has_action_sensor %} zigbee2mqtt {% else %} {% set manufacturer = detected_manufacturer | lower %} {% if 'lutron' in manufacturer %} lutron {% elif 'inovelli' in manufacturer %} inovelli {% elif 'zooz' in manufacturer %} zooz {% else %} generic {% endif %} {% endif %} # ============================================================================ # HARDWARE AUTO-DETECTION: Device Capability Registry # ============================================================================ # Identifies specific device models and provides auto-configured capabilities, # trigger mappings, and control strategies based on detected hardware. # ============================================================================ # Detect specific device profile based on manufacturer and model device_profile: >- {% set manu = detected_manufacturer | lower %} {% set model = detected_model | lower %} {% if 'zooz' in manu %} {% if 'zen71' in model or 'zen-71' in model %} zooz_zen71 {% elif 'zen72' in model or 'zen-72' in model %} zooz_zen72 {% elif 'zen73' in model or 'zen-73' in model %} zooz_zen73 {% elif 'zen74' in model or 'zen-74' in model %} zooz_zen74 {% elif 'zen76' in model or 'zen-76' in model %} zooz_zen76 {% elif 'zen77' in model or 'zen-77' in model %} zooz_zen77 {% else %} zooz_generic {% endif %} {% elif 'inovelli' in manu %} {% if 'vzm31' in model or 'blue' in model or '2-in-1' in model %} inovelli_blue_2in1 {% elif 'vzm35' in model or 'fan' in model %} inovelli_blue_fan {% elif 'lzw31' in model %} inovelli_red_dimmer {% elif 'lzw36' in model %} inovelli_red_fan_light {% elif 'lzw30' in model %} inovelli_red_switch {% elif has_action_sensor %} inovelli_zigbee_generic {% else %} inovelli_zwave_generic {% endif %} {% elif 'lutron' in manu %} {% if 'pj2-3brl' in model or '3-button' in model or '3 button' in model %} lutron_pico_3button {% elif 'pj2-4b' in model or '4-button' in model or '4 button' in model %} lutron_pico_4button {% elif 'pj2-2b' in model or '2-button' in model or '2 button' in model %} lutron_pico_2button {% else %} lutron_pico_5button {% endif %} {% else %} generic {% endif %} # Device capabilities registry - provides feature flags for each device profile device_capabilities: >- {% set profile = device_profile | trim %} {% set caps = namespace( max_multi_tap=5, has_led=false, has_config_button=false, has_dimming=true, has_scenes=true, has_hold=true, has_release_detection=false, protocol='unknown', control_strategy='standard', button_count=2, supports_double_tap=true, supports_triple_tap=true, supports_quad_tap=true, supports_quint_tap=true ) %} {% if profile.startswith('zooz_') %} {% set caps.protocol = 'zwave' %} {% set caps.has_scenes = true %} {% set caps.has_hold = true %} {% set caps.has_release_detection = false %} {% set caps.control_strategy = 'zwave_central_scene' %} {% if profile in ['zooz_zen72', 'zooz_zen74', 'zooz_zen77'] %} {% set caps.has_led = true %} {% set caps.has_dimming = true %} {% set caps.max_multi_tap = 5 %} {% elif profile in ['zooz_zen71', 'zooz_zen73', 'zooz_zen76'] %} {% set caps.has_led = true %} {% set caps.has_dimming = false %} {% set caps.max_multi_tap = 5 %} {% endif %} {% elif profile.startswith('inovelli_blue') %} {% set caps.protocol = 'zigbee' %} {% set caps.has_led = true %} {% set caps.has_config_button = true %} {% set caps.has_hold = true %} {% set caps.has_release_detection = true %} {% set caps.max_multi_tap = 5 %} {% set caps.control_strategy = 'zigbee_action' %} {% if profile == 'inovelli_blue_fan' %} {% set caps.button_count = 4 %} {% endif %} {% elif profile.startswith('inovelli_red') %} {% set caps.protocol = 'zwave' %} {% set caps.has_led = true %} {% set caps.has_config_button = true %} {% set caps.has_hold = true %} {% set caps.has_release_detection = false %} {% set caps.max_multi_tap = 5 %} {% set caps.control_strategy = 'zwave_central_scene' %} {% elif profile.startswith('inovelli_zigbee') %} {% set caps.protocol = 'zigbee' %} {% set caps.has_led = true %} {% set caps.has_hold = true %} {% set caps.has_release_detection = true %} {% set caps.max_multi_tap = 5 %} {% set caps.control_strategy = 'zigbee_action' %} {% elif profile.startswith('inovelli_zwave') %} {% set caps.protocol = 'zwave' %} {% set caps.has_led = true %} {% set caps.has_hold = true %} {% set caps.has_release_detection = false %} {% set caps.max_multi_tap = 5 %} {% set caps.control_strategy = 'zwave_central_scene' %} {% elif profile.startswith('lutron_pico') %} {% set caps.protocol = 'lutron' %} {% set caps.has_led = false %} {% set caps.has_hold = true %} {% set caps.has_release_detection = true %} {% set caps.has_dimming = true %} {% set caps.max_multi_tap = 1 %} {% set caps.supports_double_tap = false %} {% set caps.supports_triple_tap = false %} {% set caps.supports_quad_tap = false %} {% set caps.supports_quint_tap = false %} {% set caps.control_strategy = 'lutron_button' %} {% if profile == 'lutron_pico_2button' %} {% set caps.button_count = 2 %} {% elif profile == 'lutron_pico_3button' %} {% set caps.button_count = 3 %} {% elif profile == 'lutron_pico_4button' %} {% set caps.button_count = 4 %} {% else %} {% set caps.button_count = 5 %} {% endif %} {% else %} {% set caps.protocol = 'unknown' %} {% set caps.control_strategy = 'generic' %} {% endif %} { "profile": "{{ profile }}", "protocol": "{{ caps.protocol }}", "control_strategy": "{{ caps.control_strategy }}", "max_multi_tap": {{ caps.max_multi_tap }}, "button_count": {{ caps.button_count }}, "has_led": {{ caps.has_led | lower }}, "has_config_button": {{ caps.has_config_button | lower }}, "has_dimming": {{ caps.has_dimming | lower }}, "has_scenes": {{ caps.has_scenes | lower }}, "has_hold": {{ caps.has_hold | lower }}, "has_release_detection": {{ caps.has_release_detection | lower }}, "supports_double_tap": {{ caps.supports_double_tap | lower }}, "supports_triple_tap": {{ caps.supports_triple_tap | lower }}, "supports_quad_tap": {{ caps.supports_quad_tap | lower }}, "supports_quint_tap": {{ caps.supports_quint_tap | lower }} } # Parse device capabilities for use in templates device_caps_parsed: "{{ device_capabilities | from_json }}" # Convenience accessors for common capability checks device_has_release_detection: "{{ device_caps_parsed.has_release_detection | default(false) }}" device_max_multi_tap: "{{ device_caps_parsed.max_multi_tap | default(5) | int }}" device_control_strategy: "{{ device_caps_parsed.control_strategy | default('generic') }}" device_has_led: "{{ device_caps_parsed.has_led | default(false) }}" device_button_count: "{{ device_caps_parsed.button_count | default(2) | int }}" # Trigger mapping registry - defines which trigger IDs are valid for each control strategy trigger_mappings: >- {% set strategy = device_control_strategy %} {% if strategy == 'zwave_central_scene' %} { "on": ["up_single"], "off": ["down_single"], "brighten_start": ["up_hold_start"], "dim_start": ["down_hold_start"], "brighten_stop": ["up_release"], "dim_stop": ["down_release"], "double_up": ["up_double"], "double_down": ["down_double"], "triple_up": ["up_triple"], "triple_down": ["down_triple"], "quad_up": ["up_quad"], "quad_down": ["down_quad"], "quint_up": ["up_quint"], "quint_down": ["down_quint"] } {% elif strategy == 'zigbee_action' %} { "on": ["up_single", "up_single_z2m"], "off": ["down_single", "down_single_z2m"], "brighten_start": ["up_held_z2m", "up_hold_start"], "dim_start": ["down_held_z2m", "down_hold_start"], "brighten_stop": ["up_release_z2m", "up_release"], "dim_stop": ["down_release_z2m", "down_release"], "double_up": ["up_double", "up_double_z2m"], "double_down": ["down_double", "down_double_z2m"], "triple_up": ["up_triple", "up_triple_z2m"], "triple_down": ["down_triple", "down_triple_z2m"], "quad_up": ["up_quad", "up_quad_z2m"], "quad_down": ["down_quad", "down_quad_z2m"], "quint_up": ["up_quint", "up_quint_z2m"], "quint_down": ["down_quint", "down_quint_z2m"] } {% elif strategy == 'lutron_button' %} { "on": ["lutron_on"], "off": ["lutron_off"], "brighten_start": ["lutron_raise"], "dim_start": ["lutron_lower"], "brighten_stop": ["lutron_raise_release"], "dim_stop": ["lutron_lower_release"], "favorite": ["lutron_stop"] } {% else %} { "on": ["up_single", "up_single_z2m", "lutron_on"], "off": ["down_single", "down_single_z2m", "lutron_off"], "brighten_start": ["up_hold_start", "up_held_z2m", "lutron_raise"], "dim_start": ["down_hold_start", "down_held_z2m", "lutron_lower"] } {% endif %} # Recommended control parameters based on device type recommended_step_pct: >- {% set strategy = device_control_strategy %} {% if strategy == 'lutron_button' %} {{ 8 }} {% elif strategy == 'zigbee_action' %} {{ 5 }} {% else %} {{ 5 }} {% endif %} recommended_interval_ms: >- {% set strategy = device_control_strategy %} {% if strategy == 'lutron_button' %} {{ 150 }} {% elif strategy == 'zigbee_action' %} {{ 200 }} {% else %} {{ 200 }} {% endif %} area_set: > {% set a = light_area_in %} {{ a is string and a | length > 0 }} debug_enabled: "{{ debug_level_v in ['basic','verbose'] }}" debug_verbose: "{{ debug_level_v == 'verbose' }}" state_sync_any_light_on: >- {% set targets = light_target_sequence %} {% if targets | length == 0 %} {{ false }} {% else %} {% set ns = namespace(on=false) %} {% for ent in targets %} {% set ent_state = states(ent) %} {% if ent_state == 'on' %} {% set brightness = state_attr(ent, 'brightness') %} {% if brightness is none or (brightness | int(0)) > 0 %} {% set ns.on = true %} {% endif %} {% endif %} {% endfor %} {{ ns.on }} {% endif %} mode: parallel max_exceeded: silent trigger: - platform: event id: up_single event_type: zwave_js_event event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "001" value: 0 - platform: event id: up_single event_type: zwave_js_value_notification event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "001" value: "KeyPressed" - platform: event id: down_single event_type: zwave_js_event event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "002" value: 0 - platform: event id: down_single event_type: zwave_js_value_notification event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "002" value: "KeyPressed" - platform: event id: up_hold_start event_type: zwave_js_event event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "001" value: 2 - platform: event id: up_hold_start event_type: zwave_js_value_notification event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "001" value: "KeyHeldDown" - platform: event id: down_hold_start event_type: zwave_js_event event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "002" value: 2 - platform: event id: down_hold_start event_type: zwave_js_value_notification event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "002" value: "KeyHeldDown" - platform: event id: up_release event_type: zwave_js_event event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "001" value: 1 - platform: event id: up_release event_type: zwave_js_value_notification event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "001" value: "KeyReleased" - platform: event id: down_release event_type: zwave_js_event event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "002" value: 1 - platform: event id: down_release event_type: zwave_js_value_notification event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "002" value: "KeyReleased" - platform: event id: up_double event_type: zwave_js_event event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "001" value: 3 - platform: event id: up_double event_type: zwave_js_value_notification event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "001" value: "KeyPressed2x" - platform: event id: down_double event_type: zwave_js_event event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "002" value: 3 - platform: event id: down_double event_type: zwave_js_value_notification event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "002" value: "KeyPressed2x" - platform: event id: up_triple event_type: zwave_js_event event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "001" value: 4 - platform: event id: up_triple event_type: zwave_js_value_notification event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "001" value: "KeyPressed3x" - platform: event id: down_triple event_type: zwave_js_event event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "002" value: 4 - platform: event id: down_triple event_type: zwave_js_value_notification event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "002" value: "KeyPressed3x" - platform: event id: up_quad event_type: zwave_js_event event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "001" value: 5 - platform: event id: up_quad event_type: zwave_js_value_notification event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "001" value: "KeyPressed4x" - platform: event id: down_quad event_type: zwave_js_event event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "002" value: 5 - platform: event id: down_quad event_type: zwave_js_value_notification event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "002" value: "KeyPressed4x" - platform: event id: up_quint event_type: zwave_js_event event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "001" value: 6 - platform: event id: up_quint event_type: zwave_js_value_notification event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "001" value: "KeyPressed5x" - platform: event id: down_quint event_type: zwave_js_event event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "002" value: 6 - platform: event id: down_quint event_type: zwave_js_value_notification event_data: device_id: !input switch_device command_class_name: "Central Scene" property: "scene" property_key: "002" value: "KeyPressed5x" - platform: event event_type: lutron_caseta_button_event event_data: device_id: !input switch_device action: "press" button_type: "on" id: lutron_on - platform: event event_type: lutron_caseta_button_event event_data: device_id: !input switch_device action: "press" button_type: "raise" id: lutron_raise - platform: event event_type: lutron_caseta_button_event event_data: device_id: !input switch_device action: "press" button_type: "stop" id: lutron_stop - platform: event event_type: lutron_caseta_button_event event_data: device_id: !input switch_device action: "press" button_type: "lower" id: lutron_lower - platform: event event_type: lutron_caseta_button_event event_data: device_id: !input switch_device action: "press" button_type: "off" id: lutron_off - platform: event event_type: lutron_caseta_button_event event_data: device_id: !input switch_device action: "release" button_type: "raise" id: lutron_raise_release - platform: event event_type: lutron_caseta_button_event event_data: device_id: !input switch_device action: "release" button_type: "lower" id: lutron_lower_release # Zigbee2MQTT Device Actions (MQTT integration) - trigger: device device_id: !input switch_device domain: mqtt type: action subtype: up_single id: up_single_z2m - trigger: device device_id: !input switch_device domain: mqtt type: action subtype: down_single id: down_single_z2m - trigger: device device_id: !input switch_device domain: mqtt type: action subtype: up_double id: up_double_z2m - trigger: device device_id: !input switch_device domain: mqtt type: action subtype: down_double id: down_double_z2m - trigger: device device_id: !input switch_device domain: mqtt type: action subtype: up_triple id: up_triple_z2m - trigger: device device_id: !input switch_device domain: mqtt type: action subtype: down_triple id: down_triple_z2m - trigger: device device_id: !input switch_device domain: mqtt type: action subtype: up_quadruple id: up_quad_z2m - trigger: device device_id: !input switch_device domain: mqtt type: action subtype: down_quadruple id: down_quad_z2m - trigger: device device_id: !input switch_device domain: mqtt type: action subtype: up_quintuple id: up_quint_z2m - trigger: device device_id: !input switch_device domain: mqtt type: action subtype: down_quintuple id: down_quint_z2m - trigger: device device_id: !input switch_device domain: mqtt type: action subtype: up_held id: up_held_z2m - trigger: device device_id: !input switch_device domain: mqtt type: action subtype: down_held id: down_held_z2m - trigger: device device_id: !input switch_device domain: mqtt type: action subtype: up_release id: up_release_z2m - trigger: device device_id: !input switch_device domain: mqtt type: action subtype: down_release id: down_release_z2m # Zigbee2MQTT/ZHA state triggers (fire when the configured action sensor updates) # Defaults to a placeholder value so non-Zigbee setups remain valid - platform: state entity_id: !input zigbee_action_sensor to: "up_single" id: up_single_z2m - platform: state entity_id: !input zigbee_action_sensor to: "down_single" id: down_single_z2m - platform: state entity_id: !input zigbee_action_sensor to: "up_held" id: up_held_z2m - platform: state entity_id: !input zigbee_action_sensor to: "down_held" id: down_held_z2m - platform: state entity_id: !input zigbee_action_sensor to: "up_release" id: up_release_z2m - platform: state entity_id: !input zigbee_action_sensor to: "down_release" id: down_release_z2m - platform: state entity_id: !input zigbee_action_sensor to: "up_double" id: up_double_z2m - platform: state entity_id: !input zigbee_action_sensor to: "down_double" id: down_double_z2m - platform: state entity_id: !input zigbee_action_sensor to: "up_triple" id: up_triple_z2m - platform: state entity_id: !input zigbee_action_sensor to: "down_triple" id: down_triple_z2m - platform: state entity_id: !input zigbee_action_sensor to: "up_quadruple" id: up_quad_z2m - platform: state entity_id: !input zigbee_action_sensor to: "down_quadruple" id: down_quad_z2m - platform: state entity_id: !input zigbee_action_sensor to: "up_quintuple" id: up_quint_z2m - platform: state entity_id: !input zigbee_action_sensor to: "down_quintuple" id: down_quint_z2m - platform: state entity_id: !input light_target to: "on" id: state_sync_light_on - platform: state entity_id: !input light_target to: "off" id: state_sync_light_off condition: [] action: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: > Device detected: {{ detected_label }} | type={{ switch_type }} | profile={{ device_profile }} - if: - condition: template value_template: "{{ debug_verbose }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: > Device capabilities: strategy={{ device_control_strategy }} | protocol={{ device_caps_parsed.protocol }} | max_taps={{ device_max_multi_tap }} | buttons={{ device_button_count }} | release_detect={{ device_has_release_detection }} | has_led={{ device_has_led }} - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: > Trigger fired: id={{ trigger.id | default('unknown') }} | platform={{ trigger.platform | default('unknown') }} | switch_type={{ switch_type }} - if: - condition: template value_template: > {{ hold_release_helper_enabled and trigger.id in ['up_release','down_release','up_release_z2m','down_release_z2m'] }} then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: > Release detected: setting {{ hold_release_helper_input }}=on - service: input_boolean.turn_on target: entity_id: "{{ hold_release_helper_input }}" - if: - condition: template value_template: > {{ state_sync_enabled and trigger.id in ['state_sync_light_on','state_sync_light_off'] }} then: - if: - condition: template value_template: "{{ state_sync_any_light_on }}" then: - service: homeassistant.turn_on target: entity_id: "{{ state_sync_switch_entity }}" else: - service: homeassistant.turn_off target: entity_id: "{{ state_sync_switch_entity }}" - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: > State sync: switch={{ state_sync_switch_entity }} | state={{ 'on' if state_sync_any_light_on else 'off' }} - stop: "state sync completed" - if: - condition: template value_template: > {{ debug_verbose and trigger is defined and trigger.platform == 'event' and trigger.event is defined }} then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: > Debug: event_data={{ trigger.event.data | tojson }} - if: - condition: template value_template: > {{ debug_enabled and (not has_action_sensor) and (action_sensor_hint | length > 0) }} then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: > Warning: Zigbee action sensor candidate detected | sensor={{ action_sensor_hint }} | Set "Zigbee action sensor" input to enable triggers - if: - condition: template value_template: > {{ switch_type == 'lutron' and trigger.id == 'lutron_on' }} then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: lutron_on | light.turn_on" - if: - condition: template value_template: "{{ area_set }}" then: - service: light.turn_on target: area_id: "{{ light_area_in }}" data: brightness_pct: 100 transition: "{{ lutron_on_transition_s }}" else: - repeat: for_each: "{{ light_target_sequence }}" sequence: - service: light.turn_on target: entity_id: "{{ repeat.item }}" data: brightness_pct: 100 transition: "{{ lutron_on_transition_s }}" - if: - condition: template value_template: > {{ switch_type == 'lutron' and trigger.id == 'lutron_raise' }} then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: lutron_raise | hold brighten" - repeat: sequence: - if: - condition: template value_template: "{{ area_set }}" then: - service: light.turn_on target: area_id: "{{ light_area_in }}" data: brightness_step_pct: "{{ step_pct }}" continue_on_error: true else: - repeat: for_each: "{{ light_target_sequence }}" sequence: - service: light.turn_on target: entity_id: "{{ repeat.item }}" data: brightness_step_pct: "{{ step_pct }}" continue_on_error: true - wait_for_trigger: - platform: event event_type: lutron_caseta_button_event event_data: device_id: !input switch_device action: "release" button_type: "raise" timeout: milliseconds: "{{ interval_ms }}" continue_on_timeout: true - if: - condition: template value_template: > {{ wait is defined and wait.completed }} then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: lutron_raise release | stop brighten" - stop: until: - condition: template value_template: "{{ state_attr(light_entity, 'brightness') | int(0) > 254 }}" - if: - condition: template value_template: > {{ switch_type == 'lutron' and trigger.id == 'lutron_stop' }} then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: lutron_stop | favorite button" - if: - condition: template value_template: > {{ lutron_middle_button_action_input is defined and lutron_middle_button_action_input | length > 0 }} then: - sequence: !input lutron_middle_button_action else: - if: - condition: template value_template: "{{ area_set }}" then: - service: light.turn_on target: area_id: "{{ light_area_in }}" data: brightness_pct: "{{ lutron_middle_button_brightness_pct }}" kelvin: "{{ lutron_middle_button_kelvin }}" transition: "{{ lutron_middle_button_transition_s }}" else: - repeat: for_each: "{{ light_target_sequence }}" sequence: - service: light.turn_on target: entity_id: "{{ repeat.item }}" data: brightness_pct: "{{ lutron_middle_button_brightness_pct }}" kelvin: "{{ lutron_middle_button_kelvin }}" transition: "{{ lutron_middle_button_transition_s }}" - if: - condition: template value_template: > {{ switch_type == 'lutron' and trigger.id == 'lutron_lower' }} then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: lutron_lower | hold dim" - repeat: sequence: - if: - condition: template value_template: "{{ area_set }}" then: - service: light.turn_on target: area_id: "{{ light_area_in }}" data: brightness_step_pct: "{{ step_pct * -1 }}" continue_on_error: true else: - repeat: for_each: "{{ light_target_sequence }}" sequence: - service: light.turn_on target: entity_id: "{{ repeat.item }}" data: brightness_step_pct: "{{ step_pct * -1 }}" continue_on_error: true - wait_for_trigger: - platform: event event_type: lutron_caseta_button_event event_data: device_id: !input switch_device action: "release" button_type: "lower" timeout: milliseconds: "{{ interval_ms }}" continue_on_timeout: true - if: - condition: template value_template: > {{ wait is defined and wait.completed }} then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: lutron_lower release | stop dim" - stop: until: - condition: template value_template: "{{ state_attr(light_entity, 'brightness') | int(0) < 1 }}" - if: - condition: template value_template: > {{ switch_type == 'lutron' and trigger.id == 'lutron_off' }} then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: lutron_off | light.turn_off" - if: - condition: template value_template: "{{ area_set }}" then: - service: light.turn_off target: area_id: "{{ light_area_in }}" data: transition: "{{ lutron_off_transition_s }}" else: - repeat: for_each: "{{ light_target_sequence }}" sequence: - service: light.turn_off target: entity_id: "{{ repeat.item }}" data: transition: "{{ lutron_off_transition_s }}" - if: - condition: template value_template: > {{ switch_type != 'lutron' and trigger.id in ['up_single', 'up_single_z2m'] }} then: - if: - condition: template value_template: "{{ up_press_1_action_input | length > 0 }}" then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: up_single | custom action" - sequence: !input up_press_1_action else: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: up_single | light.turn_on | brightness=100%" - if: - condition: template value_template: "{{ area_set }}" then: - service: light.turn_on target: area_id: "{{ light_area_in }}" data: brightness_pct: 100 transition: "{{ lutron_on_transition_s }}" else: - repeat: for_each: "{{ light_target_sequence }}" sequence: - service: light.turn_on target: entity_id: "{{ repeat.item }}" data: brightness_pct: 100 transition: "{{ lutron_on_transition_s }}" - if: - condition: template value_template: > {{ switch_type != 'lutron' and trigger.id in ['down_single', 'down_single_z2m'] }} then: - if: - condition: template value_template: "{{ down_press_1_action_input | length > 0 }}" then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: down_single | custom action" - sequence: !input down_press_1_action else: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: down_single | light.turn_off" - if: - condition: template value_template: "{{ area_set }}" then: - service: light.turn_off target: area_id: "{{ light_area_in }}" data: transition: "{{ lutron_off_transition_s }}" else: - repeat: for_each: "{{ light_target_sequence }}" sequence: - service: light.turn_off target: entity_id: "{{ repeat.item }}" data: transition: "{{ lutron_off_transition_s }}" - if: - condition: template value_template: > {{ switch_type != 'lutron' and trigger.id in ['up_hold_start', 'up_held_z2m'] }} then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: up_hold_start | begin brighten" - if: - condition: template value_template: "{{ hold_release_helper_enabled }}" then: - service: input_boolean.turn_off target: entity_id: "{{ hold_release_helper_input }}" - condition: template value_template: "{{ states(light_entity) not in ['unknown','unavailable',''] }}" - variables: was_off_initially: "{{ is_state(light_entity, 'off') }}" - if: - condition: template value_template: "{{ was_off_initially }}" then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Light OFF: starting at min_on_brightness={{ min_on_brightness_pct_v | int }}%" - if: - condition: template value_template: "{{ area_set }}" then: - service: light.turn_on target: area_id: "{{ light_area_in }}" data: brightness: "{{ min_on_abs_brightness | int }}" else: - repeat: for_each: "{{ light_target_sequence }}" sequence: - service: light.turn_on target: entity_id: "{{ repeat.item }}" data: brightness: "{{ min_on_abs_brightness | int }}" - delay: milliseconds: 100 - repeat: sequence: - condition: template value_template: "{{ states(light_entity) not in ['off','unknown','unavailable'] }}" - variables: current_brightness: "{{ state_attr(light_entity,'brightness') | int(min_on_abs_brightness) }}" is_first_iteration: "{{ was_off_initially and repeat.index == 1 }}" target_brightness: > {% if was_off_initially and repeat.index == 1 %} {{ min_on_abs_brightness | int }} {% else %} {% set cur_bri = state_attr(light_entity,'brightness') | int(min_on_abs_brightness | int) %} {% set proposed = cur_bri + (step_abs_value | int) %} {{ [proposed, max_abs_brightness | int] | min }} {% endif %} - if: - condition: template value_template: "{{ hold_release_helper_enabled and is_state(hold_release_helper_input, 'on') }}" then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Release detected: stop brighten" - stop: "Button released" - if: - condition: template value_template: "{{ target_brightness > current_brightness and not is_first_iteration }}" then: - if: - condition: template value_template: "{{ area_set }}" then: - service: light.turn_on target: area_id: "{{ light_area_in }}" data: brightness: "{{ target_brightness | int }}" else: - repeat: for_each: "{{ light_target_sequence }}" sequence: - service: light.turn_on target: entity_id: "{{ repeat.item }}" data: brightness: "{{ target_brightness | int }}" - if: - condition: template value_template: "{{ debug_verbose }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Brighten step: target={{ target_brightness }}/255 | current={{ current_brightness }}/255 | cap={{ max_abs_brightness }}" - delay: milliseconds: "{{ interval_ms }}" until: - condition: template value_template: > {{ target_brightness >= max_abs_brightness }} - if: - condition: template value_template: > {{ switch_type != 'lutron' and trigger.id in ['down_hold_start', 'down_held_z2m'] }} then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: down_hold_start | begin dim" - if: - condition: template value_template: "{{ hold_release_helper_enabled }}" then: - service: input_boolean.turn_off target: entity_id: "{{ hold_release_helper_input }}" - repeat: sequence: - variables: current_brightness: "{{ state_attr(light_entity,'brightness') | int(0) }}" target_brightness: > {% set cur_bri = state_attr(light_entity,'brightness') | int(0) %} {% set proposed = cur_bri - (step_abs_value | int) %} {{ [proposed, 0] | max }} - if: - condition: template value_template: "{{ hold_release_helper_enabled and is_state(hold_release_helper_input, 'on') }}" then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Release detected: stop dim" - stop: "Button released" - if: - condition: template value_template: "{{ is_state(light_entity, 'on') and target_brightness > min_abs_brightness }}" then: - if: - condition: template value_template: "{{ target_brightness < current_brightness }}" then: - if: - condition: template value_template: "{{ area_set }}" then: - service: light.turn_on target: area_id: "{{ light_area_in }}" data: brightness: "{{ target_brightness | int }}" else: - repeat: for_each: "{{ light_target_sequence }}" sequence: - service: light.turn_on target: entity_id: "{{ repeat.item }}" data: brightness: "{{ target_brightness | int }}" - if: - condition: template value_template: "{{ debug_verbose }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Dim step: target={{ target_brightness }}/255 | current={{ current_brightness }}/255 | min={{ min_abs_brightness }}" else: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Dim complete: brightness<=min_clamp | light.turn_off" - if: - condition: template value_template: "{{ area_set }}" then: - service: light.turn_off target: area_id: "{{ light_area_in }}" else: - repeat: for_each: "{{ light_target_sequence }}" sequence: - service: light.turn_off target: entity_id: "{{ repeat.item }}" - stop: "Dim hold reached minimum; turning off" - delay: milliseconds: "{{ interval_ms }}" until: - condition: template value_template: > {{ target_brightness <= min_abs_brightness }} - if: - condition: template value_template: > {{ switch_type != 'lutron' and trigger.id in ['up_double', 'up_double_z2m'] }} then: - if: - condition: template value_template: "{{ up_press_2_action_input | length > 0 }}" then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: up_double | custom action" - sequence: !input up_press_2_action else: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: up_double | run custom action" - if: - condition: template value_template: > {{ switch_type != 'lutron' and trigger.id in ['down_double', 'down_double_z2m'] }} then: - if: - condition: template value_template: "{{ down_press_2_action_input | length > 0 }}" then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: down_double | custom action" - sequence: !input down_press_2_action else: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: down_double | run custom action" - if: - condition: template value_template: > {{ switch_type != 'lutron' and trigger.id in ['up_triple', 'up_triple_z2m'] }} then: - if: - condition: template value_template: "{{ up_press_3_action_input | length > 0 }}" then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: up_triple | custom action" - sequence: !input up_press_3_action else: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: up_triple | run custom action" - if: - condition: template value_template: > {{ switch_type != 'lutron' and trigger.id in ['down_triple', 'down_triple_z2m'] }} then: - if: - condition: template value_template: "{{ down_press_3_action_input | length > 0 }}" then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: down_triple | custom action" - sequence: !input down_press_3_action else: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: down_triple | run custom action" - if: - condition: template value_template: > {{ switch_type != 'lutron' and trigger.id in ['up_quad', 'up_quad_z2m'] }} then: - if: - condition: template value_template: "{{ up_press_4_action_input | length > 0 }}" then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: up_quad | custom action" - sequence: !input up_press_4_action else: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: up_quad | no action defined" - if: - condition: template value_template: > {{ switch_type != 'lutron' and trigger.id in ['down_quad', 'down_quad_z2m'] }} then: - if: - condition: template value_template: "{{ down_press_4_action_input | length > 0 }}" then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: down_quad | custom action" - sequence: !input down_press_4_action else: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: down_quad | no action defined" - if: - condition: template value_template: > {{ switch_type != 'lutron' and trigger.id in ['up_quint', 'up_quint_z2m'] }} then: - if: - condition: template value_template: "{{ up_press_5_action_input | length > 0 }}" then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: up_quint | custom action" - sequence: !input up_press_5_action else: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: up_quint | no action defined" - if: - condition: template value_template: > {{ switch_type != 'lutron' and trigger.id in ['down_quint', 'down_quint_z2m'] }} then: - if: - condition: template value_template: "{{ down_press_5_action_input | length > 0 }}" then: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: down_quint | custom action" - sequence: !input down_press_5_action else: - if: - condition: template value_template: "{{ debug_enabled }}" then: - service: logbook.log data: name: "Multi Switch Light" entity_id: "{{ light_entity }}" message: "Action: down_quint | no action defined"