Updated to V5 Version - Hassio Style

Lots of updates here.

Updated my Readme - Added Affiliate Links, added some more information, better organized devices
Updated gitignore with paths realtive to my hassio config
Combined my switches and lights into single yaml files instead of the directory structure previously
Added zigbee2mqtt.yaml to packages - contains automations and such for zigbee2mqtt

Archived my previous version in the V4-config branch.
This commit is contained in:
Jeffrey Stone
2019-11-08 12:54:11 -05:00
parent f00f5bdccb
commit e02d084c92
74 changed files with 1409 additions and 1051 deletions

View File

@@ -0,0 +1,144 @@
###############################################################################
# @author : Jeffrey Stone
# @date : 02/19/2019
# @package : Announcements
# @description : Daily Announcements.
###############################################################################
###############################
# input_datetime - So the time report automation fires can be set in the UI
###############################
input_datetime:
morning_report:
name: Morning Report
has_date: false
has_time: true
nightly_report:
name: Nightly Report
has_date: false
has_time: true
skylar_morning_report:
name: Skylar Dressed Announcement
has_date: false
has_time: true
skylar_nightly_report:
name: Skylar Bedtime Announcement
has_date: false
has_time: true
################################
# Announcment Automation - fires at the time of the above input_datetimes
################################
automation:
- id: prebed_routine
initial_state: true
alias: Skylar Nightly Announcements
trigger:
platform: template
value_template: "{{ states('sensor.time') == (state_attr('input_datetime.skylar_nightly_report', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}"
action:
- service: script.ah_report
data:
call_interuption: 1
call_time_annc: 1
call_prebed_routine: 1
- id: nightly_report
initial_state: true
alias: Nightly Report
trigger:
platform: template
value_template: "{{ states('sensor.time') == (state_attr('input_datetime.nightly_report', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}"
action:
- service: script.ah_report
data:
call_greeting: 1
call_evening_greeting: 1
call_time_annc: 1
call_weather_alerts: 1
call_overnight_forecast: 1
call_upcoming_holidays: 1
call_reminders: 1
call_chores: 1
- id: good_morning_report
alias: Good Morning Report
initial_state: true
trigger:
platform: template
value_template: "{{ states('sensor.time') == (state_attr('input_datetime.morning_report', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}"
action:
- service: script.ah_report
data:
call_greeting: 1
call_morning_greeting: 1
call_time_annc: 1
call_weather_alerts: 1
call_todays_events: 1
call_current_conditions_outisde: 1
call_current_conditions_inside: 1
call_daily_forecast: 1
call_upcoming_birthdays: 1
call_reminders: 1
call_chores: 1
- service: script.twitter_notify
data:
message: 'I just provided a morning briefing including weather, and traffic
conditions to the residents of Anchorage House. '
- id: skylar_morning_greeting
alias: Skylar Morning Greeting
initial_state: true
trigger:
platform: template
value_template: "{{ states('sensor.time') == (state_attr('input_datetime.skylar_morning_report', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}"
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
action:
- service: script.ah_report
data:
call_interuption: 1
call_time_annc: 1
call_skylar_dressed: 1
call_school_today: 1
call_skylar_events: 1
call_clothes_suggestion: 1
- id: set_skylar_morning_report_time
alias: set skylar morning report time
trigger:
- platform: time
at: '05:50:00'
action:
- service: input_datetime.set_datetime
entity_id: input_datetime.skylar_morning_report
data_template:
time: >
{% if states.calendar.skylar_school.attributes.offset_reached == True %}
06:30
{% else %}
07:58
{% endif %}
- id: set_morning_report_time
alias: set morning report time
trigger:
- platform: time
at: '05:50:30'
action:
- service: input_datetime.set_datetime
entity_id: input_datetime.morning_report
data_template:
time: >
{% if states.calendar.skylar_school.attributes.offset_reached == True %}
07:00
{% else %}
07:45
{% endif %}

1009
config/packages/disney.yaml Executable file

File diff suppressed because it is too large Load Diff

44
config/packages/events.yaml Executable file
View File

@@ -0,0 +1,44 @@
###############################################################################
# @author : Jeffrey Stone
# @date : 02/19/2019
# @package : Events
# @description : Special Events.
###############################################################################
automation:
- id: refresh_special_event_sensors
alias: Refresh special event sensors
initial_state: true
trigger:
- platform: time
at: '00:00:01'
- platform: homeassistant
event: start
action:
- service: python_script.special_events
data:
name: Skylar
type: birthday
date: !secret skylar_bday
- service: python_script.special_events
data:
name: Jeff
type: birthday
date: !secret jeff_bday
- service: python_script.special_events
data:
name: Kat
type: birthday
date: !secret kat_bday
- service: python_script.special_events
data:
name: Our wedding
type: anniversary
date: !secret wed_anniversary
- service: python_script.special_events
data:
name: Disney
type: trip
date: !secret disney_trip

View File

@@ -0,0 +1,83 @@
###############################################################################
# @author : Jeffrey Stone
# @date : 10/29/2019
# @package : Haunted Mansion Show
# @description : Config used to put on the Pre-show from Disney's Haunted Mansion in the living room
###############################################################################
input_boolean:
haunted_mansion:
name: Haunted Mansion
automation:
# Turn on Haunted Mansion Show when input_boolean is flipped on
- id: haunted_mansion_on
alias: Haunted Mansion On
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.haunted_mansion
to: 'on'
action:
- service: script.turn_on
entity_id: script.haunted_mansion_start
# Turn off Haunted Mansion Show when input_boolean is flipped off
- id: haunted_mansion_off
alias: Haunted Mansion Off
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.haunted_mansion
to: 'off'
action:
- service: script.kill_this_ride
- service: media_player.media_stop
entity_id: media_player.ha_speaker
script:
haunted_mansion_start:
sequence:
- condition: state
entity_id: input_boolean.audible_notifications
state: 'on'
- condition: state
entity_id: sensor.family_status
state: Home
- service: shell_command.normal_vol
- service: shell_command.haunted_mansion_preshow_full
- service: light.turn_on
entity_id: group.rgb_lr
data:
rgb_color: [255,255,255]
- delay: 00:01:06
- service: light.turn_on
entity_id: group.rgb_lr
data:
rgb_color: [73,119,255]
- delay: 00:00:15
- service: light.turn_on
entity_id: group.rgb_lr
data:
brightness_pct: 25
- delay: 00:00:37
- service: switch.turn_on
entity_id: switch.rail_lights
- service: switch.turn_off
entity_id: switch.rail_lights
- delay: 00:00:02
- service: scene.turn_on
data:
entity_id: scene.haunted_lights_out
- service: switch.turn_on
entity_id: switch.rail_lights
- service: switch.turn_off
entity_id: switch.rail_lights
- delay: 00:00:10
- service: light.turn_on
entity_id: group.rgb_lr
data:
rgb_color: [255,255,255]
brightness_pct: 25
- delay:
seconds: 160

211
config/packages/holidays.yaml Executable file
View File

