diff --git a/.gitignore b/.gitignore index 4382f69..40c2167 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,9 @@ -/* -!*.yaml -!/alexa -!/automations -!/lights -!/scripts -!/sensors -!/switches -!README.md known_devices.yaml secrets.yaml +*.log +*.db +icloud/ +www/ +tts/ +deps/ +!.gitignore diff --git a/alerts/garage_issue.yaml b/alerts/garage_issue.yaml new file mode 100644 index 0000000..6bbf58c --- /dev/null +++ b/alerts/garage_issue.yaml @@ -0,0 +1,10 @@ +garage_issue: + name: Garage is open + done_message: Garage is closed + entity_id: input_boolean.garage_issue + state: 'on' + repeat: 5 + can_acknowledge: True + skip_first: False + notifiers: + - jeff_ios \ No newline at end of file diff --git a/alerts/jeff_heading_home.yaml b/alerts/jeff_heading_home.yaml new file mode 100644 index 0000000..158d5ac --- /dev/null +++ b/alerts/jeff_heading_home.yaml @@ -0,0 +1,10 @@ +jeff_heading_home: + name: Jeff will be home in {{states.sensor.jeff_ett_home.attributes.duration_in_traffic}}. + done_message: Jeff is home + entity_id: input_boolean.jeff_heading_home + state: 'on' + repeat: 20 + can_acknowledge: True + skip_first: False + notifiers: + - ios_katherinestonesiphone \ No newline at end of file diff --git a/alerts/kat_heading_home.yaml b/alerts/kat_heading_home.yaml new file mode 100644 index 0000000..e52f456 --- /dev/null +++ b/alerts/kat_heading_home.yaml @@ -0,0 +1,10 @@ +kat_heading_home: + name: Kat will be home in {{states.sensor.kat_ett_home.attributes.duration_in_traffic}}. + done_message: Kat is home + entity_id: input_boolean.kat_heading_home + state: 'on' + repeat: 20 + can_acknowledge: True + skip_first: False + notifiers: + - jeff_ios \ No newline at end of file diff --git a/alerts/security_issue.yaml b/alerts/security_issue.yaml new file mode 100644 index 0000000..b0fd56d --- /dev/null +++ b/alerts/security_issue.yaml @@ -0,0 +1,10 @@ +security_issue: + name: Security Issue Prevented Lockdown + done_message: Security Issue Resolved + entity_id: input_boolean.security_issue + state: 'on' + repeat: 2 + can_acknowledge: True + skip_first: False + notifiers: + - jeff_ios \ No newline at end of file diff --git a/alerts/tornado_warning.yaml b/alerts/tornado_warning.yaml new file mode 100644 index 0000000..1453e49 --- /dev/null +++ b/alerts/tornado_warning.yaml @@ -0,0 +1,10 @@ +tornado_warning: + name: Tornado Warning! + done_message: Tornado Alarm Canceled + entity_id: input_boolean.tornado_alarm + state: 'on' + repeat: 2 + can_acknowledge: True + skip_first: False + notifiers: + - jeff_ios \ No newline at end of file diff --git a/alerts/unauthorized_access.yaml b/alerts/unauthorized_access.yaml new file mode 100644 index 0000000..1dde01d --- /dev/null +++ b/alerts/unauthorized_access.yaml @@ -0,0 +1,10 @@ +unauthorized_access: + name: Unauthorized Access + done_message: Access Authorized + entity_id: input_boolean.security_alarm + state: 'on' + repeat: 2 + can_acknowledge: True + skip_first: False + notifiers: + - jeff_ios \ No newline at end of file diff --git a/automation/daily.yaml b/automation/daily.yaml new file mode 100644 index 0000000..c55c5a8 --- /dev/null +++ b/automation/daily.yaml @@ -0,0 +1,67 @@ + +# +# +# Daily Triggers +# +# +##################### +- alias: Good Morning + trigger: + - platform: time + hours: 5 + minutes: 15 + seconds: 0 + action: + - service: scene.turn_on + entity_id: scene.livingroom_normal + - service: notify.ios_jeffreystonesiphone + data: + message: Good Morning, Anchorage House is up and online. + +- alias: Good Night + trigger: + - platform: time + hours: 22 + minutes: 0 + seconds: 0 + action: + - service: scene.turn_on + entity_id: scene.livingroom_night + - service: notify.jeff_ios + data: + message: House shutting down for the night, Good Night + +- alias: Sunset Front Porch on + trigger: + - platform: sun + event: sunset + offset: -00:30:00 + action: + - service: switch.turn_on + data: + entity_id: switch.front_porch + +- alias: Sunrise Front Porch off + trigger: + - platform: sun + event: sunrise + action: + - service: switch.turn_off + data: + entity_id: switch.front_porch + +- alias: Sunset Inside on + trigger: + - platform: sun + event: sunset + offset: -01:00:00 + action: + service: script.inside_all_on + +- alias: Sunrise Inside off + trigger: + - platform: sun + event: sunrise + offset: 00:30:00 + action: + - service: script.inside_all_off \ No newline at end of file diff --git a/automation/door.yaml b/automation/door.yaml new file mode 100644 index 0000000..26fb91f --- /dev/null +++ b/automation/door.yaml @@ -0,0 +1,179 @@ + +# +# +# DoorAutomations +# +# +##################### +- alias: Door Opened + trigger: + - platform: state + entity_id: group.doors + from: 'off' + to: 'on' + condition: + - condition: state + entity_id: input_boolean.audible_notifications + state: 'on' + action: + - service: shell_command.door_chime + +- alias: Door Closed + trigger: + - platform: state + entity_id: group.doors + from: 'on' + to: 'off' + condition: + - condition: state + entity_id: input_boolean.audible_notifications + state: 'on' + action: + - service: shell_command.door_chime + + +- alias: Back Door Opened + trigger: + - platform: state + entity_id: binary_sensor.back_door + from: 'off' + to: 'on' + condition: + - condition: state + entity_id: input_boolean.audible_notifications + state: 'on' + action: + - service: homeassistant.turn_on + entity_id: script.security_warning_back_door + +- alias: Back Door Closed + trigger: + - platform: state + entity_id: binary_sensor.back_door + from: 'on' + to: 'off' + action: + - service: homeassistant.turn_off + entity_id: script.security_warning_back_door + +# - alias: Front Door Opened +# trigger: +# - platform: state +# entity_id: sensor.front_door +# from: closed +# to: open +# condition: +# - condition: state +# entity_id: input_boolean.audible_notifications +# state: 'on' +# action: +# - service: tts.google_say +# data: +# entity_id: media_player.hass_speaker +# message: Front Door is open + +# - alias: Front Door Closed +# trigger: +# - platform: state +# entity_id: sensor.front_door +# from: open +# to: closed +# condition: +# - condition: state +# entity_id: input_boolean.audible_notifications +# state: 'on' +# action: +# - service: tts.google_say +# data: +# entity_id: media_player.hass_speaker +# message: Front Door is closed + +# # - alias: Front Door Opened +# # trigger: +# # - platform: state +# # entity_id: sensor.front_door +# # from: closed +# # to: open +# # condition: +# # - condition: state +# # entity_id: input_boolean.audible_notifications +# # state: 'on' +# # action: +# # - service: shell_command.door_chime + +# # - alias: Front Door Closed +# # trigger: +# # - platform: state +# # entity_id: sensor.front_3 +# # from: open +# # to: closed +# # condition: +# # - condition: state +# # entity_id: input_boolean.audible_notifications +# # state: 'on' +# # action: +# # - service: shell_command.door_chime + +# - alias: Laundry Room Door Opened +# trigger: +# - platform: state +# entity_id: sensor.laundry_room_door +# from: closed +# to: open +# condition: +# - condition: state +# entity_id: input_boolean.audible_notifications +# state: 'on' +# action: +# - service: tts.google_say +# data: +# entity_id: media_player.hass_speaker +# message: Laundry Door is open + +# - alias: Laundry Roomm Door Closed +# trigger: +# - platform: state +# entity_id: sensor.laundry_room_door +# from: open +# to: closed +# condition: +# - condition: state +# entity_id: input_boolean.audible_notifications +# state: 'on' +# action: +# - service: tts.google_say +# data: +# entity_id: media_player.hass_speaker +# message: Laundry Door is closed + +- alias: Attic Door Opened + trigger: + - platform: state + entity_id: binary_sensor.attic_door + from: 'off' + to: 'on' + condition: + - condition: state + entity_id: input_boolean.audible_notifications + state: 'on' + action: + - service: tts.google_say + data: + entity_id: media_player.hass_speaker + message: Attic Door is open + +- alias: Attic Door Closed + trigger: + - platform: state + entity_id: binary_sensor.attic_door + from: 'on' + to: 'off' + condition: + - condition: state + entity_id: input_boolean.audible_notifications + state: 'on' + action: + - service: tts.google_say + data: + entity_id: media_player.hass_speaker + message: Attic Door is closed \ No newline at end of file diff --git a/automation/events.yaml b/automation/events.yaml new file mode 100644 index 0000000..5f848ab --- /dev/null +++ b/automation/events.yaml @@ -0,0 +1,83 @@ +# +# +# Events +# +############ + +- alias: Trash Morning Notification + trigger: + - platform: time + hours: 6 + minutes: 0 + seconds: 0 + condition: + - condition: time + weekday: + - tue + - condition: state + entity_id: input_boolean.vacation_mode + state: 'off' + - condition: state + entity_id: input_boolean.trash_notification + state: 'on' + action: + - service: notify.all_ios + data: + message: Don't forget to it is Trash Day + +- alias: Washer Running + trigger: + - platform: numeric_state + entity_id: sensor.washer_power + above: 100 + action: + - service: input_boolean.turn_on + entity_id: input_boolean.washer_running + +- alias: Washer Complete + trigger: + - platform: state + entity_id: sensor.washer_status + from: 'running' + to: 'idle' + condition: + - condition: state + entity_id: input_boolean.washer_running + state: 'on' + action: + - service: input_boolean.turn_off + entity_id: input_boolean.washer_running + - service: input_boolean.turn_on + entity_id: input_boolean.washer_notification + +- alias: Washer Notification + trigger: + - platform: state + entity_id: input_boolean.washer_notification + to: 'on' + condition: + - condition: state + entity_id: sensor.family_status + state: home + action: + - service: script.washer_finished_notification + +- alias: Get Dressed Skylar + trigger: + - platform: time + hours: 8 + minutes: 0 + seconds: 0 + condition: + - condition: time + weekday: + - mon + - tue + - wed + - thu + - condition: state + entity_id: input_boolean.guest_mode + state: 'off' + action: + - service: script.skylar_dressed_notification + \ No newline at end of file diff --git a/automation/garage.yaml b/automation/garage.yaml new file mode 100644 index 0000000..20bee94 --- /dev/null +++ b/automation/garage.yaml @@ -0,0 +1,120 @@ +# +# +# Garage +# +############ + + +- alias: Close Garage at Nine + trigger: + - platform: time + hours: 21 + minutes: 0 + seconds: 0 + condition: + - condition: state + entity_id: binary_sensor.garage_door + state: 'on' + action: + - service: script.close_garage + +- alias: Garage Open At Sunset + trigger: + - platform: sun + event: sunset + condition: + - condition: state + entity_id: binary_sensor.garage_door + state: 'on' + action: + - service: script.driveway_on + +- alias: Garage Closed + trigger: + - platform: state + entity_id: binary_sensor.garage_door + from: 'on' + to: 'off' + action: + - service: input_boolean.turn_off + data: + entity_id: input_boolean.garage_issue + +- alias: Garage Issue + trigger: + - platform: state + entity_id: input_boolean.garage_issue + to: 'on' + action: + - service: script.garage_failed_to_close + + +#- alias: Garage Issue Resolved +# trigger: +# - platform: state +# entity_id: input_boolean.garage_issue +# to: 'off' +# action: +# - service: script.garage_now_closed + +#- alias: Garage Closing +# trigger: +# - platform: mqtt +# topic: smartthings/Garage Door/door +# payload: closing +# action: +# - service: script.security_check_garage + +- alias: Garage Opening + trigger: + - platform: state + entity_id: binary_sensor.garage_door + from: closed + to: open + condition: + - condition: state + entity_id: sun.sun + state: 'below_horizon' + action: + - service: tts.google_say + data: + entity_id: media_player.hass_speaker + message: Garage is Opening + +- alias: Garage Opening Driveway Lights On + trigger: + - platform: state + entity_id: binary_sensor.garage_door + from: 'off' + to: 'on' + condition: + - condition: state + entity_id: sun.sun + state: 'below_horizon' + action: + - service: script.driveway_on + +- alias: Garage Closing Driveway Lights Off + trigger: + - platform: state + entity_id: binary_sensor.garage_door + from: 'on' + to: 'off' + action: + - service: homeassistant.turn_on + entity_id: script.driveway_off + +- alias: Garage Motion after Sunset + trigger: + - platform: state + entity_id: binary_sensor.garage_motion + from: 'off' + to: 'on' + condition: + - condition: state + entity_id: sun.sun + state: 'below_horizon' + action: + - service: notify.jeff_ios + data: + message: 'Motion: Garage' diff --git a/automation/media.yaml b/automation/media.yaml new file mode 100644 index 0000000..5d78219 --- /dev/null +++ b/automation/media.yaml @@ -0,0 +1,60 @@ +# +# +# Media +# +############ + +- alias: "Movie Started - Turn Off Lights" + trigger: + - platform: state + entity_id: media_player.apple_tv + to: 'playing' + condition: + - condition: state + entity_id: sun.sun + state: 'below_horizon' + action: + - service: scene.turn_on + entity_id: scene.movie_time + +- alias: "Movie Paused - Lights Dim" + trigger: + - platform: state + entity_id: media_player.apple_tv + from: 'playing' + to: 'paused' + condition: + - condition: state + entity_id: sun.sun + state: 'below_horizon' + action: + - service: scene.turn_on + entity_id: scene.livingroom_dim + +# - alias: "Movie Stopped - Lights On" +# trigger: +# - platform: state +# entity_id: media_player.apple_tv +# from: 'playing' +# to: 'idle' +# condition: +# - condition: state +# entity_id: sun.sun +# state: 'below_horizon' +# action: +# - service: scene.turn_on +# entity_id: scene.livingroom_normal + +# - alias: "Movie Resumed - Lights Off" +# trigger: +# - platform: state +# entity_id: media_player.apple_tv +# from: 'paused' +# to: 'playing' +# condition: +# - condition: state +# entity_id: sun.sun +# state: 'below_horizon' +# action: +# service: scene.turn_on +# entity_id: scene.movie_time \ No newline at end of file diff --git a/automation/notifications.yaml b/automation/notifications.yaml new file mode 100644 index 0000000..b28099b --- /dev/null +++ b/automation/notifications.yaml @@ -0,0 +1,44 @@ + +# +# +# Notifications +# +# +##################### + +- alias: Turn Off Audible Notifications at 8pm + trigger: + - platform: time + hours: 20 + minutes: 0 + seconds: 0 + action: + - service: input_boolean.turn_off + entity_id: input_boolean.audible_notifications + + +- alias: Turn Off Audible Notifications at 7pm + trigger: + - platform: time + hours: 19 + minutes: 0 + seconds: 0 + condition: + - condition: state + entity_id: input_boolean.guest_mode + state: 'on' + action: + - service: input_boolean.turn_off + entity_id: input_boolean.audible_notifications + + +- alias: Turn On Audible Notifications at 8am + trigger: + - platform: time + hours: 8 + minutes: 0 + seconds: 0 + action: + - entity_id: input_boolean.audible_notifications + service: input_boolean.turn_on + \ No newline at end of file diff --git a/automation/presence.yaml b/automation/presence.yaml new file mode 100644 index 0000000..9b28a9f --- /dev/null +++ b/automation/presence.yaml @@ -0,0 +1,131 @@ + +# +# +# Presence Automations +# +# +##################### + +- alias: Family Has arrived + trigger: + - entity_id: sensor.family_status + from: away + platform: state + to: home + action: + - service: script.standby + - service: script.driveway_on + - service: script.vacation_canceled + - service: script.washer_finished_notification + - service: script.appliances_on + +- alias: Family Has Left + trigger: + - entity_id: sensor.family_status + from: home + platform: state + to: away + condition: + - condition: state + entity_id: input_boolean.guest_mode + state: 'off' + action: + - service: script.close_garage + - service: script.lockdown + - service: script.appliances_off + +- alias: Family Devices Have arrived + trigger: + - entity_id: group.family + from: not_home + platform: state + to: home + condition: + - condition: state + entity_id: sensor.family_presence + state: 'away' + action: + - service: script.family_is_home + +#- alias: Family Devices Have Left +# trigger: +# - entity_id: group.family +# from: home +# platform: state +# to: not_home +# condition: +# - condition: state +# entity_id: sensor.family_status +# state: 'home' +# action: +# - service: script.family_is_away + +- alias: Jeff Arrives Home + trigger: + # - entity_id: device_tracker.owntracks_jeffreystonesiphone + # event: enter + # platform: zone + # zone: zone.home + - entity_id: sensor.jeff_presence + from: 'not present' + platform: state + to: 'present' + action: + - service: script.jeff_destination_arrived + - service: script.driveway_on + - service: input_boolean.turn_off + entity_id: input_boolean.jeff_heading_home + +- alias: Jeff Arrives At Summit + trigger: + - entity_id: device_tracker.owntracks_jeffreystonesiphone + event: enter + platform: zone + zone: zone.summit + action: + - service: script.jeff_destination_arrived + - service: script.jeff_at_work_notification + +- alias: Kat Arrives Home Notification + trigger: + - entity_id: device_tracker.katherinestonesiphone + event: enter + platform: zone + zone: zone.home + action: + - service: script.kat_is_home_audible + - service: input_boolean.turn_off + entity_id: input_boolean.kat_heading_home + - service: script.driveway_on + +- alias: Kat Arrives Zoo Notification + trigger: + - platform: zone + event: enter + zone: zone.zoo_atlanta + entity_id: device_tracker.katherinestonesiphone + condition: + - condition: state + entity_id: input_boolean.text_notify_jeff + state: 'on' + action: + - service: notify.ios_jeffreystonesiphone + data: + message: Kat is at Zoo Atlanta + +- alias: Kat Leaves Zoo Notification + trigger: + - platform: zone + event: leave + zone: zone.zoo_atlanta + entity_id: device_tracker.katherinestonesiphone + condition: + - condition: state + entity_id: input_boolean.text_notify_jeff + state: 'on' + action: + #- service: notify.ios_jeffreystonesiphone + # data: + # message: Kat left Zoo Atlanta + - service: input_boolean.turn_on + entity_id: input_boolean.kat_heading_home diff --git a/automation/security.yaml b/automation/security.yaml new file mode 100644 index 0000000..692e382 --- /dev/null +++ b/automation/security.yaml @@ -0,0 +1,236 @@ + +# +# +# Security +# +# For all these automations the condition should be +# +# - condition: state +# entity_id: input_boolean.secure_mode +# state: 'on' +# +# +##################### + +- alias: Nightly Lockdown + trigger: + - platform: time + hours: 23 + minutes: 00 + seconds: 0 + condition: + - condition: state + entity_id: sensor.jeff_presence + state: 'present' + - condition: state + entity_id: sensor.kat_presence + state: 'present' + - condition: state + entity_id: input_boolean.guest_mode + state: 'off' + action: + - service: script.lockdown + + +- alias: Morning Standby + trigger: + - platform: time + hours: 5 + minutes: 30 + seconds: 0 + condition: + condition: or + conditions: + - condition: state + entity_id: sensor.family_status + state: 'home' + - condition: state + entity_id: input_boolean.guest_mode + state: 'on' + action: + - service: script.standby + +# - alias: Security Check - Away +# trigger: +# - platform: state +# entity_id: sensor.house_mode +# from: home +# to: away +# action: +# - service: script.security_check_zones +# - service: script.security_check_garage + +- alias: Security Check + trigger: + - platform: state + entity_id: input_boolean.secure_mode + to: 'on' + action: + - service: homeassistant.turn_on + entity_id: script.security_check_zones + - service: homeassistant.turn_on + entity_id: script.security_check_garage + - service: script.security_check_verified + +- alias: Security Breach + trigger: + - platform: state + entity_id: binary_sensor.garage_door + to: open + - platform: state + entity_id: binary_sensor.zone_status + to: open + - platform: state + entity_id: binary_sensor.garage_motion + to: motion + condition: + - condition: state + entity_id: input_boolean.secure_mode + state: 'on' + action: + - service: input_boolean.turn_on + entity_id: input_boolean.security_alarm + +# - alias: Security Breach Garage Door +# trigger: +# - platform: state +# entity_id: sensor.garage_door_contact +# to: open +# condition: +# - condition: state +# entity_id: input_boolean.secure_mode +# state: 'on' +# action: +# - service: script.security_warning_garage_door + +# - alias: Security Breach Garage Motion +# trigger: +# - platform: state +# entity_id: sensor.garage_motion +# to: motion +# condition: +# - condition: state +# entity_id: input_boolean.secure_mode +# state: 'on' +# action: +# - service: script.security_warning_garage_motion + +# - alias: Security Breach Front Door +# trigger: +# - platform: state +# entity_id: sensor.front_door +# to: open +# condition: +# - condition: state +# entity_id: input_boolean.secure_mode +# state: 'on' +# action: +# - service: script.security_warning_front_door + +# - alias: Security Breach Back Door +# trigger: +# - platform: state +# entity_id: sensor.zone_3 +# to: open +# condition: +# - condition: state +# entity_id: input_boolean.secure_mode +# state: 'on' +# action: +# - service: script.security_warning_back_door + + +# - alias: Security Breach Landry Door +# trigger: +# - platform: state +# entity_id: sensor.Laundry_room_door +# to: open +# condition: +# - condition: state +# entity_id: input_boolean.secure_mode +# state: 'on' +# action: +# - service: script.security_warning_laundry_door + +- alias: Security Access Granted + trigger: + - platform: state + entity_id: sensor.house_mode + to: home + - platform: state + entity_id: sensor.family_status + to: home + condition: + - condition: state + entity_id: input_boolean.secure_mode + state: 'on' + action: + - service: input_boolean.turn_off + entity_id: input_boolean.security_alarm + +- alias: Security Alarm Activated + trigger: + platform: state + entity_id: input_boolean.security_alarm + to: 'on' + action: + - service: homeassistant.turn_on + entity_id: script.security_sound_alarm_intro + - service: homeassistant.turn_on + entity_id: script.security_sound_alarm + - service: homeassistant.turn_on + entity_id: script.security_report + + +- alias: Security Alarm Deactivated + trigger: + platform: state + entity_id: input_boolean.security_alarm + to: 'off' + action: + - service: homeassistant.turn_off + entity_id: script.security_sound_alarm + - service: script.access_authorized + - service: script.standby + - service: homeassistant.turn_off + entity_id: script.security_sound_alarm_intro + - service: homeassistant.turn_off + entity_id: script.security_report + +- alias: Security Issue Resolved + trigger: + - platform: state + entity_id: binary_sensor.garage_door + to: closed + - platform: state + entity_id: sensor.zone_status + to: closed + condition: + - condition: state + entity_id: binary_sensor.garage_door + state: 'closed' + - condition: state + entity_id: sensor.zone_status + state: 'closed' + action: + - service: input_boolean.turn_off + entity_id: input_boolean.security_issue + +- alias: Late Arrival Lockdown + trigger: + - platform: state + entity_id: sensor.jeff_presence + to: 'present' + - platform: state + entity_id: sensor.jeff_presence + to: 'present' + condition: + - condition: state + entity_id: input_boolean.guest_mode + state: 'off' + - condition: time + after: '23:00:00' + before: '05:00:00' + action: + - service: script.lockdown_delay + diff --git a/automation/switches.yaml b/automation/switches.yaml new file mode 100644 index 0000000..4d8bffa --- /dev/null +++ b/automation/switches.yaml @@ -0,0 +1,25 @@ +# +# +# Switches +# +############ + +- alias: "Kitchen - Turn Off Lights" + trigger: + - platform: state + entity_id: light.kitchen_cabinets + to: 'off' + action: + - service: light.turn_off + data: + entity_id: light.kitchen_light_strip + +- alias: "Kitchen - Turn On Lights" + trigger: + - platform: state + entity_id: light.kitchen_cabinets + to: 'on' + action: + - service: light.turn_on + data: + entity_id: light.kitchen_light_strip \ No newline at end of file diff --git a/automation/transit.yaml b/automation/transit.yaml new file mode 100644 index 0000000..642f10e --- /dev/null +++ b/automation/transit.yaml @@ -0,0 +1,47 @@ +# +# +# Transit +# +############ + +- alias: Jeff eta home + trigger: + - platform: state + entity_id: sensor.jeff_destination + to: Home + action: + # - service: notify.ios_katherinestonesiphone + # data: + # message: Jeff will be home in {{states.sensor.jeff_ett_home.attributes.duration_in_traffic}}. + - service: input_boolean.turn_on + entity_id: input_boolean.jeff_heading_home + +- alias: Jeff no destination + trigger: + - platform: state + entity_id: sensor.jeff_status + to: 'moving' + condition: + - condition: state + entity_id: sensor.jeff_destination + state: Arrived + action: + - service: script.jeff_destination_na + +- alias: Jeff is stationary + trigger: + - platform: numeric_state + entity_id: sensor.jeff_velocity + below: 1 + action: + - service: script.jeff_is_stationary + +- alias: Jeff is moving + trigger: + - platform: numeric_state + entity_id: sensor.jeff_velocity + above: 0 + action: + - service: script.jeff_is_moving + + diff --git a/automation/weather.yaml b/automation/weather.yaml new file mode 100644 index 0000000..e188cdf --- /dev/null +++ b/automation/weather.yaml @@ -0,0 +1,74 @@ +# +# +# Weather +# +############ + +- alias: Cloudy inside on + trigger: + - platform: time + at: '16:00:00' + condition: + - condition: numeric_state + entity_id: sensor.dark_sky_cloud_coverage + above: 70 + - condition: state + entity_id: group.family + state: home + action: + - service: notify.ios_jeffreystonesiphone + data: + message: Cloudy, turning on LR Lamp + +- alias: Cloudy porch on early + trigger: + - platform: sun + event: sunset + offset: -01:30:00 + condition: + - condition: numeric_state + entity_id: sensor.dark_sky_cloud_coverage + above: 70 + action: + - service: switch.turn_on + data: + entity_id: switch.front_porch_left + - service: switch.turn_on + data: + entity_id: switch.front_porch_right + +- alias: Kill Audible Tornado Alarm + trigger: + - platform: state + entity_id: input_boolean.tornado_alarm + to: 'off' + action: + - service: script.kill_audible_alarm + - service: homeassistant.turn_off + entity_id: script.tornado_alarm + +- alias: Sound Audible Tornado Alarm + trigger: + - platform: state + entity_id: input_boolean.tornado_alarm + to: "on" + action: + - service: script.tornado_warning + - service: homeassistant.turn_on + entity_id: script.tornado_alarm + +- alias: Tornado Warning + trigger: + - platform: state + entity_id: sensor.tornado_warning + to: "active" + action: + - service: input_boolean.turn_on + entity_id: input_boolean.tornado_alarm + +- alias: Wx Alert Notification + trigger: + - platform: state + entity_id: sensor.pws_alerts + action: + - service: script.wxalert_tile \ No newline at end of file diff --git a/binary_sensors/doors.yaml b/binary_sensors/doors.yaml new file mode 100644 index 0000000..616bfc5 --- /dev/null +++ b/binary_sensors/doors.yaml @@ -0,0 +1,35 @@ +- platform: mqtt + name: "Back Door" + state_topic: "smartthings/Back Door/contact" + payload_on: "open" + payload_off: "closed" + retain: true + device_class: door +- platform: mqtt + name: "Garage Door" + state_topic: "smartthings/Garage Door/contact" + payload_on: "open" + payload_off: "closed" + retain: true + device_class: garage_door +- platform: mqtt + name: "Front Door" + state_topic: "smartthings/Front Door/contact" + payload_on: "open" + payload_off: "closed" + retain: true + device_class: door +- platform: mqtt + name: "Laundry Room Door" + state_topic: "smartthings/Laundry Room Door/contact" + payload_on: "open" + payload_off: "closed" + retain: true + device_class: door +- platform: mqtt + name: "Attic Door" # Dome Door Sensor + state_topic: "smartthings/Attic Door/contact" + payload_on: "open" + payload_off: "closed" + retain: true + device_class: door \ No newline at end of file diff --git a/binary_sensors/motion.yaml b/binary_sensors/motion.yaml new file mode 100644 index 0000000..05d598b --- /dev/null +++ b/binary_sensors/motion.yaml @@ -0,0 +1,7 @@ +- platform: mqtt + name: "Garage Dome Sensor" # Dome Motion Sensor + state_topic: "smartthings/Garage Motion/contact" + payload_on: "open" + payload_off: "closed" + retain: true + device_class: motion diff --git a/intents/alexa_confirm.yaml b/intents/alexa_confirm.yaml new file mode 100644 index 0000000..90e7325 --- /dev/null +++ b/intents/alexa_confirm.yaml @@ -0,0 +1,17 @@ +> + {% set responses = [ + "OK", + "Sure", + "If you insist", + "Done", + "I can do that", + "Leave it to me", + "Consider it done", + "As you wish", + "By your command", + "Affirmative", + "I will", + "No Problem" + ] %} + {% set rindex = (range(0, (responses | length - 1) )|random) -%} + {{responses[rindex]}} diff --git a/intents/intents.yaml b/intents/intents.yaml new file mode 100644 index 0000000..a9ab6bb --- /dev/null +++ b/intents/intents.yaml @@ -0,0 +1,116 @@ +#intents: + + +WhatIsTheCurrentStatus: + speech: + type: plain + text: > + Outside it's {{states.sensor.dark_sky_summary.state}} and {{states.sensor.dark_sky_temperature.state|round}} degrees in Grayson. + Today will be {{states.sensor.dark_sky_hourly_summary.state|replace(".", "")}}, + with a high of {{states.sensor.dark_sky_daily_high_temperature.state|round}} degrees. + {%- if is_state('sensor.pws_alerts', '0') -%} + There are no active weather alerts. + {%- else -%} + There are {{states.sensor.pws_alerts.state}} active weather alerts. + {% endif %} + {%- if is_state('sun.sun', 'above_horizon') -%} + The sun will set at {{ ((as_timestamp(states.sun.sun.attributes.next_setting)) | timestamp_local) [11:16] }} + {% else %} + The sun will rise at {{ ((as_timestamp(states.sun.sun.attributes.next_rising)) | timestamp_local) [11:16] }} + {% endif %} + +IsTheHouseSecure: + speech: + type: plain + text: > + {%- if is_state('binary_sensor.zone_3', 'on') -%} + Zone 3 is currently open. + {%- else -%} + Zone 3 is closed + {% endif %} + {%- if is_state('cover.garage_door', 'open') -%} + The Garage Door is currently open. + {%- else -%} + The Garage Door is closed + {% endif %} + {%- if is_state('input_boolean.house_secured', 'on') -%} + Anchorage House is actively monitoring. + {%- else -%} + Anchorage House is not being monitoring. + {% endif %} + +GarageStatus: + speech: + type: plain + text: > + {%- if is_state('sensor.garage_door_contact', 'open') -%} + The Garage is open + {%- else -%} + The Garage is closed + {% endif %} + +CloseTheGarage: + action: + service: script.turn_on + data_template: + entity_id: script.close_garage + speech: + type: plain + text: !include alexa_confirm.yaml + +OpenTheGarage: + action: + service: script.turn_on + data_template: + entity_id: script.open_garage + speech: + type: plain + text: !include alexa_confirm.yaml + +JeffETRHome: + speech: + type: plain + text: > + {%- if is_state('device_tracker.owntracks_jeffreystonesiphone', 'home') -%} + It appears Jeff is home + {%- else -%} + Jeff will be home in {{states.sensor.jeff_ett_home.attributes.duration_in_traffic}} + {% endif %} + +KatETRHome: + speech: + type: plain + text: > + {%- if is_state('device_tracker.katherinestonesiphone', 'home') -%} + It appears Katherine is home + {%- else -%} + Katherine will be home in {{states.sensor.kat_ett_home.attributes.duration_in_traffic}} + {% endif %} + +WhereIsJeff: + speech: + type: plain + text: > + {%- if is_state('device_tracker.owntracks_jeffreystonesiphone', 'home') -%} + Jeff is here somewhere. Where was the last place you saw him? + {%- else -%} + {%- if is_state('sensor.jeffrey_location', 'moving') -%} + Jeff is currently inbetween stops and could be home in {{states.sensor.jeff_ett_home.attributes.duration_in_traffic}} + {%- else -%} + Jeff is at {{ states("sensor.jeffrey_location") }} + {% endif %} + {% endif %} + +WhereIsKat: + speech: + type: plain + text: > + {%- if is_state('device_tracker.katherinestonesiphone', 'home') -%} + Katherine is here. + {%- else -%} + {%- if is_state('device_tracker.katherinestonesiphone', 'not_home') -%} + Katherine is currently inbetween stops and could be home in {{states.sensor.kat_ett_home.attributes.duration_in_traffic}} + {%- else -%} + Katherine is at {{ states.device_tracker.katherinestonesiphone.state }} + {% endif %} + {% endif %} \ No newline at end of file