From a0bd6aef18ee2fdc8cb008ab20e03b2b5fe21471 Mon Sep 17 00:00:00 2001
From: Przemek Grondek <przemek@grondek.pl>
Date: Mon, 19 Jul 2021 23:25:20 +0200
Subject: [PATCH] Add automations for living room button

---
 .../automations/living-room-button.yaml       | 199 ++++++++++++++++++
 1 file changed, 199 insertions(+)
 create mode 100644 configuration/automations/living-room-button.yaml

diff --git a/configuration/automations/living-room-button.yaml b/configuration/automations/living-room-button.yaml
new file mode 100644
index 0000000..7e0e326
--- /dev/null
+++ b/configuration/automations/living-room-button.yaml
@@ -0,0 +1,199 @@
+# Living Room button
+- id: living-room-button-1 #  Upper Left
+  alias: '[Living Room] Button 1'
+  description: ''
+  mode: single
+  trigger:
+    - device_id: 6f68b487f932c9b73d17ff82cb453617
+      domain: zha
+      platform: device
+      type: remote_button_alt_short_press
+      subtype: button_1
+  action:
+    - choose:
+      - conditions:
+          - condition: state
+            entity_id: light.table_lamp
+            state: 'on'
+        sequence:
+          - service: light.turn_off
+            entity_id: light.table_lamp
+      - conditions:
+          - condition: state
+            entity_id: light.table_lamp
+            state: 'off'
+        sequence:
+          - choose:
+            - conditions:
+                - condition: state
+                  entity_id: input_select.home_mode
+                  state: Day
+              sequence:
+                - choose:
+                  - conditions:
+                      - condition: state
+                        entity_id: input_boolean.sleep_mode
+                        state: 'on'
+                    sequence:
+                      - service: light.turn_on
+                        entity_id: light.table_lamp
+                        data:
+                          brightness_pct: 100
+                          kelvin: 2000
+                  - conditions:
+                      - condition: state
+                        entity_id: input_boolean.sleep_mode
+                        state: 'off'
+                    sequence:
+                      - service: light.turn_on
+                        entity_id: light.table_lamp
+                        data:
+                          brightness_pct: 100
+                          kelvin: 3200
+            - conditions:
+                - condition: state
+                  entity_id: input_select.home_mode
+                  state: Night
+              sequence:
+                - service: light.turn_on
+                  entity_id: light.table_lamp
+                  data:
+                    brightness_pct: 5
+                    kelvin: 2700
+
+- id: living-room-button-2 #  Upper right
+  alias: '[Living Room] Button 2'
+  description: ''
+  mode: single
+  trigger:
+    - device_id: 6f68b487f932c9b73d17ff82cb453617
+      domain: zha
+      platform: device
+      type: remote_button_alt_short_press
+      subtype: button_2
+  action:
+    - choose:
+        - conditions:
+            - condition: state
+              entity_id: light.tv_lights
+              state: 'on'
+          sequence:
+            - service: light.turn_off
+              entity_id: light.tv_lights
+        - conditions:
+            - condition: state
+              entity_id: light.tv_lights
+              state: 'off'
+          sequence:
+            - choose:
+                - conditions:
+                    - condition: state
+                      entity_id: input_select.home_mode
+                      state: Day
+                  sequence:
+                    - choose:
+                        - conditions:
+                            - condition: state
+                              entity_id: input_boolean.sleep_mode
+                              state: 'on'
+                          sequence:
+                            - service: light.turn_on
+                              entity_id: light.tv_lights
+                              data:
+                                brightness_pct: 100
+                                kelvin: 2000
+                        - conditions:
+                            - condition: state
+                              entity_id: input_boolean.sleep_mode
+                              state: 'off'
+                          sequence:
+                            - service: light.turn_on
+                              entity_id: light.tv_lights
+                              data:
+                                brightness_pct: 100
+                                kelvin: 3200
+                - conditions:
+                    - condition: state
+                      entity_id: input_select.home_mode
+                      state: Night
+                  sequence:
+                    - service: light.turn_on
+                      entity_id: light.tv_lights
+                      data:
+                        brightness_pct: 5
+                        kelvin: 2700
+
+- id: living-room-button-3 #  Middle left
+  alias: '[Living Room] Button 3'
+  description: ''
+  mode: single
+  trigger:
+    - device_id: 6f68b487f932c9b73d17ff82cb453617
+      domain: zha
+      platform: device
+      type: remote_button_alt_short_press
+      subtype: button_3
+  action:
+    - choose:
+        - conditions:
+            - condition: state
+              entity_id: input_select.home_mode
+              state: Day
+          sequence:
+            - service: script.tv_youtube
+        - conditions:
+            - condition: state
+              entity_id: input_select.home_mode
+              state: Night
+          sequence:
+            - service: script.tv_youtube
+
+- id: living-room-button-5 #  Bottom left
+  alias: '[Living Room] Button 5'
+  description: ''
+  mode: single
+  trigger:
+    - device_id: 6f68b487f932c9b73d17ff82cb453617
+      domain: zha
+      platform: device
+      type: remote_button_alt_short_press
+      subtype: button_5
+  action:
+    - choose:
+        - conditions:
+            - condition: state
+              entity_id: input_select.home_mode
+              state: Day
+          sequence:
+            - service: script.tv_nintendo_switch
+        - conditions:
+            - condition: state
+              entity_id: input_select.home_mode
+              state: Night
+          sequence:
+            - service: script.tv_nintendo_switch
+
+- id: living-room-button-6 #  Bottom right
+  alias: '[Living Room] Button 6'
+  description: ''
+  mode: single
+  trigger:
+    - device_id: 6f68b487f932c9b73d17ff82cb453617
+      domain: zha
+      platform: device
+      type: remote_button_alt_short_press
+      subtype: button_6
+  action:
+    - choose:
+        - conditions:
+            - condition: state
+              entity_id: input_select.home_mode
+              state: Day
+          sequence:
+            - service: script.tv_ps4
+        - conditions:
+            - condition: state
+              entity_id: input_select.home_mode
+              state: Night
+          sequence:
+            - service: script.tv_ps4