@@ -0,0 +1,211 @@
###############################################################################
# @author : Jeffrey Stone
# @date : 02/19/2019
# @package : Holidays
# @description : Holiday Specific.
#
# I'm not sure where I got this, but it leverages a python script: https://github.com/thejeffreystone/home-assistant-configuration/blob/master/python_scripts/special_events.py
#
# To create a sensor just create an automation to fire around midnight.
#
# automation:
# - id: refresh_holioday_sensors
# alias: Refresh Holiday sensors
# initial_state: true
# trigger:
# - platform: time
# at: '00:00:07'
# - platform: homeassistant
# event: start
# action:
# - service: python_script.special_events
# data:
# name: Christmas
# type: holiday
# date: 25/12/2001
#
# Where Name equals the name of the event, type is the type of event, and date is the date in DD/MM/YYYY format
#
# Year only matters if your want to take advantage fo the years attribute which will tell you have many years since the event. Useful
# with birthdays and anniversaries.
#
# I use the Following types:
# birthday
# anniversary
# holiday
# trip
#
# The type will be used in the name of the sensor it creates. For example:
# sensor.trip_camping
# sensor.birthday_jeff
# sensor.holiday_christmas
#
# The state of the sensor will be the days until the event. For birthdays and anniversaries it will never be more than 365.
# For example {{ states.sensor.birthday_jeff.state }} will be the number of days until my next birthday.
# And {{ states.sensor.birthday_jeff.attributes.years }} will be my age, or the number of years since my birth (if you put the real year in)
# For events with a year in the future, the state will be number of days to that exact moment in time.
#
###############################################################################
input_boolean:
this_is_halloween:
name: This is Halloween
haunted_sounds:
name: Haunted Sounds
automation:
- id: refresh_holioday_sensors
alias: Refresh Holiday sensors
initial_state: true
trigger:
- platform: time
at: '00:00:07'
- platform: homeassistant
event: start
action:
- service: python_script.special_events
data:
name: Christmas
type: holiday
date: 25/12/2001
- service: python_script.special_events
data:
name: Halloween
type: holiday
date: 31/10/2001
- id: this_is_halloween_on
alias: This is Halloween On
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.this_is_halloween
to: 'on'
action:
- service: script.turn_on
entity_id: script.this_is_halloween
- id: haunted_sounds_on
alias: Haunted Sounds On
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.haunted_sounds
to: 'on'
action:
- service: script.turn_on
entity_id: script.haunted_sounds
- id: haunted_sounds_off
alias: Haunted Sounds Off
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.haunted_sounds
to: 'off'
action:
- service: script.turn_off
entity_id: script.haunted_sounds
- id: this_is_halloween_off
alias: This is Halloween Off
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.this_is_halloween
to: 'off'
action:
- service: script.turn_on
entity_id: script.kill_this_ride
- service: media_player.media_stop
entity_id: media_player.ha_speaker
- id: this_is_halloween
alias: This is Halloween
initial_state: true
trigger:
- platform: template
value_template: "{{ states('sensor.time') == (state_attr('input_datetime.halloween_show', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}"
condition:
- condition: state
entity_id: calendar.holidays_in_united_states
state: "on"
- condition: template
value_template: >
{%- set event=states.calendar.holidays_in_united_states.attributes.message %}
{%- if event == 'Halloween' %}
true
{%- endif -%}
action:
- service: input_boolean.turn_on
entity_id: input_boolean.this_is_halloween
- id: operation_haunted_house
alias: Operation Haunted House
initial_state: true
trigger:
- platform: template
value_template: "{{ states('sensor.time') == (state_attr('input_datetime.halloween_show', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}"
condition:
- condition: state
entity_id: calendar.holidays_in_united_states
state: "on"
- condition: template
value_template: >
{%- set event=states.calendar.holidays_in_united_states.attributes.message %}
{%- if event == 'Halloween' %}
true
{%- endif -%}
action:
- service: script.turn_on
entity_id: input_boolean.haunted_sounds
script:
haunted_sounds:
sequence:
- delay: 00:05:00
- service: shell_command.haunted_scream
- delay: 00:07:06
- service: shell_command.haunted_leotta
- delay: 00:02:36
- service: shell_command.haunted_raven
- delay: 00:04:03
- service: shell_command.haunted_harp
- delay: 00:01:40
- service: shell_command.haunted_door
- delay: 00:03:33
- service: shell_command.haunted_howling
- delay: 00:04:03
- service: shell_command.haunted_laugh2
- delay: 00:03:56
- service: shell_command.haunted_seance_horn
- delay: 00:08:00
- service: shell_command.haunted_piano
- delay: 00:03:10
- service: shell_command.haunted_clock
- delay: 00:07:33
- service: shell_command.haunted_ballroom
- delay: 00:03:18
- service: shell_command.haunted_door2
- delay: 00:05:00
- service: shell_command.haunted_bells
- delay: 00:02:18
- service: shell_command.haunted_laugh
- delay: 00:06:36
- service: shell_command.haunted_chains
sensor:
- platform: rest
name: Halloween Countdown
resource: !secret WA_HALLOWEEN
value_template: "{{ (value|replace(' days', '')) | int }}"
unit_of_measurement: Days
scan_interval: 43200
- platform: rest
name: Christmas Countdown
resource: !secret WA_XMAS
value_template: "{{ (value|replace(' days', '')) | int }}"
unit_of_measurement: Days
scan_interval: 43200

23
config/packages/jarvis.yaml Executable file
View File

@@ -0,0 +1,23 @@
###############################################################################
# @author : Jeffrey Stone
# @date : 07/09/2019
# @package : Jarvis
# @description : Brining some Jarvis to Home Assistant
###############################################################################
automation:
script:
activate_house_party_protocol:
sequence:
- service: scene.turn_on
entity_id: scene.house_party_protocol
- service: script.ah_report
data_template:
speech_message: >
{{ [
"Anchorage House has been configured for a House Party.",
"Incense has been turned on.",
"I have enabled house party protocol."
] | random }}

1062
config/packages/notify.yaml Executable file

File diff suppressed because it is too large Load Diff

448
config/packages/presence.yaml Executable file
View File

