From 6af5432e43556b5529d47cd25343bcdbc988a7f0 Mon Sep 17 00:00:00 2001
From: Erick Hitter <services@ethitter.com>
Date: Tue, 13 Sep 2016 22:16:22 -0700
Subject: [PATCH] Sync with upstream

b74e459
---
 automations/alarm-status-indicator-off.yaml   |  8 +++++
 automations/alarm-status-indicator-on.yaml    | 11 ++++++
 automations/brightness-dining-area-set.yaml   | 12 +++++++
 automations/brightness-dining-area-sync.yaml  | 14 ++++++++
 automations/brightness-living-room-set.yaml   | 12 +++++++
 automations/brightness-living-room-sync.yaml  | 14 ++++++++
 automations/brightness-master-bath-set.yaml   | 13 +++++++
 automations/brightness-master-bath-sync.yaml  | 17 ++++++++++
 .../kitchen-nightlight-off-sunrise.yaml       |  8 +++++
 automations/kitchen-nightlight-off.yaml       | 23 +++++++++++++
 automations/kitchen-nightlight-on.yaml        | 34 +++++++++++++++++++
 automations/scenes-master-bath.yaml           |  4 ++-
 configuration.yaml                            |  2 ++
 customizations/input-sliders.yaml             |  7 ++++
 customizations/scenes.yaml                    |  3 ++
 customizations/scripts.yaml                   |  6 ++++
 customizations/switches.yaml                  |  5 +++
 groups.yaml                                   | 24 ++++++++++++-
 input-selects.yaml                            |  3 +-
 input-sliders.yaml                            | 15 +++++++-
 scenes/all-lights-off.yaml                    | 26 ++++++++++++++
 scenes/master-bath-dash-off.yaml              |  8 +++++
 scenes/master-bath-dash-on.yaml               | 10 ++++++
 scripts.yaml                                  | 14 ++++++--
 secrets.yaml                                  |  1 +
 sensors/time-date.yaml                        |  8 +++++
 shell_commands.yaml                           |  4 ++-
 switches.yaml                                 | 19 +++++++----
 wemo.yaml                                     |  2 ++
 29 files changed, 314 insertions(+), 13 deletions(-)
 create mode 100644 automations/alarm-status-indicator-off.yaml
 create mode 100644 automations/alarm-status-indicator-on.yaml
 create mode 100644 automations/brightness-dining-area-set.yaml
 create mode 100644 automations/brightness-dining-area-sync.yaml
 create mode 100644 automations/brightness-living-room-set.yaml
 create mode 100644 automations/brightness-living-room-sync.yaml
 create mode 100644 automations/brightness-master-bath-set.yaml
 create mode 100644 automations/brightness-master-bath-sync.yaml
 create mode 100644 automations/kitchen-nightlight-off-sunrise.yaml
 create mode 100644 automations/kitchen-nightlight-off.yaml
 create mode 100644 automations/kitchen-nightlight-on.yaml
 create mode 100644 customizations/input-sliders.yaml
 create mode 100644 scenes/all-lights-off.yaml
 create mode 100644 scenes/master-bath-dash-off.yaml
 create mode 100644 scenes/master-bath-dash-on.yaml
 create mode 100644 sensors/time-date.yaml
 create mode 100644 wemo.yaml

