I wanted to do a little more configuration with my buttons so I went the route of Automations & Scripts. I have completed this with 2 automations and 1 script.
Automation 1:
This is the core, it consists of 24 triggers, 1 for each button, and then 24 options in a choose. Some are simple toggles of a device, others are another sub-choose function (like lights will cycle between Full, Dim, Off) Others are a AC+ and AC-.
I did all of this so I can have most of the actions conditionally disabled based on alarm state and such. It also calls Script 1 after any button press
Automation 2:
This simply monitors functions and devices that are assigned to the localdeck and if any state changes, it calls script 1. This is useful for doors and locks that might change state but not triggered by the local deck
Script 1:
This has all the conditions and sets all the LED’s for the local deck. By moving this to a script, it can be called in multiple places as needed.
alias: Local Deck Buttons
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.localdeck_button_01
to: "on"
id: button01
- platform: state
entity_id:
- binary_sensor.localdeck_button_02
to: "on"
id: button02
- platform: state
entity_id:
- binary_sensor.localdeck_button_03
to: "on"
id: button03
- platform: state
entity_id:
- binary_sensor.localdeck_button_04
to: "on"
id: button04
- platform: state
entity_id:
- binary_sensor.localdeck_button_05
to: "on"
id: button05
enabled: false
- platform: state
entity_id:
- binary_sensor.localdeck_button_06
to: "on"
id: button06
enabled: false
- platform: state
entity_id:
- binary_sensor.localdeck_button_07
to: "on"
id: button07
enabled: true
- platform: state
entity_id:
- binary_sensor.localdeck_button_08
to: "on"
id: button08
enabled: true
- platform: state
entity_id:
- binary_sensor.localdeck_button_09
to: "on"
id: button09
enabled: true
- platform: state
entity_id:
- binary_sensor.localdeck_button_10
to: "on"
id: button10
enabled: false
- platform: state
entity_id:
- binary_sensor.localdeck_button_11
to: "on"
id: button11
enabled: false
- platform: state
entity_id:
- binary_sensor.localdeck_button_12
to: "on"
id: button12
enabled: false
- platform: state
entity_id:
- binary_sensor.localdeck_button_13
to: "on"
id: button13
enabled: false
- platform: state
entity_id:
- binary_sensor.localdeck_button_14
to: "on"
id: button14
enabled: false
- platform: state
entity_id:
- binary_sensor.localdeck_button_15
to: "on"
id: button15
enabled: false
- platform: state
entity_id:
- binary_sensor.localdeck_button_16
to: "on"
id: button16
enabled: false
- platform: state
entity_id:
- binary_sensor.localdeck_button_17
to: "on"
id: button17
enabled: false
- platform: state
entity_id:
- binary_sensor.localdeck_button_18
to: "on"
id: button18
enabled: false
- platform: state
entity_id:
- binary_sensor.localdeck_button_19
to: "on"
id: button19
enabled: true
- platform: state
entity_id:
- binary_sensor.localdeck_button_20
to: "on"
id: button20
enabled: true
- platform: state
entity_id:
- binary_sensor.localdeck_button_21
to: "on"
id: button21
enabled: true
- platform: state
entity_id:
- binary_sensor.localdeck_button_22
to: "on"
id: button22
enabled: true
- platform: state
entity_id:
- binary_sensor.localdeck_button_23
to: "on"
id: button23
enabled: true
- platform: state
entity_id:
- binary_sensor.localdeck_button_24
to: "on"
id: button24
enabled: false
condition:
- condition: state
entity_id: alarm_control_panel.workshop
state: disarmed
action:
- choose:
- conditions:
- condition: trigger
id: button01
sequence:
- service: cover.toggle
data:
entity_id: cover.frnt_gate
- conditions:
- condition: trigger
id: button02
sequence:
- service: cover.toggle
data: {}
target:
entity_id:
- cover.garage_door_mqtt
- conditions:
- condition: trigger
id: button03
sequence:
- service: cover.toggle
data: {}
target:
entity_id: cover.front_workshop_roll_door
- conditions:
- condition: trigger
id: button04
sequence:
- service: cover.toggle
data: {}
target:
entity_id:
- cover.rear_workshop_roll_door
- conditions:
- condition: trigger
id: button05
sequence: []
- conditions:
- condition: trigger
id: button06
sequence: []
- conditions:
- condition: trigger
id: button07
sequence:
- if:
- condition: state
entity_id: lock.workshop_deadbolt
state: locked
then:
- service: lock.unlock
metadata: {}
data: {}
target:
entity_id: lock.workshop_deadbolt
else:
- service: lock.lock
metadata: {}
data: {}
target:
entity_id: lock.workshop_deadbolt
- conditions:
- condition: trigger
id: button08
sequence:
- if:
- condition: state
entity_id: lock.front_door
state: locked
then:
- service: lock.unlock
metadata: {}
data: {}
target:
entity_id:
- lock.front_door
else:
- service: lock.lock
metadata: {}
data: {}
target:
entity_id: lock.front_door
- conditions:
- condition: trigger
id: button09
sequence:
- if:
- condition: state
entity_id: lock.back_door
state: locked
then:
- service: lock.unlock
metadata: {}
data: {}
target:
entity_id:
- lock.back_door
else:
- service: lock.lock
metadata: {}
data: {}
target:
entity_id:
- lock.back_door
- conditions:
- condition: trigger
id: button10
sequence: []
- conditions:
- condition: trigger
id: button11
sequence: []
- conditions:
- condition: trigger
id: button12
sequence: []
- conditions:
- condition: trigger
id: button13
sequence:
- service: cover.toggle
data:
entity_id: cover.frnt_gate
- conditions:
- condition: trigger
id: button14
sequence:
- service: cover.toggle
data:
entity_id: cover.frnt_gate
- conditions:
- condition: trigger
id: button15
sequence:
- service: cover.toggle
data:
entity_id: cover.frnt_gate
- conditions:
- condition: trigger
id: button16
sequence:
- service: cover.toggle
data:
entity_id: cover.frnt_gate
- conditions:
- condition: trigger
id: button17
sequence:
- service: cover.toggle
data:
entity_id: cover.frnt_gate
- conditions:
- condition: trigger
id: button18
sequence:
- service: cover.toggle
data:
entity_id: cover.frnt_gate
- conditions:
- condition: trigger
id: button19
sequence:
- choose:
- conditions:
- condition: state
entity_id: light.workshopoffice
state: "off"
sequence:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 100
target:
entity_id: light.workshopoffice
- conditions:
- condition: numeric_state
entity_id: light.workshopoffice
attribute: brightness
above: 90
sequence:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 30
target:
entity_id: light.workshopoffice
- conditions:
- condition: numeric_state
entity_id: light.workshopoffice
attribute: brightness
below: 90
sequence:
- service: light.turn_off
target:
entity_id:
- light.workshopoffice
data: {}
- conditions:
- condition: trigger
id: button20
sequence:
- service: switch.toggle
metadata: {}
data: {}
target:
entity_id: switch.office_rack_24v
- conditions:
- condition: trigger
id: button21
sequence:
- service: input_boolean.toggle
metadata: {}
data: {}
target:
entity_id: input_boolean.helper_workshop_ac_manual_override
- conditions:
- condition: trigger
id: button22
sequence:
- service: climate.set_temperature
data_template:
entity_id: climate.office_ac
temperature: >-
{{(state_attr('climate.office_ac' , 'temperature')|round(0)) - 1
}}
- conditions:
- condition: trigger
id: button23
sequence:
- service: climate.set_temperature
data_template:
entity_id: climate.office_ac
temperature: >-
{{(state_attr('climate.office_ac' , 'temperature')|round(0)) + 1
}}
- conditions:
- condition: trigger
id: button24
sequence: []
- service: script.local_deck_lights
data: {}
mode: single
Script 1
alias: Local Deck Lights
sequence:
- if:
- condition: state
entity_id: alarm_control_panel.workshop
state: disarmed
then:
- alias: Button 1
choose:
- conditions:
- condition: state
entity_id: input_boolean.frontgatelockopen
state: "on"
sequence:
- service: light.turn_on
metadata: {}
data:
rgb_color:
- 0
- 0
- 255
brightness_pct: 50
target:
entity_id: light.localdeck_button_01_light
- conditions:
- condition: state
entity_id: cover.frnt_gate
state: open
sequence:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 255
- 0
- 0
target:
entity_id: light.localdeck_button_01_light
default:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 0
- 255
- 0
target:
entity_id: light.localdeck_button_01_light
- alias: Button 2
choose:
- conditions:
- condition: state
state: closed
entity_id: cover.garage_door_mqtt
sequence:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 0
- 255
- 0
target:
entity_id: light.localdeck_button_02_light
- conditions:
- condition: state
state: closing
entity_id: cover.garage_door_mqtt
sequence:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 255
- 255
- 0
target:
entity_id: light.localdeck_button_02_light
default:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 255
- 0
- 0
target:
entity_id: light.localdeck_button_02_light
- alias: Button 3
choose:
- conditions:
- condition: state
state: open
entity_id: cover.front_workshop_roll_door
sequence:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 255
- 0
- 0
target:
entity_id: light.localdeck_button_03_light
default:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 0
- 255
- 0
target:
entity_id: light.localdeck_button_03_light
- alias: Button 4
choose:
- conditions:
- condition: state
state: open
entity_id: cover.rear_workshop_roll_door
sequence:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 255
- 0
- 0
target:
entity_id: light.localdeck_button_04_light
default:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 0
- 255
- 0
target:
entity_id: light.localdeck_button_04_light
- alias: Button 7
choose:
- conditions:
- condition: state
entity_id: lock.workshop_deadbolt
state: locked
sequence:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 0
- 255
- 0
target:
entity_id:
- light.localdeck_button_07_light
default:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 255
- 0
- 0
target:
entity_id:
- light.localdeck_button_07_light
- alias: Button 8
choose:
- conditions:
- condition: state
entity_id: lock.front_door
state: locked
sequence:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 0
- 255
- 0
target:
entity_id:
- light.localdeck_button_08_light
default:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 255
- 0
- 0
target:
entity_id:
- light.localdeck_button_08_light
- alias: Button 9
choose:
- conditions:
- condition: state
entity_id: lock.back_door
state: locking
sequence:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 255
- 255
- 0
target:
entity_id:
- light.localdeck_button_09_light
- conditions:
- condition: state
entity_id: lock.back_door
state: locked
sequence:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 0
- 255
- 0
target:
entity_id:
- light.localdeck_button_09_light
default:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 255
- 0
- 0
target:
entity_id:
- light.localdeck_button_09_light
- alias: Button 19
choose:
- conditions:
- condition: state
entity_id: light.workshopoffice
state: "on"
sequence:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 0
- 0
- 255
target:
entity_id:
- light.localdeck_button_19_light
default:
- service: light.turn_off
metadata: {}
data: {}
target:
entity_id:
- light.localdeck_button_19_light
- alias: Button 20
choose:
- conditions:
- condition: state
entity_id: switch.office_rack_24v
state: "on"
sequence:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 0
- 0
- 255
target:
entity_id:
- light.localdeck_button_20_light
default:
- service: light.turn_off
metadata: {}
data: {}
target:
entity_id: light.localdeck_button_20_light
- alias: Button 21
choose:
- conditions:
- condition: state
entity_id: input_boolean.helper_workshop_ac_manual_override
state: "on"
sequence:
- service: light.turn_on
metadata: {}
data:
brightness_pct: 50
rgb_color:
- 255
- 0
- 255
target:
entity_id: light.localdeck_button_21_light
default:
- service: light.turn_off
metadata: {}
data: {}
target:
entity_id: light.localdeck_button_21_light
else:
- service: light.turn_off
metadata: {}
data: {}
target:
entity_id:
- light.localdeck_button_01_light
- light.localdeck_button_02_light
- light.localdeck_button_03_light
- light.localdeck_button_04_light
- light.localdeck_button_06_light
- light.localdeck_button_07_light
- light.localdeck_button_05_light
- light.localdeck_button_08_light
- light.localdeck_button_09_light
- light.localdeck_button_10_light
- light.localdeck_button_11_light
- light.localdeck_button_12_light
- light.localdeck_button_13_light
- light.localdeck_button_14_light
- light.localdeck_button_15_light
- light.localdeck_button_16_light
- light.localdeck_button_17_light
- light.localdeck_button_18_light
- light.localdeck_button_19_light
- light.localdeck_button_20_light
- light.localdeck_button_21_light
- light.localdeck_button_22_light
- light.localdeck_button_23_light
- light.localdeck_button_24_light
description: ""