@@ -0,0 +1,448 @@
###############################################################################
# @author : Jeffrey Stone
# @date : 02/19/2019
# @package : Presence
# @description : A Collection of Presence Related Trackers and Sensors
###############################################################################
sensor:
- platform: template
sensors:
jeff_location:
friendly_name: "Jeff's Current Location"
unit_of_measurement: ''
value_template: >-
{%- if is_state('person.jeffrey', 'not_home') %}
{%- if states.device_tracker.life360_jeffrey_stone.attributes.moving == True %}
Flue Network
{%- elif states.device_tracker.life360_jeffrey_stone.attributes.driving == True %}
Flue Network
{% else %}
Lost
{%- endif %}
{% elif is_state('person.jeffrey', 'Sprouts') %}
Grocery Store
{% elif is_state('person.jeffrey', 'Kroger1') %}
Grocery Store
{% elif is_state('person.jeffrey', 'Kroger2') %}
Grocery Store
{% elif is_state('person.jeffrey', 'Home Depot') %}
Home Improvement Store
{% elif is_state('person.jeffrey', 'Lowes') %}
Home Improvement Store
{% elif is_state('person.jeffrey', 'Walmart') %}
Super Store
{% elif is_state('person.jeffrey', 'Target') %}
Super Store
{% else %}
{{ states.person.jeffrey.state }}
{%- endif %}
jeff_driving:
friendly_name: "Jeff' Driving"
unit_of_measurement: ''
value_template: >-
{%- if states.device_tracker.life360_jeffrey_stone.attributes.moving == True %}
on
{% elif states.device_tracker.life360_jeffrey_stone.attributes.driving == True %}
on
{% else %}
off
{% endif %}
- platform: template
sensors:
skylar_location:
friendly_name: "Skylar's Current Location"
unit_of_measurement: ''
value_template: >-
{%- if is_state('input_boolean.skylar_school', 'on')%}
school
{%- elif is_state('sensor.jeff_location', 'home') and is_state('sensor.kat_location', 'home') and is_state('input_boolean.skylar_school', 'off')%}
home
{%- elif is_state('sensor.jeff_location', 'Summit') and is_state('input_boolean.skylar_school', 'off')%}
{{ states.sensor.kat_location.state }}
{%- elif is_state('sensor.kat_location', 'Zoo Atlanta') and is_state('input_boolean.skylar_school', 'off')%}
{{ states.sensor.jeff_location.state }}
{% else %}
Mortal Peril
{%- endif %}
- platform: template
sensors:
kat_location:
friendly_name: "Kat's Current Location"
unit_of_measurement: ''
value_template: >-
{%- if is_state('person.katherine', 'not_home') %}
{%- if states.device_tracker.life360_kat_stone.attributes.moving == True %}
Flue Network
{% elif states.device_tracker.life360_kat_stone.attributes.driving == True %}
Flue Network
{% else %}
Lost
{%- endif %}
{% elif is_state('person.katherine', 'Sprouts') %}
Grocery Store
{% elif is_state('person.katherine', 'Kroger1') %}
Grocery Store
{% elif is_state('person.katherine', 'Kroger2') %}
Grocery Store
{% elif is_state('person.katherine', 'Home Depot') %}
Home Improvement Store
{% elif is_state('person.katherine', 'Lowes') %}
Home Improvement Store
{% elif is_state('person.katherine', 'Walmart') %}
Super Store
{% elif is_state('person.katherine', 'Target') %}
Super Store
{% else %}
{{ states.person.katherine.state }}
{%- endif %}
- platform: template
sensors:
kat_driving:
friendly_name: "Kat Driving"
unit_of_measurement: ''
value_template: >-
{%- if states.device_tracker.life360_kat_stone.attributes.moving == True %}
'on'
{% elif states.device_tracker.life360_kat_stone.attributes.driving == True %}
'on'
{% else %}
'off'
{% endif %}
- platform: mqtt
name: "Family Status"
state_topic: "house/family/status"
payload_available: "online"
payload_not_available: "offline"
- platform: template
sensors:
jeff_home:
value_template: >-
{{ is_state('device_tracker.jeffreystonesiphone', 'home')
or is_state('device_tracker.hass_jeffsiphone', 'home')
or is_state('device_tracker.life360_jeffrey_stone', 'home') }}
- platform: template
sensors:
kat_home:
value_template: >-
{{ is_state('device_tracker.iphone', 'home')
or is_state('device_tracker.life360_kat_stone', 'home') }}
- platform: template
sensors:
family_home:
value_template: >-
{{ is_state('device_tracker.jeffreystonesiphone', 'home')
or is_state('device_tracker.hass_jeffsiphone', 'home')
or is_state('device_tracker.life360_jeffrey_stone', 'home')
or is_state('device_tracker.iphone', 'home')
or is_state('device_tracker.life360_kat_stone', 'home')
or is_state('sensor.family_status', 'Home') }}
automation:
- id: kat_arrives_zoo
alias: Kat Arrives at Zoo
initial_state: true
trigger:
- platform: zone
event: enter
zone: zone.zoo_atlanta
entity_id: person.katherine
action:
- service: input_boolean.turn_off
entity_id: input_boolean.kat_travel_monitor
- service: script.ah_report
data:
speech_message: 'Kat has arrived at worked.'
call_interuption: 1
- id: kat_leaves_zoo
alias: Kat Leaves Zoo Notification
initial_state: true
trigger:
- platform: zone
event: leave
zone: zone.zoo_atlanta
entity_id: person.katherine
condition:
action:
- service: input_boolean.turn_on
entity_id: input_boolean.kat_travel_monitor
- service: script.ah_report
data:
call_interuption: 1
call_kat_headed_home: 1
- id: '1550109528753'
alias: Jeff Is Heading Home
initial_state: true
trigger:
- platform: webhook
webhook_id: jeff_heading_home
condition: []
action:
- service: script.jeff_destination_home
- service: script.ah_report
data:
call_interurption: 1
call_jeff_headed_home: 1
- id: jeff_heading_to_work
alias: Jeff Is Heading To Work
initial_state: true
trigger:
- platform: webhook
webhook_id: jeff_heading_work
condition: []
action:
- service: script.jeff_destination_summit
- id: skylar_at_school
alias: Skylar is at School
trigger:
- entity_id: device_tracker.life360_jeffrey_stone
event: enter
platform: zone
zone: zone.starling
- entity_id: device_tracker.life360_kat_stone
event: enter
platform: zone
zone: zone.starling
condition:
condition: time
after: '07:25:00'
before: '08:30:00'
weekday:
- mon
- tue
- wed
- thu
- fri
action:
- service: input_boolean.turn_on
entity_id: input_boolean.skylar_school
initial_state: true
- id: skylar_left_school
alias: Skylar left School
trigger:
- entity_id: device_tracker.life360_jeffrey_stone
event: leave
platform: zone
zone: zone.starling
- entity_id: device_tracker.life360_kat_stone
event: leave
platform: zone
zone: zone.starling
condition:
condition: time
after: '14:45:00'
before: '15:30:00'
weekday:
- mon
- tue
- wed
- thu
- fri
action:
- service: input_boolean.turn_off
entity_id: input_boolean.skylar_school
initial_state: true
- id: family_has_arrived
alias: Family Has arrived
trigger:
- entity_id: sensor.family_status
from: Away
platform: state
to: Home
- entity_id: person.jeffrey
event: enter
platform: zone
zone: zone.home
- entity_id: person.katherine
event: enter
platform: zone
zone: zone.home
condition:
- condition: state
entity_id: sensor.family_status
state: Away
action:
- service: script.vacation_canceled
- service: script.appliances_on
- service: script.standby
- service: script.washer_finished_notification_audible
- service: alarm_control_panel.alarm_arm_home
entity_id: alarm_control_panel.ah_base_station
initial_state: true
- id: family_has_left
alias: Family Has Left
initial_state: true
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.appliances_off
- service: script.inside_all_off
- service: script.security_check_garage
- service: script.security_check_zones
- service: script.lockdown
- service: script.lockdown_issue
- service: script.all_fans_off
- service: alarm_control_panel.alarm_arm_away
entity_id: alarm_control_panel.ah_base_station
- id: jeff_is_home
alias: Jeff is Home
initial_state: true
trigger:
- entity_id: person.jeffrey
event: enter
platform: zone
zone: zone.home
action:
- service: script.family_is_home
- service: script.jeff_destination_na
- service: script.driveway_on
- entity_id: input_boolean.jeff_travel_monitor
service: input_boolean.turn_off
- id: jeff_arrives_summit
alias: Jeff Arrives At Summit
trigger:
- entity_id: person.jeffrey
event: enter
platform: zone
zone: zone.summit
action:
- service: script.text_notify
data:
who: "kat"
message: "Jeff has arrived at Summit"
initial_state: true
- id: jeff_arrives_summit_notification
alias: Notify Kat Jeff At Summit
trigger:
- entity_id: person.jeffrey
event: enter
platform: zone
zone: zone.summit
action:
- service: script.jeff_destination_na
initial_state: true
- id: jeff_leaves_summit
alias: Jeff Leaves Summit
initial_state: true
trigger:
- entity_id: person.jeffrey
event: leave
platform: zone
zone: zone.summit
action:
- service: input_boolean.turn_off
entity_id: input_boolean.jeff_traffic_alert_home
- id: kat_is_home
alias: Kat is Home
initial_state: true
trigger:
- entity_id: person.katherine
event: enter
platform: zone
zone: zone.home
action:
- service: script.family_is_home
- service: script.driveway_on
- service: input_boolean.turn_off
entity_id: input_boolean.kat_travel_monitor
- id: welcome_home
alias: Welcome Home
trigger:
- platform: state
entity_id:
- person.jeffrey
- person.katherine
from: 'not_home'
to: 'home'
condition:
- condition: state
entity_id: sensor.family_status
state: Home
action:
- service: script.ah_report
data_template:
welcome_home: >
{% set person = trigger.to_state.attributes.friendly_name %}
{%- macro greeting_sentence(person) -%}
{{ [
person + " has arrived.",
person + " is in the neighborhood.",
person + " is arriving.",
"My sensors are picking up the presence of additional humans. " ~ person +" has been identified as home.",
person + " has finally made it home."
] | random }}
{%- endmacro -%}
{{greeting_sentence(person)}}
call_interuption: 1
script:
jeff_destination_zoo:
sequence:
- service: mqtt.publish
data:
topic: jeff/driving/destination
payload: Zoo
retain: true
jeff_destination_summit:
sequence:
- service: mqtt.publish
data:
topic: jeff/driving/destination
payload: Summit
retain: true
jeff_destination_none:
sequence:
- service: mqtt.publish
data:
topic: jeff/driving/destination
payload: none
retain: true
jeff_destination_na:
sequence:
- service: mqtt.publish
data:
topic: jeff/driving/destination
payload: na
retain: true
jeff_destination_home:
sequence:
- service: mqtt.publish
data:
topic: jeff/driving/destination
payload: Home
retain: true
jeff_destination_harbins:
sequence:
- service: mqtt.publish
data:
topic: jeff/driving/destination
payload: Harbins
retain: true
kat_destination_na:
sequence:
- service: mqtt.publish
data:
topic: kat/driving/destination
payload: na
retain: true