diff --git a/automations/alarm-status-indicator-off.yaml b/automations/alarm-status-indicator-off.yaml
new file mode 100644
index 0000000..0a51fa4
--- /dev/null
+++ b/automations/alarm-status-indicator-off.yaml
@@ -0,0 +1,8 @@
+alias: Alarm status indicator off
+trigger:
+  - platform: state
+    entity_id: alarm_control_panel.shm
+    to: "disarmed"
+action:
+  service: switch.turn_off
+  entity_id: switch.alarm_status
diff --git a/automations/alarm-status-indicator-on.yaml b/automations/alarm-status-indicator-on.yaml
new file mode 100644
index 0000000..a2a1487
--- /dev/null
+++ b/automations/alarm-status-indicator-on.yaml
@@ -0,0 +1,11 @@
+alias: Alarm status indicator on
+trigger:
+  - platform: state
+    entity_id: alarm_control_panel.shm
+    to: "armed_home"
+  - platform: state
+    entity_id: alarm_control_panel.shm
+    to: "armed_away"
+action:
+  service: switch.turn_on
+  entity_id: switch.alarm_status
diff --git a/automations/brightness-dining-area-set.yaml b/automations/brightness-dining-area-set.yaml
new file mode 100644
index 0000000..4ea712a
--- /dev/null
+++ b/automations/brightness-dining-area-set.yaml
@@ -0,0 +1,12 @@
+alias: Brightness Dining Area
+trigger:
+  platform: state
+  entity_id: input_slider.brightness_da
+action:
+  service: light.turn_on
+  data:
+    entity_id:
+      - light.ceiling_fan_1
+      - light.ceiling_fan_2
+  data_template:
+    brightness: '{{ states( "input_slider.brightness_da" )|round( 0 ) }}'
diff --git a/automations/brightness-dining-area-sync.yaml b/automations/brightness-dining-area-sync.yaml
new file mode 100644
index 0000000..ebdebde
--- /dev/null
+++ b/automations/brightness-dining-area-sync.yaml
@@ -0,0 +1,14 @@
+alias: Brightness Dining Area Sync
+trigger:
+  - platform: state
+    entity_id: light.ceiling_fan_1
+    to: "on"
+  - platform: state
+    entity_id: light.ceiling_fan_2
+    to: "on"
+action:
+  service: input_slider.select_value
+  data:
+    entity_id: input_slider.brightness_da
+  data_template:
+    value: '{{ trigger.to_state.attributes.brightness|float }}'
diff --git a/automations/brightness-living-room-set.yaml b/automations/brightness-living-room-set.yaml
new file mode 100644
index 0000000..9edd36b
--- /dev/null
+++ b/automations/brightness-living-room-set.yaml
@@ -0,0 +1,12 @@
+alias: Brightness Living Room
+trigger:
+  platform: state
+  entity_id: input_slider.brightness_lr
+action:
+  service: light.turn_on
+  data:
+    entity_id:
+      - light.endtable
+      - light.corner_table
+  data_template:
+    brightness: '{{ states( "input_slider.brightness_lr" )|round( 0 ) }}'
diff --git a/automations/brightness-living-room-sync.yaml b/automations/brightness-living-room-sync.yaml
new file mode 100644
index 0000000..17cae09
--- /dev/null
+++ b/automations/brightness-living-room-sync.yaml
@@ -0,0 +1,14 @@
+alias: Brightness Living Room Sync
+trigger:
+  - platform: state
+    entity_id: light.endtable
+    to: "on"
+  - platform: state
+    entity_id: light.corner_table
+    to: "on"
+action:
+  service: input_slider.select_value
+  data:
+    entity_id: input_slider.brightness_lr
+  data_template:
+    value: '{{ trigger.to_state.attributes.brightness|float }}'
diff --git a/automations/brightness-master-bath-set.yaml b/automations/brightness-master-bath-set.yaml
new file mode 100644
index 0000000..72648bd
--- /dev/null
+++ b/automations/brightness-master-bath-set.yaml
@@ -0,0 +1,13 @@
+alias: Brightness Master Bath
+trigger:
+  platform: state
+  entity_id: input_slider.brightness_master_bath
+action:
+  service: light.turn_on
+  data:
+    entity_id:
+      - light.master_bath_1
+      - light.master_bath_2
+      - light.master_bath_3
+  data_template:
+    brightness: '{{ states( "input_slider.brightness_master_bath" )|round( 0 ) }}'
diff --git a/automations/brightness-master-bath-sync.yaml b/automations/brightness-master-bath-sync.yaml
new file mode 100644
index 0000000..80827ef
--- /dev/null
+++ b/automations/brightness-master-bath-sync.yaml
@@ -0,0 +1,17 @@
+alias: Brightness Master Bath Sync
+trigger:
+  - platform: state
+    entity_id: light.master_bath_1
+    to: "on"
+  - platform: state
+    entity_id: light.master_bath_2
+    to: "on"
+  - platform: state
+    entity_id: light.master_bath_3
+    to: "on"
+action:
+  service: input_slider.select_value
+  data:
+    entity_id: input_slider.brightness_master_bath
+  data_template:
+    value: '{{ trigger.to_state.attributes.brightness|float }}'
diff --git a/automations/kitchen-nightlight-off-sunrise.yaml b/automations/kitchen-nightlight-off-sunrise.yaml
new file mode 100644
index 0000000..0fb6418
--- /dev/null
+++ b/automations/kitchen-nightlight-off-sunrise.yaml
@@ -0,0 +1,8 @@
+alias: Turn kitchen nightlight off at sunrise
+trigger:
+  - platform: state
+    entity_id: sun.sun
+    to: 'above_horizon'
+action:
+  service: switch.turn_off
+  entity_id: switch.kitchen_nightlight
diff --git a/automations/kitchen-nightlight-off.yaml b/automations/kitchen-nightlight-off.yaml
new file mode 100644
index 0000000..c83e9c0
--- /dev/null
+++ b/automations/kitchen-nightlight-off.yaml
@@ -0,0 +1,23 @@
+alias: Turn kitchen nightlight off
+trigger:
+  - platform: state
+    entity_id: switch.kitchen
+  - platform: state
+    entity_id: light.ceiling_fan_1
+  - platform: state
+    entity_id: light.ceiling_fan_2
+condition:
+  condition: or
+  conditions:
+    - condition: state
+      entity_id: light.ceiling_fan_1
+      state: 'on'
+    - condition: state
+      entity_id: light.ceiling_fan_2
+      state: 'on'
+    - condition: state
+      entity_id: switch.kitchen
+      state: 'on'
+action:
+  service: switch.turn_off
+  entity_id: switch.kitchen_nightlight
diff --git a/automations/kitchen-nightlight-on.yaml b/automations/kitchen-nightlight-on.yaml
new file mode 100644
index 0000000..620b174
--- /dev/null
+++ b/automations/kitchen-nightlight-on.yaml
@@ -0,0 +1,34 @@
+alias: Turn kitchen nightlight on
+trigger:
+  - platform: state
+    entity_id: switch.kitchen
+  - platform: state
+    entity_id: light.ceiling_fan_1
+  - platform: state
+    entity_id: light.ceiling_fan_2
+  - platform: state
+    entity_id: binary_sensor.kitchen
+  - platform: state
+    entity_id: binary_sensor.lr_motion_sensor_over_utility_closet
+condition:
+  condition: and
+  conditions:
+    - condition: state
+      entity_id: sun.sun
+      state: 'below_horizon'
+    - condition: time
+      after: '00:15:00'
+    - condition: time
+      before: '09:00:00'
+    - condition: state
+      entity_id: light.ceiling_fan_1
+      state: 'off'
+    - condition: state
+      entity_id: light.ceiling_fan_2
+      state: 'off'
+    - condition: state
+      entity_id: switch.kitchen
+      state: 'off'
+action:
+  service: switch.turn_on
+  entity_id: switch.kitchen_nightlight
diff --git a/automations/scenes-master-bath.yaml b/automations/scenes-master-bath.yaml
index a1c134b..238de50 100644
--- a/automations/scenes-master-bath.yaml
+++ b/automations/scenes-master-bath.yaml
@@ -6,7 +6,9 @@ action:
   - service: scene.turn_on
     data_template:
       entity_id: >
