################################################################################
# PACKAGE: Master Bedroom Main Lights Switch Sync
################################################################################
#
# Version: 1.3
# Date: 2026-06-12
#
# Purpose:
#   Home Assistant fast-path sync for the two Master Bedroom Zemismart switches.
#
# Confirmed wiring/logic after live checks:
#   - North Lights real controller:
#       light.tasmo_ifan02_3793_bedrm1_1
#   - South Lights real physical load:
#       WEST switch Relay 2
#   - Relay 1 on both switches:
#       North Lights virtual/mirror/control
#   - Relay 2 on both switches:
#       South Lights control/mirror; WEST Relay 2 is the real physical load
#
# NOTE:
#   Entity IDs may retain their old names in HA after the ESPHome friendly-name change.
#   Confirm the final entity IDs in HA after flashing.
################################################################################

automation:
  ##############################################################################
  # Master Bedroom North Lights Sync
  ##############################################################################
  - id: master_bedroom_north_lights_3way_sync
    alias: Master Bedroom North Lights 3-Way Sync
    initial_state: true
    use_blueprint:
      path: zorruno/two_three_way_sync.yaml
      input:
        members:
          # SOUTH switch virtual North Lights control/mirror.
          - switch.master_bedroom_master_bedroom_main_lights_south_relay_1_master_bedroom_north_lights

          # WEST switch virtual North Lights control/mirror.
          - switch.master_bedroom_master_bedroom_main_lights_west_relay_1_master_bedroom_north_lights

          # Actual North Lights controller.
          - light.tasmo_ifan02_3793_bedrm1_1
        sync_on_start: false
        startup_delay: 5

  ##############################################################################
  # Master Bedroom South Lights Sync
  ##############################################################################
  - id: master_bedroom_south_lights_2way_sync
    alias: Master Bedroom South Lights 2-Way Sync
    initial_state: true
    use_blueprint:
      path: zorruno/two_three_way_sync.yaml
      input:
        members:
          # SOUTH switch virtual South Lights control/mirror.
          - switch.master_bedroom_master_bedroom_main_lights_south_relay_2_master_bedroom_south_lights

          # WEST switch physical South Lights relay.
          - switch.master_bedroom_master_bedroom_main_lights_west_relay_2_master_bedroom_south_lights
        sync_on_start: false
        startup_delay: 5