40
config/packages/reminders.yaml Executable file
View File

@@ -0,0 +1,40 @@
###############################################################################
# @author : Jeffrey Stone
# @date : 07/15/2019
# @package : Reminders
# @description : Autoamtions to set reminders
###############################################################################
input_datetime:
kat_pill_reminder:
name: Kat Pill Reminder
has_date: false
has_time: true
heartworm_reminder:
name: Heartworm Reminder
has_date: true
has_time: false
automation:
# Massive automation to call all the reminder scripts.
- id: turn_reminders_on
alias: Turn Reminders On
initial_state: true
trigger:
- entity_id: calendar.reminders
from: 'off'
platform: state
to: 'on'
action:
- service: script.heartworm_on
script:
# Check to see if heartworm is the reminder in the cal
heartworm_on:
sequence:
- condition: template
value_template: '{{ states.calendar.reminders.attributes.message == "Heartworm" }}'
- service: input_boolean.turn_on
entity_id: input_boolean.heartworm

420
config/packages/security.yaml Executable file
View File

@@ -0,0 +1,420 @@
###############################################################################
# @author : Jeffrey Stone
# @date : 03/13/2019
# @package : Security
# @description : Everything related to security functions.
###############################################################################
input_boolean:
sentry_mode:
name: Sentry Mode
icon: mdi:security
vacation_mode:
name: Vacation Mode
icon: mdi:airplane-takeoff
guest_mode:
name: Guest Mode
icon: mdi:account-multiple
security_alarm:
name: Security Alarm
icon: mdi:speaker-wireless
fire_alarm:
name: Fire Alarm
icon: mdi:speaker-wireless
garage_after_dark:
name: Garage Open After Dark
icon: mdi:message-alert
lockdown_issue:
name: Lockdown Issue
icon: mdi:lock-reset
security_issue:
name: Security Issue
icon: mdi:alert-circle-outline
automation:
- id: enable_vacation_mode
alias: Enable Vacation Mode
initial_state: true
trigger:
- platform: numeric_state
entity_id: sensor.jeff_ett_home
above: 180
- platform: numeric_state
entity_id: sensor.kat_ett_home
above: 180
condition:
- condition: numeric_state
entity_id: sensor.jeff_ett_home
above: 180
- condition: numeric_state
entity_id: sensor.kat_ett_home
above: 180
action:
- service: input_boolean.turn_on
entity_id: input_boolean.vacation_mode
- id: morning_standby
alias: Morning Standby
initial_state: true
trigger:
- platform: time
at: 05:30:00
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
- id: nightly_lockdown
alias: Nightly Lockdown
initial_state: true
trigger:
- platform: time
at: '23:00:00'
condition:
- condition: state
entity_id: person.jeffrey
state: home
- condition: state
entity_id: person.katherine
state: home
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
action:
- service: script.lockdown
- id: garage_open_sunset
alias: Garage Open At Sunset
initial_state: true
trigger:
- platform: sun
event: sunset
condition:
- condition: state
entity_id: binary_sensor.garage_door
state: "on"
action:
- service: script.driveway_on
- id: close_garage_lights_out
alias: Close Garage at lights out
initial_state: true
trigger:
- platform: time
at: '22:30:00'
condition:
- condition: state
entity_id: binary_sensor.garage_door
state: "on"
action:
- service: input_boolean.turn_on
entity_id: input_boolean.security_issue
- id: door_chime
alias: Door Chine
trigger:
- platform: state
entity_id:
- binary_sensor.front_door_contact_2
- binary_sensor.laundry_room_door_contact_2
- binary_sensor.attic_door_contact_2
- binary_sensor.back_door_contact_2
from: 'off'
condition:
- condition: state
entity_id: input_boolean.audible_notifications
state: 'on'
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
action:
- service: shell_command.door_chime
- service: script.reset_ha_speaker
initial_state: true
- id: door_opened_long
alias: Door Opened Too Long
trigger:
- platform: state
entity_id:
- binary_sensor.front_door
- binary_sensor.laundry_room_door
- binary_sensor.attic_door
- binary_sensor.back_door
from: 'off'
to: 'on'
for: '00:01:00'
condition:
- condition: state
entity_id: input_boolean.audible_notifications
state: 'on'
action:
- service: script.ah_report
data_template:
speech_message: " the {{ trigger.to_state.attributes.friendly_name }} has been standing open for more than a minute."
call_interuption: 1
initial_state: true
- id: garage_opened_night
alias: Garage Opened at Night
trigger:
- platform: state
entity_id: group.garage_doors
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
action:
- service: script.driveway_on
initial_state: true
- id: garage_closed
alias: Garage Opened at Night
trigger:
- platform: state
entity_id: group.garage_doors
from: 'on'
to: 'off'
action:
- service: script.driveway_off
initial_state: true
- id: security_breach_door
alias: Security Breach Doors
trigger:
- platform: state
entity_id:
- binary_sensor.front_door
- binary_sensor.laundry_room_door
- binary_sensor.back_door
- binary_sensor.side_door
- binary_sensor.garage_door
from: 'off'
condition:
- condition: state
entity_id: input_boolean.sentry_mode
state: 'on'
action:
- service: script.jarvis_alert
data_template:
message: "My security protocols are being overidden,, The {{ trigger.to_state.attributes.friendly_name }} has been opened."
- service: script.text_alert
data_template:
title: "Security Alert!!"
message: "{{ trigger.to_state.attributes.friendly_name }} has been opened."
- service: input_boolean.turn_on
entity_id: input_boolean.security_issue
initial_state: true
- id: sentry_mode_enabled
alias: Sentry Mode Enabled Annoucement
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.sentry_mode
from: 'off'
to: 'on'
action:
- service: script.ah_report
data_template:
speech_message: >
{{ [
"Barn door protocol has been activated.",
"Anchorage House has been secured! ",
"Sentry Mode is active. ",
"I am now monitoring the doors and will let you know if anyone attempts to access."
] | random }}
- id: sentry_mode_disabled
alias: Sentry Mode Disabled Annoucement
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.sentry_mode
from: 'on'
to: 'off'
action:
- service: script.ah_report
data_template:
speech_message: >
{{ [
"Barn door protocol has been deactivated.",
"I am no longer monitoring the access points. ",
"Sentry Mode has been switched off. "
] | random }}
- id: guest_mode_feedback
alias: Guest Mode Audio Feedback
trigger:
- platform: state
entity_id:
- input_boolean.guest_mode
from: 'off'
to: 'on'
action:
- service: script.ah_report
data_template:
speech_message: >
{{ [
"Guest Mode has been enabled.",
"I have switched to the system to guest mode.",
"I have enabled guest mode. ",
"Guest Mode is on."
] | random }}
script:
lockdown_issue:
sequence:
- condition: state
entity_id: group.external_doors
state: "on"
- condition: state
entity_id: sensor.family_status
state: "Away"
- service: input_boolean.turn_on
entity_id: input_boolean.lockdown_issue
- service: script.text_notify
data_template:
title: "Lockdown Issue!"
message: "Doors are open and it appears everyone has left!"
security_check_garage:
sequence:
- condition: state
entity_id: cover.cargo_bay
state: open
- service: input_boolean.turn_on
entity_id: input_boolean.lockdown_issue
security_check_zones:
sequence:
- condition: state
entity_id: group.doors
state: 'on'
- service: input_boolean.turn_on
entity_id: input_boolean.lockdown_issue
lockdown:
sequence:
- condition: state
entity_id: group.external_doors
state: "off"
- service: input_boolean.turn_on
entity_id: input_boolean.sentry_mode
standby:
sequence:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'off'
- service: input_boolean.turn_off
entity_id: input_boolean.sentry_mode
- service: input_boolean.turn_off
entity_id: input_boolean.security_issue
- service: input_boolean.turn_off
entity_id: input_boolean.lockdown_issue
- service: input_boolean.turn_off
entity_id: input_boolean.security_alarm
visitors_here:
sequence:
- service: input_boolean.turn_on
data:
entity_id: input_boolean.guest_mode
#- service: shell_command.haunted_guest_welcome
visitors_gone:
sequence:
- service: input_boolean.turn_off
data:
entity_id: input_boolean.guest_mode
notification_security_alarm_audio:
sequence:
- service: shell_command.security_alarm
# notification_sentry_mode_activated_audio:
# sequence:
# - condition: state
# entity_id: input_boolean.audible_notifications
# state: 'on'
# - condition: state
# entity_id: media_player.theater
# state: 'idle'
# - service: tts.google_say
# entity_id: media_player.theater
# data_template:
# message: "Sentry mode activated"
# notification_sentry_mode_deactivated_audio:
# sequence:
# - condition: state
# entity_id: input_boolean.audible_notifications
# state: 'on'
# - condition: state
# entity_id: media_player.theater
# state: 'idle'
# - service: tts.google_say
# entity_id: media_player.theater
# data_template:
# message: "Sentry mode deactivated"
# notification_sentry_mode_deactiviated_text:
# sequence:
# - service: notify.jeff_ios
# data:
# message: Sentry Mode Deactivated
# notification_sentry_mode_activiated_text:
# sequence:
# - service: notify.jeff_ios
# data:
# message: Sentry Mode Activated
vacation_canceled:
sequence:
- data:
entity_id: input_boolean.vacation_mode
service: input_boolean.turn_off
activate_barn_door_protocol:
sequence:
- service: script.ah_report
data:
call_confirmation: 1
- delay:
seconds: 2
- service: input_boolean.turn_on
entity_id: input_boolean.sentry_mode
deactivate_barn_door_protocol:
sequence:
- service: script.ah_report
data:
call_confirmation: 1
- delay:
seconds: 2
- service: input_boolean.turn_off
entity_id: input_boolean.sentry_mode
activate_guest_mode:
sequence:
- service: script.ah_report
data:
call_confirmation: 1
- delay:
seconds: 2
- service: input_boolean.turn_on
entity_id: input_boolean.guest_mode