-        {% if is_state( "input_select.scene_master_bath", "Nightlight" ) %}
+        {% if is_state( "input_select.scene_master_bath", "Nightlight (single)" ) %}
+          scene.master_bath_dash_on
+        {%-elif is_state( "input_select.scene_master_bath", "Nightlight" ) %}
           scene.master_bath_nightlight
         {%-elif is_state( "input_select.scene_master_bath", "Dimmed" ) %}
           scene.master_bath_dimmed
diff --git a/configuration.yaml b/configuration.yaml
index 63c5242..f8eac0c 100644
--- a/configuration.yaml
+++ b/configuration.yaml
@@ -71,6 +71,8 @@ device_tracker: !include device-tracker.yaml
 
 alarm_control_panel: !include alarm-control-panel.yaml
 
+wemo: !include wemo.yaml
+
 # Display
 group: !include groups.yaml
 
diff --git a/customizations/input-sliders.yaml b/customizations/input-sliders.yaml
new file mode 100644
index 0000000..a1646db
--- /dev/null
+++ b/customizations/input-sliders.yaml
@@ -0,0 +1,7 @@
+input_slider.brightness_da:
+  friendly_name: DA Brightness
+  icon: mdi:brightness-6
+input_slider.brightness_lr:
+  icon: mdi:brightness-6
+input_slider.brightness_master_bath:
+  icon: mdi:brightness-6
diff --git a/customizations/scenes.yaml b/customizations/scenes.yaml
index 9b5126b..c6a9471 100644
--- a/customizations/scenes.yaml
+++ b/customizations/scenes.yaml
@@ -115,3 +115,6 @@ scene.balcony_concentrate:
 scene.balcony_off:
   friendly_name: 'Off'
   icon: mdi:flashlight-off
