- id: '1699262077436' alias: Turn on Bedroom Radio1 at 6:30 and 23:00 description: Turn on Bedroom Radio1 at 6:30 and 23:00 trigger: - platform: time at: 06:30:00 - platform: time at: '23:03:00' condition: [] action: - service: switch.turn_on data: {} target: entity_id: switch.radio_power_socket_1 mode: single - id: '1699262306676' alias: Turn off Bedroom Radio at 8:15 and 12:35 description: Turn off Bedroom Radio at 8:15 and 12:35 trigger: - platform: time at: 08:15:00 - platform: time at: 00:33:00 condition: [] action: - service: switch.turn_off data: {} target: entity_id: switch.radio_power_socket_1 mode: single - id: '1705771204656' alias: Turn off Living room Radio when switched on TV description: Turn off Living room Radio when switched on TV trigger: - platform: state entity_id: - media_player.samsung_tv to: 'on' for: hours: 0 minutes: 0 seconds: 10 condition: [] action: - service: switch.turn_off data: {} target: entity_id: - switch.radio_power_socket_1 mode: single - id: '1713416980448' alias: Sync Living room Radio Power with Virtual Switches description: Living room Radio Power (Apple sync with Tuya and SmartThings) trigger: - platform: state entity_id: switch.outlet_1c8c29 for: seconds: 0.5 to: - 'off' - 'on' - platform: state entity_id: switch.virtual_switch_2_socket for: seconds: 0.5 to: - 'off' - 'on' - platform: state entity_id: switch.radio1_power for: seconds: 0.5 to: - 'off' - 'on' action: - service_template: switch.turn_{{ trigger.to_state.state }} data: entity_id: "{% if trigger.entity_id == 'switch.outlet_1c8c29' %}\n switch.virtual_switch_2_socket, switch.radio1_power\n{% elif trigger.entity_id == 'switch.virtual_switch_2_socket' %}\n switch.outlet_1c8c29, switch.radio1_power\n{% else %}\n switch.outlet_1c8c29, switch.virtual_switch_2_socket\n{% endif %}\n" - id: '1713418048424' alias: Sync Dinning room Speaker Power with Virtual Switches description: Syncs speaker power switches trigger: - platform: state entity_id: - switch.sonoff_10025eddd6_1 - switch.virtual_switch_3_switch_1 - switch.speaker_power_switch for: seconds: 0.5 to: - 'off' - 'on' action: - choose: - conditions: '{{ trigger.entity_id == ''switch.sonoff_10025eddd6_1'' }}' sequence: - service: switch.turn_{{ states(trigger.entity_id) }} target: entity_id: - switch.virtual_switch_3_switch_1 - switch.speaker_power_switch - conditions: '{{ trigger.entity_id == ''switch.virtual_switch_3_switch_1'' }}' sequence: - service: switch.turn_{{ states(trigger.entity_id) }} target: entity_id: - switch.sonoff_10025eddd6_1 - switch.speaker_power_switch - conditions: '{{ trigger.entity_id == ''switch.speaker_power_switch'' }}' sequence: - service: switch.turn_{{ states(trigger.entity_id) }} target: entity_id: - switch.sonoff_10025eddd6_1 - switch.virtual_switch_3_switch_1 - id: '1713418381546' alias: Sync Bedroom Light with Virtual Switches description: Bedroom Light (Sonoff sync with Tuya and SmartThings) triggers: - entity_id: switch.sonoff_1001812d90_1 for: seconds: 0.2 to: - 'off' - 'on' trigger: state - entity_id: switch.virtual_switch_1_switch_1 for: seconds: 0.2 to: - 'off' - 'on' trigger: state - entity_id: switch.bedroom_light for: seconds: 0.2 to: - 'off' - 'on' trigger: state actions: - service_template: switch.turn_{{ trigger.to_state.state }} data: entity_id: "{% if trigger.entity_id == 'switch.sonoff_1001812d90_1' %}\n switch.virtual_switch_1_switch_1, switch.bedroom_light\n{% elif trigger.entity_id == 'switch.virtual_switch_1_switch_1' %}\n switch.sonoff_1001812d90_1, switch.bedroom_light\n{% else %}\n switch.sonoff_1001812d90_1, switch.virtual_switch_1_switch_1\n{% endif %}\n" mode: single - id: '1713447285982' alias: Sync Entryway Light with Virtual Switch description: Entryway Light (Tuya sync with SmartThings) trigger: - platform: state entity_id: switch.sw2chzbl_en1_switch_1 for: seconds: 0.5 to: - 'off' - 'on' - platform: state entity_id: switch.entryway_light for: seconds: 0.5 to: - 'off' - 'on' action: - service_template: switch.turn_{{ trigger.to_state.state }} data: entity_id: "{% if trigger.entity_id == 'switch.sw2chzbl_en1_switch_1' %}\n switch.entryway_light\n{% else %}\n switch.sw2chzbl_en1_switch_1\n{% endif %}\n" - id: '1713447416072' alias: Sync Dining Room Light with Virtual Switch description: Dining room Light (Tuya sync with SmartThings) trigger: - platform: state entity_id: - switch.sw3chzbl_di1_switch_1 for: seconds: 0.5 to: - 'off' - 'on' action: - choose: - conditions: '{{ states(''switch.dinningroom_light'') == states(''switch.sw3chzbl_di1_switch_1'') }}' sequence: - service: switch.turn_!{{ states(trigger.entity_id) }} target: entity_id: switch.dinningroom_light mode: single - id: '1713447510766' alias: Sync Kitchen Light with Virtual Switch description: Kitchen Light (Tuya sync with SmartThings) trigger: - platform: state entity_id: switch.sw3chzbl_di1_switch_3 for: seconds: 0.5 to: - 'off' - 'on' - platform: state entity_id: switch.kitchen_light for: seconds: 0.5 to: - 'off' - 'on' action: - service_template: switch.turn_{{ trigger.to_state.state }} data: entity_id: "{% if trigger.entity_id == 'switch.sw3chzbl_di1_switch_3' %}\n switch.kitchen_light\n{% else %}\n switch.sw3chzbl_di1_switch_3\n{% endif %}\n" - id: '1713447585166' alias: Sync Living room Light with Virtual Switch description: Living room Light (Tuya sync with SmartThings) trigger: - platform: state entity_id: switch.sw3chzbl_di1_switch_2 for: seconds: 0.5 to: - 'off' - 'on' - platform: state entity_id: switch.livingroom_light for: seconds: 0.5 to: - 'off' - 'on' action: - service_template: switch.turn_{{ trigger.to_state.state }} data: entity_id: "{% if trigger.entity_id == 'switch.sw3chzbl_di1_switch_2' %}\n switch.livingroom_light\n{% else %}\n switch.sw3chzbl_di1_switch_2\n{% endif %}\n" - id: '1713447728550' alias: Sync bathroom Light with Virtual Switch description: Bathroom Light (Sonoff sync with SmartThings) triggers: - entity_id: switch.sonoff_1000b0614c_2 for: seconds: 0.2 to: - 'off' - 'on' trigger: state - entity_id: switch.bathroom_light for: seconds: 0.2 to: - 'off' - 'on' trigger: state actions: - service_template: switch.turn_{{ trigger.to_state.state }} data: entity_id: "{% if trigger.entity_id == 'switch.sonoff_1000b0614c_2' %}\n switch.bathroom_light\n{% else %}\n switch.sonoff_1000b0614c_2\n{% endif %}\n" - id: '1713447803350' alias: Sync Corridor Light with Virtual Switches description: Corridor Light (Sonoff sync with Tuya and SmartThings) triggers: - entity_id: switch.sonoff_1000b0614c_1 for: seconds: 0.2 to: - 'off' - 'on' trigger: state - entity_id: switch.virtual_switch_2_socket for: seconds: 0.2 to: - 'off' - 'on' trigger: state - entity_id: switch.corridor_light for: seconds: 0.2 to: - 'off' - 'on' trigger: state actions: - service_template: switch.turn_{{ trigger.to_state.state }} data: entity_id: "{% if trigger.entity_id == 'switch.sonoff_1000b0614c_1' %}\n switch.virtual_switch_2_socket, switch.corridor_light\n{% elif trigger.entity_id == 'switch.virtual_switch_2_socket' %}\n switch.sonoff_1000b0614c_1, switch.corridor_light\n{% else %}\n switch.sonoff_1000b0614c_1, switch.virtual_switch_2_socket\n{% endif %}\n" mode: single - id: '1713447869024' alias: Sync Study Light with Virtual Switch description: Study Light (Sonoff sync with SmartThings) trigger: - platform: state entity_id: switch.sonoff_1000f1dd7a for: seconds: 0.5 to: - 'off' - 'on' - platform: state entity_id: switch.study_light for: seconds: 0.5 to: - 'off' - 'on' action: - service_template: switch.turn_{{ trigger.to_state.state }} data: entity_id: "{% if trigger.entity_id == 'switch.sonoff_1000f1dd7a' %}\n switch.study_light\n{% else %}\n switch.sonoff_1000f1dd7a\n{% endif %}\n" - id: '1713451866250' alias: Sync Radio2 Power with Virtual Switch description: Bedroom Radio Power off/on (Tuya sync with SmartThings) trigger: - platform: state entity_id: switch.radio_power_socket_1 for: seconds: 3 to: - 'off' - 'on' - platform: state entity_id: switch.radio2_power for: seconds: 3 to: - 'off' - 'on' action: - service_template: switch.turn_{{ trigger.to_state.state }} data: entity_id: "{% if trigger.entity_id == 'switch.radio_power_socket_1' %}\n switch.radio2_power\n{% else %}\n switch.radio_power_socket_1\n{% endif %}\n" - id: '1713452314954' alias: Sync Panasonic Fan with Virtual Switch (ST) description: Panasonic Fan (Tuya sync withh SmartThings) trigger: - platform: state entity_id: fan.virtual_fan for: seconds: 0.5 to: - 'off' - 'on' - platform: state entity_id: switch.panasonic_fan for: seconds: 0.5 to: - 'off' - 'on' action: - service_template: switch.turn_{{ trigger.to_state.state }} data: entity_id: "{% if trigger.entity_id == 'fan.virtual_fan' %}\n switch.panasonic_fan\n{% else %}\n fan.virtual_fan\n{% endif %}\n" - service: scene.turn_on data: entity_id: "{% if trigger.entity_id == 'switch.panasonic_fan' %}\n scene.feng_shan_dian_che\n{% endif %} \n" - id: '1714391352225' alias: Xiaomi Fan sync with SmartThings description: Xiaomi Fan (Xiaomi sync withh SmartThings) trigger: - platform: state entity_id: switch.xiaomi_fan for: seconds: 2 to: - 'off' - 'on' - platform: state entity_id: fan.xiaomi_smart_fan for: seconds: 2 to: - 'off' - 'on' condition: [] action: - service_template: switch.turn_{{ trigger.to_state.state }} data: entity_id: "{% if trigger.entity_id == 'switch.xiaomi_fan' %}\n fan.xiaomi_smart_fan\n{% else %}\n switch.xiaomi_fan\n{% endif %} \n" mode: single - id: '1727946494900' alias: Living room Radio2 on -> Bedroom Radio1 off description: Living room Radio2 on -> Bedroom Radio1 off trigger: - platform: state entity_id: - switch.outlet_1c8c29 for: hours: 0 minutes: 0 seconds: 3 to: 'on' condition: [] action: - service: switch.turn_off data: {} target: device_id: 5d52ffd05a0005ca62cd4aadeb17a968 mode: single - id: '1727946691300' alias: Bedroom Radio1 on -> off Living room Radio2 description: Bedroom Radio1 on -> off Living room Radio2 trigger: - platform: state entity_id: - switch.radio_power_socket_1 for: hours: 0 minutes: 0 seconds: 3 to: 'on' condition: [] action: - service: switch.turn_off data: {} target: device_id: 72bb5e8b4708b3f6ccff0e51c8cb04a1 mode: single - id: '1753845716720' alias: Capture NeoV on Motion (Guard Mode) description: Takes snapshot when NeoV camera detects motion trigger: - platform: state entity_id: - binary_sensor.neov_motion_active to: 'on' condition: - condition: state entity_id: input_boolean.guard_mode state: 'on' action: - service: switch.turn_on data: {} target: entity_id: switch.sw2chzbl_en1_switch_1 - service: camera.snapshot data: filename: /config/media/captures/{{ now().strftime('%Y%m%d_%H%M') }}_NeoV.jpg target: entity_id: camera.neov - delay: 00:00:02 - service: notify.mobile_app_sm_g9880 data: message: NeoV Camera at {{ now().strftime('%H:%M') }} title: Motion Detected! data: image: /media/local/captures/{{ now().strftime('%Y%m%d_%H%M') }}_NeoV.jpg - id: '1753864042861' alias: Clean Old Camera Captures description: '' trigger: - platform: time at: 03:00:00 action: - service: shell_command.purge_captures - id: '1753865898030' alias: Capture ACE on motion (Guard Mode) description: Takes snapshot when ACE camera detects motion trigger: - platform: state entity_id: - binary_sensor.ace_motion_active to: 'on' condition: - condition: state entity_id: input_boolean.guard_mode state: 'on' action: - service: camera.snapshot data: filename: /config/media/captures/{{ now().strftime('%Y%m%d_%H%M') }}_ACE.jpg target: entity_id: camera.ace - delay: 00:00:02 - service: notify.mobile_app_sm_g9880 data: message: ACE Camera at {{ now().strftime('%H:%M') }} title: Motion Detected! data: image: /media/local/captures/{{ now().strftime('%Y%m%d_%H%M') }}_ACE.jpg - id: '1753866319244' alias: Capture Mi3W on motion (Guard Mode) description: Takes snapshot when Mi3W camera detects motion trigger: - platform: state entity_id: - binary_sensor.mi3w_motion_active to: 'on' condition: - condition: state entity_id: input_boolean.guard_mode state: 'on' action: - service: camera.snapshot data: filename: /config/media/captures/{{ now().strftime('%Y%m%d_%H%M') }}_Mi3W.jpg target: entity_id: camera.mi3w - delay: 00:00:02 - service: notify.mobile_app_sm_g9880 data: message: NeoV Camera at {{ now().strftime('%H:%M') }} title: Motion Detected! data: image: /media/local/captures/{{ now().strftime('%Y%m%d_%H%M') }}_Mi3W.jpg - id: '1753872625911' alias: Nightly Guard Mode Schedule description: Activates guard mode from 00:01-07:00 daily trigger: - platform: time at: 00:01:00 - platform: time at: 07:00:00 - platform: state entity_id: - binary_sensor.gs20u_presence to: Home - platform: state entity_id: - binary_sensor.gs20u_presence to: Away action: - variables: context: "{% if trigger.platform == \"time\" and trigger.at == \"00:01:00\" %}\n nightly_activation\n{% elif trigger.platform == \"time\" and trigger.at == \"07:00:00\" %}\n morning_deactivation\n{% elif trigger.platform == \"state\" and trigger.to_state.state == \"on\" %}\n arrived_home\n{% elif trigger.platform == \"state\" and trigger.to_state.state == \"off\" %}\n left_home\n{% else %}\n manual_trigger\n{% endif %}\n" message: "{% if context == \"nightly_activation\" %}\n \U0001F319 Guard mode activated for the night\n{% elif context == \"morning_deactivation\" %}\n \ ☀️ Guard mode deactivated for the day\n{% elif context == \"arrived_home\" %}\n \U0001F3E0 Guard mode deactivated (arrived home)\n{% elif context == \"left_home\" %}\n \U0001F6AA Guard mode activated (left home)\n{% else %}\n \ Manual triggered\n{% endif %}\n" - choose: - conditions: - '{{ context == ''manual_trigger'' }}' - '{{ now().hour >= 7 and now().hour < 0 }}' sequence: - service: input_boolean.turn_off target: entity_id: input_boolean.guard_mode data: {} - service: notify.mobile_app_sm_g9880 data: message: '{{ message }}' - conditions: - '{{ context == ''manual_trigger'' }}' - '{{ now().hour >= 0 and now().hour < 7 }}' sequence: - service: input_boolean.turn_on target: entity_id: input_boolean.guard_mode data: {} - service: notify.mobile_app_sm_g9880 data: message: '{{ message }}' - conditions: - '{{ context == ''nightly_activation'' }}' sequence: - service: input_boolean.turn_on target: entity_id: input_boolean.guard_mode data: {} - service: notify.mobile_app_sm_g9880 data: message: '{{ message }}' - conditions: - '{{ context == ''morning_deactivation'' }}' sequence: - service: input_boolean.turn_off target: entity_id: input_boolean.guard_mode data: {} - service: notify.mobile_app_sm_g9880 data: message: '{{ message }}' - if: - condition: template value_template: '{{ context in [''arrived_home'', ''left_home''] }}' then: - choose: - conditions: - '{{ is_state(''input_boolean.guard_mode'', ''on'') }}' - '{{ is_state(''binary_sensor.gs20u_presence'', ''Home'') }}' - '{{ now().hour >= 7 or now().hour < 0 }}' sequence: - service: input_boolean.turn_off target: entity_id: input_boolean.guard_mode data: {} - service: notify.mobile_app_sm_g9880 data: message: ⚠️ Guard mode conflict resolved (turned off) - conditions: - '{{ is_state(''input_boolean.guard_mode'', ''off'') }}' - '{{ now().hour >= 0 and now().hour < 7 }}' sequence: - service: input_boolean.turn_on target: entity_id: input_boolean.guard_mode data: {} - service: notify.mobile_app_sm_g9880 data: message: ⚠️ Guard mode conflict resolved (turned on) mode: queued max: 10