106
config/packages/space.yaml Executable file
View File

@@ -0,0 +1,106 @@
###############################################################################
# @author : Jeffrey Stone
# @date : 02/19/2019
# @package : Space
# @description : Tracking space. Inspiration and code taking from https://github.com/CCOSTAN/Home-AssistantConfig#logo
# @original : https://github.com/CCOSTAN/Home-AssistantConfig/blob/master/config/packages/space.yaml
###############################################################################
homeassistant:
customize:
binary_sensor.iss:
icon: mdi:satellite-variant
friendly_name: ISS Visibility
hidden: False
homebridge_hidden: true
sensor.launch_window:
hidden: False
icon: mdi:rocket
friendly_name: Rocket Launch Window
binary_sensor:
- platform: iss
show_on_map: false
sensor:
- platform: moon
- platform: launch_library
- platform: rest
scan_interval: 1800
resource: https://launchlibrary.net/1.2.2/launch/next/10
# resource: https://raw.githubusercontent.com/cribbstechnologies/ha_config/master/www/test_launch.json
name: launch window
# if the current timestamp is in the launch window
# this sensor will return the UTC timestamp of the launch
value_template: >-
{%- for launch in value_json.launches %}
{% if launch.location.id == 16 or launch.location.id == 17 %}
{% if strptime(launch.isostart, '%Y%m%dT%H%M%SZ').strftime('%Y-%m-%d') == now().strftime('%Y-%m-%d') %}
{% set utc_offset_string = now().strftime('%z') %}
{% set utc_offset_direction = utc_offset_string[:1] %}
{% set utc_offset_hours = now().strftime('%z')[-4:] %}
{% set utc_offset_seconds = (utc_offset_hours| int /100) * 60 * 60 %}
{% if utc_offset_direction == '-' %}
{{ launch.wsstamp - utc_offset_seconds}}
{% else %}
{{ launch.wsstamp + utc_offset_seconds}}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
automation:
- id: iss_tweet
initial_state: true
alias: 'ISS Tweet'
trigger:
- platform: state
entity_id:
- binary_sensor.iss
to: 'on'
from: 'off'
action:
- service: script.twitter_notify
data_template:
message: >-
{{ [
"The #ISS is passing over. Wave. #Space #theycanseeourhouse ",
"The #ISS just flew by with there are {{states.binary_sensor.iss.attributes.number_of_people_in_space}} people doing cool stuff. #Space #theycanseeourhouse",
"The #ISS just flew by with {{states.binary_sensor.iss.attributes.number_of_people_in_space}} people in it. #Space #theycanseeourhouse"
] | random }}
- id: iss_notification
initial_state: true
alias: 'ISS Notification'
trigger:
- platform: state
entity_id:
- binary_sensor.iss
to: 'on'
from: 'off'
action:
- service: script.ah_report
data:
call_interuption: 1
call_iss: 1
- id: full_moon_tweet
initial_state: true
alias: 'Full Moon -Tweet'
trigger:
- platform: state
entity_id: sensor.moon
to: 'full_moon'
action:
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service: script.twitter_notify
data_template:
message: >-
{{ [
"There is a Full Moon out tonight, and this time it's the actual moon and not the neighbor. ",
"Hey look kids, There's the full moon. ",
"The moon is huge! And full. "
] | random + "#Space #fullmoon"}}

79
config/packages/sysmon.yaml Executable file
View File

@@ -0,0 +1,79 @@
###############################################################################
# @author : Jeffrey Stone
# @date : 02/19/2019
# @package : Sysmon
# @description : A collection of Home Assistant and Pi Sensors
###############################################################################
sensor:
- platform: systemmonitor
resources:
- type: disk_use_percent
arg: /
- type: memory_use_percent
- type: network_in
arg: eth0
- type: network_out
arg: eth0
- type: last_boot
- type: load_15m
- type: processor_use
- type: last_boot
- platform: cpuspeed
name: CPU
- platform: time_date
display_options:
- 'time'
- 'date'
- 'date_time'
- 'time_date'
- 'time_utc'
- 'beat'
# - platform: cert_expiry
# host: !secret ahsl_base_url
# name: SSL Cert Expiration
- platform: command_line
name: "HA Uptime"
command: echo "$(($(date +%s) - $(date -d "$(head -n1 /home/homeassistant/.homeassistant/home-assistant.log | cut -d' ' -f-2)" +%s)))"
scan_interval: 720
value_template: >-
{% set uptime = value | int %}
{% set seconds = uptime % 60 %}
{% set minutes = ((uptime % 3600) / 60) | int %}
{% set hours = ((uptime % 86400) / 3600) | int %}
{% set days = (uptime / 86400) | int %}
{%- if days > 0 -%}
{%- if days == 1 -%}
1 day
{%- else -%}
{{ days }} days
{%- endif -%}
{{ ', ' }}
{%- endif -%}
{{ '%02d' % hours }}:{{ '%02d' % minutes }}
- platform: template
sensors:
current_version_ha:
#command: python3 -c "import requests; print(requests.get('https://pypi.python.org/pypi/homeassistant/json').json()['info']['version'])"
friendly_name: Current HA Version
value_template: >-
{{ states.binary_sensor.attributes.newest_version }}
- platform: version
name: Installed version
source: local
#command: "head -5 /home/homeassistant/.homeassistant/.HA_VERSION"
- platform: version
name: Released Version
source: pypi
- platform: version
name: Released Hassio Ver
source: hassio
- platform: command_line
name: ha_v2db
command: "ls -sh /home/homeassistant/.homeassistant/home-assistant_v2.db | cut -f1 -d ' '"
- platform: command_line
name: ha_log
command: "ls -sh /home/homeassistant/.homeassistant/home-assistant.log | cut -f1 -d ' '"
- platform: uptime
name: Time Online
unit_of_measurement: days

