esphome devices & scripts
This commit is contained in:
@@ -1,96 +1,163 @@
|
||||
###############################################################################
|
||||
# PACKAGE: Downstairs Flat Light Control
|
||||
###############################################################################
|
||||
#
|
||||
# VERSION HISTORY
|
||||
#
|
||||
# 2026-05-07 - v1.0.1
|
||||
# - Removed group.downstairs_flat_lights from this package to avoid duplicate
|
||||
# group/name package merge errors.
|
||||
# - Changed all-on/all-off scripts to use direct entity lists instead.
|
||||
#
|
||||
# 2026-05-07 - v1.0.0
|
||||
# - Tidied original package.
|
||||
# - Added package header and comments.
|
||||
# - Added internal helper script to avoid repeating the same occupancy logic.
|
||||
#
|
||||
###############################################################################
|
||||
#
|
||||
# OPERATION NOTES
|
||||
#
|
||||
# - input_boolean.downstairs_flat_occupied is the safety/lockout helper.
|
||||
#
|
||||
# - When downstairs_flat_occupied is ON:
|
||||
# - All scripts in this package do nothing.
|
||||
# - This prevents upstairs controls from changing downstairs guest lights.
|
||||
#
|
||||
# - When downstairs_flat_occupied is OFF:
|
||||
# - Individual scripts toggle their matching light switch.
|
||||
# - downstairs_lights_all_off only ever turns the listed lights OFF.
|
||||
# - downstairs_light_toggle_all_group turns all listed lights OFF if any are ON.
|
||||
# - downstairs_light_toggle_all_group turns all listed lights ON if they are all OFF.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
# INPUT BOOLEANS
|
||||
###############################################################################
|
||||
|
||||
input_boolean:
|
||||
downstairs_flat_occupied:
|
||||
name: Downstairs Guest Occupied
|
||||
icon: mdi:briefcase-plus-outline
|
||||
icon: mdi:home-account
|
||||
|
||||
###############################################################################
|
||||
# SCRIPTS
|
||||
###############################################################################
|
||||
|
||||
script:
|
||||
downstairs_light_toggle_lounge_main:
|
||||
alias: Downstairs Light Toggle - Lounge Main Lights
|
||||
mode: queued
|
||||
downstairs_lights_all_off:
|
||||
alias: Downstairs Lights - All Off
|
||||
mode: single
|
||||
sequence:
|
||||
- condition: state
|
||||
entity_id: input_boolean.downstairs_flat_occupied
|
||||
state: "off"
|
||||
- service: switch.toggle
|
||||
|
||||
- action: homeassistant.turn_off
|
||||
target:
|
||||
entity_id: switch.esp_downstloungemain_relay_1_main_lights
|
||||
entity_id:
|
||||
- switch.esp_downstloungemain_relay_1_main_lights
|
||||
- switch.esp_downstloungemain_relay_2_back_wall_lights
|
||||
- switch.esp_downstmasterbedrmlights_relay_1_main_lights
|
||||
- switch.esp_downstbedrm2lights_relay_1_main_lights
|
||||
- switch.esp_downstkitchlights_relay_2_kitchen_light
|
||||
- switch.esp_downstkitchlights_relay_1_dining_light
|
||||
- switch.esp_downstbathswitch_relay_1_main_lights
|
||||
- switch.esp_downstbathswitch_relay_2_cabinet_light
|
||||
|
||||
downstairs_light_toggle_entity:
|
||||
alias: Downstairs Light Toggle - Internal Entity Toggle
|
||||
mode: queued
|
||||
max: 10
|
||||
fields:
|
||||
target_switch:
|
||||
name: Target Switch
|
||||
description: The downstairs switch entity to toggle.
|
||||
required: true
|
||||
selector:
|
||||
entity:
|
||||
domain: switch
|
||||
sequence:
|
||||
- condition: state
|
||||
entity_id: input_boolean.downstairs_flat_occupied
|
||||
state: "off"
|
||||
|
||||
- action: switch.toggle
|
||||
target:
|
||||
entity_id: "{{ target_switch }}"
|
||||
|
||||
downstairs_light_toggle_lounge_main:
|
||||
alias: Downstairs Light Toggle - Lounge Main Lights
|
||||
mode: queued
|
||||
max: 10
|
||||
sequence:
|
||||
- action: script.downstairs_light_toggle_entity
|
||||
data:
|
||||
target_switch: switch.esp_downstloungemain_relay_1_main_lights
|
||||
|
||||
downstairs_light_toggle_lounge_back_wall:
|
||||
alias: Downstairs Light Toggle - Lounge Back Wall Lights
|
||||
mode: queued
|
||||
max: 10
|
||||
sequence:
|
||||
- condition: state
|
||||
entity_id: input_boolean.downstairs_flat_occupied
|
||||
state: "off"
|
||||
- service: switch.toggle
|
||||
target:
|
||||
entity_id: switch.esp_downstloungemain_relay_2_back_wall_lights
|
||||
- action: script.downstairs_light_toggle_entity
|
||||
data:
|
||||
target_switch: switch.esp_downstloungemain_relay_2_back_wall_lights
|
||||
|
||||
downstairs_light_toggle_main_bedroom_main:
|
||||
alias: Downstairs Light Toggle - Main Bedroom Main Lights
|
||||
mode: queued
|
||||
max: 10
|
||||
sequence:
|
||||
- condition: state
|
||||
entity_id: input_boolean.downstairs_flat_occupied
|
||||
state: "off"
|
||||
- service: switch.toggle
|
||||
target:
|
||||
entity_id: switch.esp_downstmasterbedrmlights_relay_1_main_lights
|
||||
- action: script.downstairs_light_toggle_entity
|
||||
data:
|
||||
target_switch: switch.esp_downstmasterbedrmlights_relay_1_main_lights
|
||||
|
||||
downstairs_light_toggle_small_bedroom_main:
|
||||
alias: Downstairs Light Toggle - Small Bedroom Room Lights
|
||||
alias: Downstairs Light Toggle - Small Bedroom Main Lights
|
||||
mode: queued
|
||||
max: 10
|
||||
sequence:
|
||||
- condition: state
|
||||
entity_id: input_boolean.downstairs_flat_occupied
|
||||
state: "off"
|
||||
- service: switch.toggle
|
||||
target:
|
||||
entity_id: switch.esp_downstbedrm2lights_relay_1_main_lights
|
||||
- action: script.downstairs_light_toggle_entity
|
||||
data:
|
||||
target_switch: switch.esp_downstbedrm2lights_relay_1_main_lights
|
||||
|
||||
downstairs_light_toggle_kitchen:
|
||||
alias: Downstairs Light Toggle - Kitchen Lights
|
||||
mode: queued
|
||||
max: 10
|
||||
sequence:
|
||||
- condition: state
|
||||
entity_id: input_boolean.downstairs_flat_occupied
|
||||
state: "off"
|
||||
- service: switch.toggle
|
||||
target:
|
||||
entity_id: switch.esp_downstkitchlights_relay_2_kitchen_light
|
||||
- action: script.downstairs_light_toggle_entity
|
||||
data:
|
||||
target_switch: switch.esp_downstkitchlights_relay_2_kitchen_light
|
||||
|
||||
downstairs_light_toggle_dining:
|
||||
alias: Downstairs Light Toggle - Dining Lights
|
||||
mode: queued
|
||||
max: 10
|
||||
sequence:
|
||||
- condition: state
|
||||
entity_id: input_boolean.downstairs_flat_occupied
|
||||
state: "off"
|
||||
- service: switch.toggle
|
||||
target:
|
||||
entity_id: switch.esp_downstkitchlights_relay_1_dining_light
|
||||
- action: script.downstairs_light_toggle_entity
|
||||
data:
|
||||
target_switch: switch.esp_downstkitchlights_relay_1_dining_light
|
||||
|
||||
downstairs_light_toggle_bathroom_main:
|
||||
alias: Downstairs Light Toggle - Bathroom Main Lights
|
||||
mode: queued
|
||||
max: 10
|
||||
sequence:
|
||||
- condition: state
|
||||
entity_id: input_boolean.downstairs_flat_occupied
|
||||
state: "off"
|
||||
- service: switch.toggle
|
||||
target:
|
||||
entity_id: switch.esp_downstbathswitch_relay_1_main_lights
|
||||
- action: script.downstairs_light_toggle_entity
|
||||
data:
|
||||
target_switch: switch.esp_downstbathswitch_relay_1_main_lights
|
||||
|
||||
downstairs_light_toggle_bathroom_cabinet:
|
||||
alias: Downstairs Light Toggle - Bathroom Cabinet Lights
|
||||
mode: queued
|
||||
max: 10
|
||||
sequence:
|
||||
- condition: state
|
||||
entity_id: input_boolean.downstairs_flat_occupied
|
||||
state: "off"
|
||||
- service: switch.toggle
|
||||
target:
|
||||
entity_id: switch.esp_downstbathswitch_relay_2_cabinet_light
|
||||
- action: script.downstairs_light_toggle_entity
|
||||
data:
|
||||
target_switch: switch.esp_downstbathswitch_relay_2_cabinet_light
|
||||
|
||||
downstairs_light_toggle_all_group:
|
||||
alias: Downstairs Lights - All On/Off
|
||||
@@ -102,14 +169,40 @@ script:
|
||||
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: group.downstairs_flat_lights
|
||||
state: "on"
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{
|
||||
is_state('switch.esp_downstloungemain_relay_1_main_lights', 'on')
|
||||
or is_state('switch.esp_downstloungemain_relay_2_back_wall_lights', 'on')
|
||||
or is_state('switch.esp_downstmasterbedrmlights_relay_1_main_lights', 'on')
|
||||
or is_state('switch.esp_downstbedrm2lights_relay_1_main_lights', 'on')
|
||||
or is_state('switch.esp_downstkitchlights_relay_2_kitchen_light', 'on')
|
||||
or is_state('switch.esp_downstkitchlights_relay_1_dining_light', 'on')
|
||||
or is_state('switch.esp_downstbathswitch_relay_1_main_lights', 'on')
|
||||
or is_state('switch.esp_downstbathswitch_relay_2_cabinet_light', 'on')
|
||||
}}
|
||||
sequence:
|
||||
- service: homeassistant.turn_off
|
||||
- action: homeassistant.turn_off
|
||||
target:
|
||||
entity_id: group.downstairs_flat_lights
|
||||
entity_id:
|
||||
- switch.esp_downstloungemain_relay_1_main_lights
|
||||
- switch.esp_downstloungemain_relay_2_back_wall_lights
|
||||
- switch.esp_downstmasterbedrmlights_relay_1_main_lights
|
||||
- switch.esp_downstbedrm2lights_relay_1_main_lights
|
||||
- switch.esp_downstkitchlights_relay_2_kitchen_light
|
||||
- switch.esp_downstkitchlights_relay_1_dining_light
|
||||
- switch.esp_downstbathswitch_relay_1_main_lights
|
||||
- switch.esp_downstbathswitch_relay_2_cabinet_light
|
||||
|
||||
default:
|
||||
- service: homeassistant.turn_on
|
||||
- action: homeassistant.turn_on
|
||||
target:
|
||||
entity_id: group.downstairs_flat_lights
|
||||
entity_id:
|
||||
- switch.esp_downstloungemain_relay_1_main_lights
|
||||
- switch.esp_downstloungemain_relay_2_back_wall_lights
|
||||
- switch.esp_downstmasterbedrmlights_relay_1_main_lights
|
||||
- switch.esp_downstbedrm2lights_relay_1_main_lights
|
||||
- switch.esp_downstkitchlights_relay_2_kitchen_light
|
||||
- switch.esp_downstkitchlights_relay_1_dining_light
|
||||
- switch.esp_downstbathswitch_relay_1_main_lights
|
||||
- switch.esp_downstbathswitch_relay_2_cabinet_light
|
||||
|
||||
Reference in New Issue
Block a user