+scene.all_lights_off:
+  friendly_name: Lights Out
+  icon: mdi:power-plug-off
diff --git a/customizations/scripts.yaml b/customizations/scripts.yaml
index 6e081d0..22a2f2c 100644
--- a/customizations/scripts.yaml
+++ b/customizations/scripts.yaml
@@ -19,3 +19,9 @@ script.force_unlock_keyed:
 script.force_disconnect_keyed:
   friendly_name: Disconnect Keyed
   icon: mdi:close-octagon
+script.restart_dash_button_shm:
+  friendly_name: Restart Dash Button SHM controller
+  icon: mdi:autorenew
+script.restart_dash_button_hac:
+  friendly_name: Restart Dash Button Home Assistant controller
+  icon: mdi:autorenew
\ No newline at end of file
diff --git a/customizations/switches.yaml b/customizations/switches.yaml
index 39fb7bd..14e1f3d 100644
--- a/customizations/switches.yaml
+++ b/customizations/switches.yaml
@@ -10,3 +10,8 @@ switch.august_interior:
 switch.august_keyed:
   friendly_name: Keyed Bolt
   icon: mdi:key
+switch.kitchen_nightlight:
+  icon: mdi:theme-light-dark
+switch.alarm_status:
+  friendly_name: Alarm Status indicator
+  icon: mdi:security-home
diff --git a/groups.yaml b/groups.yaml
index bc8abc9..1e523aa 100644
--- a/groups.yaml
+++ b/groups.yaml
@@ -34,6 +34,7 @@ status_view:
   icon: mdi:chip
   entities:
     - group.sensor_pi
+    - group.time_date
     - group.sensor_battery_levels
 weather_view:
   name: Weather
@@ -47,6 +48,7 @@ misc_view:
   icon: mdi:power
   entities:
     - group.scripts_misc
+    - group.misc_misc
     - media_player.nexus_player
 locks:
   name: Locks
@@ -64,12 +66,14 @@ master_bathroom:
     - light.master_bath_1
     - light.master_bath_2
     - light.master_bath_3
+    - input_slider.brightness_master_bath
     - input_select.scene_master_bath
 living_room:
   name: Living Room
   entities:
     - light.endtable
     - light.corner_table
+    - input_slider.brightness_lr
     - input_select.scene_lr
 dining_area:
   name: Kitchen & Dining
@@ -77,6 +81,7 @@ dining_area:
     - switch.kitchen
     - light.ceiling_fan_1
     - light.ceiling_fan_2
+    - input_slider.brightness_da
     - input_select.scene_da
 office:
   name: Office
@@ -176,6 +181,15 @@ sensor_pi:
     # - sensor.packets_sent_eth1
     - sensor.ipv4_address_eth1
     - sensor.ipv6_address_eth1
+time_date:
+  name: Time & Date
+  entities:
+    - sensor.time
+    - sensor.date
+    - sensor.date_time
+    - sensor.time_date
+    - sensor.time_utc
+    - sensor.beat
 sensor_battery_levels:
   name: Sensor Battery Levels
   entities:
@@ -194,7 +208,7 @@ sensor_battery_levels:
     - sensor.office_cabinet_battery_level
     - sensor.green_keys_battery_level
 scripts_misc:
-  name: Actions
+  name: Lock Actions
   entities:
     - script.restart_august_daemon
     - script.force_lock_interior
@@ -203,6 +217,14 @@ scripts_misc:
     - script.force_lock_keyed
     - script.force_unlock_keyed
     - script.force_disconnect_keyed
+misc_misc:
+  name: Other
+  entities:
+    - switch.alarm_status
+    - switch.kitchen_nightlight
+    - scene.all_lights_off
+    - script.restart_dash_button_shm
+    - script.restart_dash_button_hac
 wunderground:
   name: Wunderground
   entities:
diff --git a/input-selects.yaml b/input-selects.yaml
index 21e75cf..b5068a0 100644
--- a/input-selects.yaml
+++ b/input-selects.yaml
@@ -11,7 +11,7 @@ scene_balcony:
     - Read
     - Bright
 scene_da:
-  name: Scene
+  name: Dining Area Scene
   icon: mdi:brightness-auto
   initial: "-"
   options:
@@ -48,6 +48,7 @@ scene_master_bath:
   options:
     - "-"
     - "Off"
+    - "Nightlight (single)"
     - Nightlight
     - Dimmed
     - Relax
diff --git a/input-sliders.yaml b/input-sliders.yaml
index 08f8da3..e4aa769 100644
--- a/input-sliders.yaml
+++ b/input-sliders.yaml
@@ -1,5 +1,18 @@
-office_brightness:
+brightness_da:
   name: Brightness
+  initial: 0
+  min: 1
+  max: 255
+  step: 1
+brightness_lr:
+  name: Brightness
+  initial: 0
+  min: 1
+  max: 255
+  step: 1
+brightness_master_bath:
+  name: Brightness
+  initial: 0
   min: 1
   max: 255
   step: 1
diff --git a/scenes/all-lights-off.yaml b/scenes/all-lights-off.yaml
new file mode 100644
index 0000000..9a18b52
--- /dev/null
+++ b/scenes/all-lights-off.yaml
@@ -0,0 +1,26 @@
+name: All Lights Off
+entities:
+  light.master_bath_1:
+    state: off
+  light.master_bath_2:
+    state: off
+  light.master_bath_3:
+    state: off
+  light.nightstand:
+    state: off
+  light.endtable:
+    state: off
+  light.corner_table:
+    state: off
+  switch.kitchen:
+    state: off
+  light.ceiling_fan_1:
+    state: off
+  light.ceiling_fan_2:
+    state: off
+  light.office:
+    state: off
+  light.ericks_desk_lamp:
+    state: off
+  switch.lava_lamp:
+    state: off
diff --git a/scenes/master-bath-dash-off.yaml b/scenes/master-bath-dash-off.yaml
new file mode 100644
index 0000000..70be3d2
--- /dev/null
+++ b/scenes/master-bath-dash-off.yaml
@@ -0,0 +1,8 @@
+name: Master Bath Dash Off
+entities:
+  light.master_bath_1:
+    state: off
+  light.master_bath_2:
+    state: off
+  light.master_bath_3:
+    state: off
diff --git a/scenes/master-bath-dash-on.yaml b/scenes/master-bath-dash-on.yaml
new file mode 100644
index 0000000..bee0050
--- /dev/null
+++ b/scenes/master-bath-dash-on.yaml
@@ -0,0 +1,10 @@
+name: Master Bath Dash On
+entities:
+  light.master_bath_1:
+    state: off
+  light.master_bath_2:
+    state: on
+    brightness: 1
+    color_temp: 450
+  light.master_bath_3:
+    state: off
diff --git a/scripts.yaml b/scripts.yaml
index 5d0d535..616a316 100644
--- a/scripts.yaml
+++ b/scripts.yaml
@@ -140,10 +140,20 @@ kitchen_light_set_timeout:
         entity_id: script.kitchen_light_timeout
 
 kitchen_light_timeout:
-  alias: "Turn off kitchen light after 5 minutes of inactivity"
+  alias: "Turn off kitchen light after 15 minutes of inactivity"
   sequence:
     - delay:
-        minutes: 5
+        minutes: 15
     - service: switch.turn_off
       data:
         entity_id: switch.kitchen
+
+# Restart Dash Button SHM controller
+restart_dash_button_shm:
+  sequence:
+    - service: shell_command.restart_dash_button_shm
+
+# Restart Dash Button Home Assistant controller
+restart_dash_button_hac:
+  sequence:
+    - service: shell_command.restart_dash_button_hac
diff --git a/secrets.yaml b/secrets.yaml
index 24cc3cb..873ee73 100644
--- a/secrets.yaml
+++ b/secrets.yaml
@@ -13,3 +13,4 @@ wunderground_key:
 wunderground_pws_id:
 logentries_token:
 mysql_recorder:
+wemo_ip:
diff --git a/sensors/time-date.yaml b/sensors/time-date.yaml
new file mode 100644
index 0000000..2c12f43
--- /dev/null
+++ b/sensors/time-date.yaml
@@ -0,0 +1,8 @@
+platform: time_date
+display_options:
+  - 'time'
+  - 'date'
+  - 'date_time'
+  - 'time_date'
+  - 'time_utc'
+  - 'beat'
diff --git a/shell_commands.yaml b/shell_commands.yaml
index 36775b3..b2bb8ed 100644
--- a/shell_commands.yaml
+++ b/shell_commands.yaml
@@ -1,7 +1,9 @@
-restart_august_daemon: /usr/bin/pm2 restart npm
+restart_august_daemon: /usr/bin/pm2 restart augustctl
 force_lock_keyed: curl http://localhost:3000/api/lock/keyed
 force_lock_interior: curl http://localhost:3000/api/lock/interior
 force_unlock_keyed: curl http://localhost:3000/api/unlock/keyed
 force_unlock_interior: curl http://localhost:3000/api/unlock/interior
 force_disconnect_keyed: curl http://localhost:3000/api/disconnect/keyed
 force_disconnect_interior: curl http://localhost:3000/api/disconnect/interior
+restart_dash_button_shm: /usr/bin/pm2 restart dash-button-shm
+restart_dash_button_hac: /usr/bin/pm2 restart dash-button-hac
diff --git a/switches.yaml b/switches.yaml
index bb2f6ce..118577b 100644
--- a/switches.yaml
+++ b/switches.yaml
@@ -19,17 +19,24 @@
   payload_on: "on"
   payload_off: "off"
   retain: true
+- platform: mqtt
+  name: "Alarm Status"
+  state_topic: "smartthings/Alarm Status/switch"
+  command_topic: "smartthings/Alarm Status/switch"
+  payload_on: "on"
+  payload_off: "off"
+  retain: true
 - platform: command_line
   switches:
     august_interior:
-      oncmd: 'curl "http://localhost:3000/api/lock/interior"'
-      offcmd: 'curl "http://localhost:3000/api/unlock/interior"'
-      statecmd: 'curl --silent "http://localhost:3000/api/status/interior" | jq ".status"'
+      command_on: 'curl "http://localhost:3000/api/lock/interior"'
+      command_off: 'curl "http://localhost:3000/api/unlock/interior"'
+      command_state: 'curl --silent "http://localhost:3000/api/status/interior" | jq ".status"'
       value_template: '{{ value == "0" }}'
 - platform: command_line
   switches:
     august_keyed:
-      oncmd: 'curl "http://localhost:3000/api/lock/keyed"'
-      offcmd: 'curl "http://localhost:3000/api/unlock/keyed"'
-      statecmd: 'curl --silent "http://localhost:3000/api/status/keyed" | jq ".status"'
+      command_on: 'curl "http://localhost:3000/api/lock/keyed"'
+      command_off: 'curl "http://localhost:3000/api/unlock/keyed"'
+      command_state: 'curl --silent "http://localhost:3000/api/status/keyed" | jq ".status"'
       value_template: '{{ value == "0" }}'
diff --git a/wemo.yaml b/wemo.yaml
new file mode 100644
index 0000000..ec5bd90
--- /dev/null
+++ b/wemo.yaml
@@ -0,0 +1,2 @@
+static:
+  - !secret wemo_ip
-- 
GitLab