167
config/packages/twitter.yaml Executable file
View File

@@ -0,0 +1,167 @@
###############################################################################
# @author : Jeffrey Stone
# @date : 07/15/2019
# @package : Twitter
# @description : Just some tweet stuff - @anchoragehouse2
###############################################################################
automation:
- id: first_day_info
alias: First Day Info
initial_state: true
trigger:
- platform: time
at: '00:10:00'
condition:
- condition: template
value_template: >
{% set day=states("sensor.date").split('-')[2] | int %}
{%- if day == 1 -%}
true
{%- endif -%}
action:
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service: script.twitter_github
data_template:
message: >-
"Its a new month, so this is a good time to remind you that I am powered by @homeassistant and configured by @thejeffreystone. Find my code at https://github.com/thejeffreystone/home-assistant-configuration"
#- id: tweet_new_ha_version
# alias: Tweet New HA Version
# trigger:
# - platform: state
# entity_id: binary_sensor.updater
# from: 'off'
# to: 'on'
# action:
# - service: script.twitter_new_ha
- id: tweet_some_snark
alias: Tweet Some Snark
initial_state: true
trigger:
- platform: time
at: '08:00:00'
action:
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service: script.twitter_snark
- id: tweet_some_stats
alias: Tweet Some Stats
initial_state: true
trigger:
- platform: time
at: '08:00:00'
action:
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service: script.twitter_stats
- id: bot_info
alias: Bot Info
initial_state: true
trigger:
- platform: time
at: '10:00:00'
condition:
- condition: template
value_template: >
{% set day=states("sensor.date").split('-')[2] | int %}
{%- if day == 15 -%}
true
{%- endif -%}
action:
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service: script.twitter_notify
data_template:
message: >-
"This is a good time to remind you that I am a bot powered by @home_assistant and configured by @thejeffreystone. Find my code at https://github.com/thejeffreystone/home-assistant-configuration"
- id: net_speed_report
initial_state: true
alias: Network Speed Report
trigger:
- platform: time
at: '11:15:00'
action:
- service: script.twitter_notify
data_template:
message: '{{ [ "According to my latest speed tests Anchorage House is getting
{{ states.sensor.internet_test_down.attributes.max_value }} Mbps down and {{ states.sensor.internet_test_up.attributes.max_value }}
Mbps up thanks to #ATTFiber. ", "How fast is your internet? I just checked
am Im seeing {{ states.sensor.internet_test_down.attributes.max_value }} Mbps down and {{ states.sensor.internet_test_up.attributes.max_value }}
Mbps up. Beat that. ", "My speed is monitored using @home_assistant and https://github.com/thejeffreystone/speedtest_to_mqtt
and is {{ states.sensor.internet_test_down.attributes.max_value }} Mbps down and {{ states.sensor.internet_test_up.attributes.max_value }}
Mbps up." ] | random }}'
- id: rex_manning_day_tweet_1
alias: Rex Manning Day Tweet One
initial_state: true
trigger:
- platform: time
at: '08:00:00'
condition:
- condition: state
entity_id: calendar.anchorage_holidays
state: "on"
- condition: template
value_template: >
{%- set event=states.calendar.anchorage_holidays.attributes.message %}
{%- if event == 'Rex Manning Day' %}
true
{%- endif -%}
action:
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service: script.twitter_notify
data_template:
message: >-
"Happy Rex Manning Day! https://www.youtube.com/watch?v=30fw5My1QJM #damntheman #savetheempire"
- id: rex_manning_day_tweet_2
alias: Rex Manning Day Tweet Two
initial_state: true
trigger:
- platform: time
at: '13:00:00'
condition:
- condition: state
entity_id: calendar.anchorage_holidays
state: "on"
- condition: template
value_template: >
{%- set event=states.calendar.anchorage_holidays.attributes.message %}
{%- if event == 'Rex Manning Day' %}
true
{%- endif -%}
action:
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service: script.twitter_notify
data_template:
message: >-
"We mustn't dwell. No, not today. We can't. Not on Rex Manning day! https://www.youtube.com/watch?v=szvt8iWJ0oo #damntheman #savetheempire"
- id: Halloween Tweet
alias: Halloween Tweet
initial_state: true
trigger:
- platform: time
at: '13:00:00'
condition:
- condition: template
value_template: >
{% set month= now().month | int %}
{%- if month == 10 -%}
true
{%- endif -%}
action:
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service: script.twitter_notify
data_template:
message: '{{ [ "There are only {{states.sensor.holiday_halloween.state}} days until Halloween.",
"Halloween is only {{states.sensor.holiday_halloween.state}} days away. It might not be enough time. ",
"Halloween is coming. {{states.sensor.holiday_halloween.state}} days and counting.",
"Only {{states.sensor.holiday_halloween.state}} days until Halloween.",
"You have {{states.sensor.holiday_halloween.state}} days until you need a costume.",
"Only {{states.sensor.holiday_halloween.state}} days until Halloween. But who is counting. amirite?",
"Would it be cliche if I went as a haunted house for Halloween? Asking for a another house.",
"Just in case I wanted to be HAL 9000 for Halloween I ordered some Pod Bay Doors."
] | random }}'

111
config/packages/usps.yaml Executable file
View File

@@ -0,0 +1,111 @@
###############################################################################
# @author : Jeffrey Stone
# @date : 02/19/2019
# @package : USPS
# @description : Notifies us of mails and packages.
# Package modified from https://github.com/skalavala/smarthome/blob/master/packages/usps.yaml
###############################################################################
homeassistant:
customize:
sensor.usps_mail:
friendly_name: USPS Mail
icon: mdi:mailbox
sensor.usps_packages:
friendly_name: USPS Packages
icon: mdi:package-variant
sensor:
- platform: mqtt
name: 'USPS Mail'
state_topic: 'house/usps/mails'
value_template: "{{ value }}"
- platform: mqtt
name: USPS Packages
state_topic: 'house/usps/packages'
value_template: "{{ value }}"
camera:
- platform: generic
name: USPS Mail Pictures
still_image_url: !secret usps_camera_url
automation:
- id: reset_usps
initial_state: true
alias: Reset USPS
trigger:
- platform: time
at: '00:00:10'
action:
- service: shell_command.usps
- id: get_usps
initial_state: true
alias: Get USPS
trigger:
- platform: time
at: '10:00:00'
action:
- service: shell_command.usps
# Notify USPS mails via TTS, and iOS notification with attachment
###############################################################################
- id: notify_usps_mail
alias: Notify USPS Mail
initial_state: true
trigger:
- platform: state
entity_id: sensor.usps_mail
condition:
- condition: template
value_template: '{{ states.sensor.usps_mail.state | int > 0 }}'
- condition: template
value_template: '{{ ((now().hour | int) > 7) and ((now().hour | int) < 16) }}'
action:
- service: script.ah_report
data_template:
usps: >-
{%- if states.sensor.usps_mail.state | int == 1 -%}
USPS is delivering {{ states.sensor.usps_mail.state }} piece of mail today.
{%- else -%}
USPS is delivering {{ states.sensor.usps_mail.state }} pieces of mail today.
{%- endif -%}
call_interuption: 1
- service: script.text_notify
data_template:
who: "jeff"
title: "USPS Delivering Today"
message: "USPS will be delivering {{ states.sensor.usps_mail.state }} piece(s) of mail today."
# data:
# push:
# category: camera
# entity_id: "camera.usps_mail_pictures"
# attachment:
# url: "{{ states.camera.usps_mail_pictures.attributes.entity_picture }}"
# content-type: jpg
# Notify USPS packages via TTS. Usually there are no pictures for packages
###############################################################################
- id: notify_usps_packages
alias: Notify USPS Packages
initial_state: true
trigger:
- platform: state
entity_id: sensor.usps_packages
condition:
- condition: template
value_template: '{{ states.sensor.usps_packages.state | int > 0 }}'
- condition: template
value_template: '{{ ((now().hour | int) > 7) and ((now().hour | int) < 16) }}'
action:
- service: script.ah_report
data_template:
usps: >
{%- if states.sensor.usps_packages.state | int == 1 -%}
USPS is delivering {{ states.sensor.usps_packages.state }} package today.
{%- else -%}
USPS is delivering {{ states.sensor.usps_packages.state }} packages today.
{%- endif -%}
call_interuption: 1

View File

@@ -0,0 +1,243 @@
###############################################################################
# @author : Jeffrey Stone
# @date : 02/19/2019
# @package : NWS Alerts
# @description : NWS Alerts
# @original : https://github.com/Vasiley/Home-Assistant-Main/blob/master/packages/weather_alerts_nws.yaml
###############################################################################
homeassistant:
customize:
package.node_anchors:
customize: &customize
package: 'weather_alerts'
sensor.nws_alert_count:
friendly_name: Alerts
icon: mdi:alert-outline
group:
alerts_card:
name: Alerts
entities:
- sensor.nws_alerts
### You first need to find either your NWS Zone ID or County ID. Im not sure which is better but I used my Zone ID here.
### You can find your Zone ID by going to https://alerts.weather.gov/ 7, scroll down to your state and click on the “zone list” then look for the entry for your county.
### I recommond useing both
#Ive taken much of the underlying work here and created a custom component for nws alerts sensor.
#The sensor can be created by adding the nws_alerts.py file to <config_directory>/custom_components/sensor/ and adding the following to your sensor definitions:
sensor:
- platform: nws_alerts
zone_id: 'GAZ034,GAC135'
automation:
- alias: 'NWS Weather Alert Pop Up Control'
initial_state: 'on'
trigger:
platform: state
entity_id: sensor.nws_alerts
condition:
- condition: template
value_template: '{{states.sensor.nws_alerts.state | int > 0}}'
- condition: template
value_template: '{{ trigger.to_state.state|float > trigger.from_state.state|float }}'
action:
service: script.nws_popup_on_wx_alert
data_template:
title: >
{% if states.sensor.nws_alerts.attributes.title.split(' - ')[5] is defined %}
"{{ states.sensor.nws_alerts.attributes.title.split(' - ')[5] }}"
{% elif states.sensor.nws_alerts.attributes.title.split(' - ')[4] is defined %}
"{{ states.sensor.nws_alerts.attributes.title.split(' - ')[4] }}"
{% elif states.sensor.nws_alerts.attributes.title.split(' - ')[3] is defined %}
"{{ states.sensor.nws_alerts.attributes.title.split(' - ')[3] }}"
{% elif states.sensor.nws_alerts.attributes.title.split(' - ')[2] is defined %}
"{{ states.sensor.nws_alerts.attributes.title.split(' - ')[2] }}"
{% elif states.sensor.nws_alerts.attributes.title.split(' - ')[1] is defined %}
"{{ states.sensor.nws_alerts.attributes.title.split(' - ')[1] }}"
{% else %}
"{{ states.sensor.nws_alerts.attributes.title.split(' - ')[0] }}"
{% endif %}
message: >
{% if states.sensor.nws_alerts.attributes.display_desc.split('\n\n-\n\n')[5] is defined %}
"{{ states.sensor.nws_alerts.attributes.display_desc.split('\n\n-\n\n')[5] }}"
{% elif states.sensor.nws_alerts.attributes.display_desc.split('\n\n-\n\n')[4] is defined %}
"{{ states.sensor.nws_alerts.attributes.display_desc.split('\n\n-\n\n')[4] }}"
{% elif states.sensor.nws_alerts.attributes.display_desc.split('\n\n-\n\n')[3] is defined %}
"{{ states.sensor.nws_alerts.attributes.display_desc.split('\n\n-\n\n')[3] }}"
{% elif states.sensor.nws_alerts.attributes.display_desc.split('\n\n-\n\n')[2] is defined %}
"{{ states.sensor.nws_alerts.attributes.display_desc.split('\n\n-\n\n')[2] }}"
{% elif states.sensor.nws_alerts.attributes.display_desc.split('\n\n-\n\n')[1] is defined %}
"{{ states.sensor.nws_alerts.attributes.display_desc.split('\n\n-\n\n')[1] }}"
{% else %}
"{{ states.sensor.nws_alerts.attributes.display_desc.split('\n\n-\n\n')[0] }}"
{% endif %}
- alias: NWS Notification Weather Alert
initial_state: 'on'
trigger:
platform: state
entity_id: sensor.nws_alerts
condition:
- condition: template
value_template: '{{states.sensor.nws_alerts.state | int > 0}}'
- condition: template
value_template: '{{ trigger.to_state.state|float > trigger.from_state.state|float }}'
action:
- service: script.text_notify
data_template:
title: "Weather Alert for Anchorage House"
message: >
{% if states.sensor.nws_alerts.attributes.title.split(' - ')[5] is defined %}
"NWS: {{ states.sensor.nws_alerts.attributes.title.split(' - ')[5] }}"
{% elif states.sensor.nws_alerts.attributes.title.split(' - ')[4] is defined %}
"NWS: {{ states.sensor.nws_alerts.attributes.title.split(' - ')[4] }}"
{% elif states.sensor.nws_alerts.attributes.title.split(' - ')[3] is defined %}
"NWS: {{ states.sensor.nws_alerts.attributes.title.split(' - ')[3] }}"
{% elif states.sensor.nws_alerts.attributes.title.split(' - ')[2] is defined %}
"NWS: {{ states.sensor.nws_alerts.attributes.title.split(' - ')[2] }}"
{% elif states.sensor.nws_alerts.attributes.title.split(' - ')[1] is defined %}
"NWS: {{ states.sensor.nws_alerts.attributes.title.split(' - ')[1] }}"
{% else %}
"NWS: {{ states.sensor.nws_alerts.attributes.title.split(' - ')[0] }}"
{% endif %}
- alias: NWS Announce Weather Alert
initial_state: 'on'
trigger:
- platform: state
entity_id: sensor.nws_alerts
condition:
condition: and
conditions:
- condition: template
value_template: "{{states.sensor.nws_alerts.state | int > 0}}"
- condition: template
value_template: '{{ trigger.to_state.state|float > trigger.from_state.state|float }}'
- condition: template
value_template: "{{ (('Severe' in states.sensor.nws_alerts.attributes.title) or ('Thunderstorm' in states.sensor.nws_alerts.attributes.title)) and 'Warning' in states.sensor.nws_alerts.attributes.title }}"
action:
- service: script.ah_report
data_template:
speech_message: >
{% if states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] is defined %}
The National Weather Service Has issued a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] }}
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[4] is defined %}
The National Weather Service Has issued a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[4] }}
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[3] is defined %}
The National Weather Service Has issued a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[3] }}
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[2] is defined %}
The National Weather Service Has issued a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[2] }}
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[1] is defined %}
The National Weather Service Has issued a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[1] }}
{% else %}
The National Weather Service Has issued a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[0] }}
{% endif %}
- service: script.twitter_notify
data_template:
message: '{{ [ "Anchorage House is battening down the hatches. Servere Weather is imminent. ",
"The weather outside is getting intense, so I just made a weather announcement.",
"Anchorage House monitors the NWS using #HomeAssistant just for these occasions. Thanks for the heads up @NWSAtlanta " ] | random }}'
- delay: '00:00:15'
- service: script.ah_report
data_template:
speech_message: >
{% if states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] is defined %}
The National Weather Service Has issued a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] }}
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[4] is defined %}
The National Weather Service Has issued a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[4] }}
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[3] is defined %}
The National Weather Service Has issued a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[3] }}
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[2] is defined %}
The National Weather Service Has issued a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[2] }}
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[1] is defined %}
The National Weather Service Has issued a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[1] }}
{% else %}
The National Weather Service Has issued a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[0] }}
{% endif %}
- alias: NWS Announce Weather Alert for Tornado
initial_state: 'on'
trigger:
- platform: state
entity_id: sensor.nws_alerts
condition:
condition: and
conditions:
- condition: template
value_template: "{{states.sensor.nws_alerts.state | int > 0}}"
- condition: template
value_template: "{{ 'Tornado Warning' in states.sensor.nws_alerts.attributes.title}}"
action:
- service: script.jarvis_alert
data_template:
message: "Attention!,,,Attention!,,,The National Weather Service Has issued a Tornado Warning for our area."
- service: script.twitter_notify
data_template:
message: '{{ [ "NWS is sounding the Tornado alarm, so I am too. Anchorage House is taking cover. ",
"Anchorage House is heading to the closet because the NWS just issued a tornado warning for our area.",
"I just activated the internal Tornado Alarm at the request of the NWS. Thanks for the heads up @NWSAtlanta " ] | random }}'
- delay: '00:00:15'
- service: script.jarvis_alert
data_template:
message: "Attention!,,,Attention!,,,The National Weather Service Has issued a Tornado Warning for our area."
- delay: '00:00:15'
- service: input_boolean.turn_on
entity_id: input_boolean.tornado_alarm
- service: script.text_alert
data_template:
title: "Tornado Warning!"
message: "The National Weather Service Has issued a Tornado Warning for our area."
- alias: Activate Tornado alarm
initial_state: 'on'
trigger:
- platform: state
entity_id: input_boolean.tornado_alarm
from: 'off'
to: 'on'
action:
- service: media_player.play_media
entity_id: media_player.theater
data:
media_content_id: /media/audio/Tornado_Siren.mp3
media_content_type: "music"
- alias: Deactivate Tornado alarm
initial_state: 'on'
trigger:
- platform: state
entity_id: input_boolean.tornado_alarm
from: 'on'
to: 'off'
action:
- service: media_player.media_stop
entity_id: media_player.theater
script:
nws_popup_on_wx_alert:
alias: NWS Weather Alert Pop Up
sequence:
## Dismiss any current alert so the UI isn't filled
## up with these if there are more then one.
## Only show the latest alert
- service: persistent_notification.dismiss
data:
notification_id: "nwswxalert"
## Create a new persistant notification in the UI for a new alert
- service_template: >
{% if states.sensor.nws_alerts.state != '0' %}
persistent_notification.create
{% endif %}
data_template:
notification_id: "nwswxalert"
message: "{{ message }}"
title: '{{ title }}'
tornado_alarm:
sequence:
- service: shell_command.tornado_alarm

162
config/packages/weekday.yaml Executable file
View File

@@ -0,0 +1,162 @@
###############################################################################
# @author : Jeffrey Stone
# @date : 02/19/2019
# @package : Weekday
# @description : Weekday Sensor for use as a condition in automations and scripts
###############################################################################
sensor:
- platform: mqtt
name: weekday
state_topic: "house/week/day"
script:
monday:
sequence:
- service: mqtt.publish
data:
topic: house/week/day
payload: mon
retain: true
tuesday:
sequence:
- service: mqtt.publish
data:
topic: house/week/day
payload: tue
retain: true
wednesday:
sequence:
- service: mqtt.publish
data:
topic: house/week/day
payload: wed
retain: true
thursday:
sequence:
- service: mqtt.publish
data:
topic: house/week/day
payload: thu
retain: true
friday:
sequence:
- service: mqtt.publish
data:
topic: house/week/day
payload: fri
retain: true
saturday:
sequence:
- service: mqtt.publish
data:
topic: house/week/day
payload: sat
retain: true
sunday:
sequence:
- service: mqtt.publish
data:
topic: house/week/day
payload: sun
retain: true
automation:
- alias: set weekday mon
initial_state: true
trigger:
- platform: time
at: 00:00:01
- platform: homeassistant
event: start
condition:
- condition: time
weekday:
- mon
action:
- service: script.monday
id: set_weekday_mon
- alias: set weekday tue
initial_state: true
trigger:
- platform: time
at: 00:00:01
- platform: homeassistant
event: start
condition:
- condition: time
weekday:
- tue
action:
- service: script.tuesday
id: set_weekday_tue
- alias: set weekday wed
initial_state: true
trigger:
- platform: time
at: 00:00:01
- platform: homeassistant
event: start
condition:
- condition: time
weekday:
- wed
action:
- service: script.wednesday
id: set_weekday_wed
- alias: set weekday thu
initial_state: true
trigger:
- platform: time
at: '00:00:01'
- platform: homeassistant
event: start
condition:
- condition: time
weekday:
- thu
action:
- service: script.thursday
id: set_weekday_thu
- alias: set weekday fri
initial_state: true
trigger:
- platform: time
at: '00:00:01'
- platform: homeassistant
event: start
condition:
- condition: time
weekday:
- fri
action:
- service: script.friday
id: set_weekday_fri
- alias: set weekday sat
initial_state: true
trigger:
- platform: time
at: '00:00:01'
- platform: homeassistant
event: start
condition:
- condition: time
weekday:
- sat
action:
- service: script.saturday
id: set_weekday_sat
- alias: set weekday sun
initial_state: true
trigger:
- platform: time
at: '00:00:01'
- platform: homeassistant
event: start
condition:
- condition: time
weekday:
- sun
action:
- service: script.sunday
id: set_weekday_sun

View File

@@ -0,0 +1,65 @@
input_boolean:
zigbee_permit_join:
name: Allow devices to join
initial: off
icon: mdi:cellphone-wireless
timer:
zigbee_permit_join:
name: Time remaining
duration: 600 # Updated this to the number of seconds you wish
sensor:
- platform: mqtt
name: Bridge state
state_topic: "homeassistant/bridge/state"
icon: mdi:router-wireless
automation:
- id: enable_zigbee_join
alias: Enable Zigbee joining
hide_entity: true
trigger:
platform: state
entity_id: input_boolean.zigbee_permit_join
to: 'on'
action:
- service: mqtt.publish
data:
topic: homeassistant/bridge/config/permit_join
payload: 'true'
- service: timer.start
data:
entity_id: timer.zigbee_permit_join
- id: disable_zigbee_join
alias: Disable Zigbee joining
trigger:
- entity_id: input_boolean.zigbee_permit_join
platform: state
to: 'off'
action:
- data:
payload: 'false'
topic: homeassistant/bridge/config/permit_join
service: mqtt.publish
- data:
entity_id: timer.zigbee_permit_join
service: timer.cancel
hide_entity: true
- id: disable_zigbee_join_timer
alias: Disable Zigbee joining by timer
hide_entity: true
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.zigbee_permit_join
action:
- service: mqtt.publish
data:
topic: homeassistant/bridge/config/permit_join
payload: 'false'
- service: input_boolean.turn_off
data:
entity_id: input_boolean.zigbee_permit_join