3 |
4 |
5 | Maison Des Lunes
6 |
7 | Home Assistant Configuration
8 |
9 |
10 | This repo contains the working [Home Assistant](https://home-assistant.io/) configuration for **Maison Des Lunes**. Below are links to the devices currently being used, blog posts, and other HA enthusists that provided inspiration and configs to help build this config. All of the code is free to use.
11 |
12 | Be sure to follow me on twitter [@thejeffreystone](https://twitter.com/thejeffreystone) and on [YouTube](https://www.youtube.com/channel/UCipZJ6748kd8TbelSxcvcVg) where I am starting to post videos of my Home Automation journey. I also post articles about this config and other Home Automation topics at [slacker-labs.com](https://slacker-labs.com)
13 |
14 | And of course, if you have hit that :star: at the top to follow this repo what are you waiting for? You can get updates right in your notification feed everytime I push updates. Which is at least once a week and some weeks quite a bit more.
15 |
16 | #### Maison Des Lunes' Three Laws of Home Automation
17 |
18 | When designing Maison De Lune's automations I have made every effort to prioritize the solution based on the following three laws.
19 |
20 | **First Law: Every automation or action should be the result of a passive sensor or indirect action**.
21 |
22 | **Second Law: An automation can be triggered by voice command only when Law 1 cannot be achieved**.
23 |
24 | **Third Law: An automation or action can be trigger by a physical switch or as the result of a direct iteraction only when Law 1 and Law 2 cannot be achieved.**
25 |
26 | For more about how they are used visit [https://slacker-labs.com/2020/04/02/the-three-laws-of-home-automation/](https://slacker-labs.com/2020/04/02/the-three-laws-of-home-automation/)
27 |
28 |
29 |
30 | This is V6 of my config.
31 |
32 | #### General Information about Maison Des Lunes
33 |
34 | Hassio is the flavor of Home Assistant powering Maison Des Lunes these days. Currently it is running on a Home Assistant Blue.
35 |
36 | The old configurations is stored in a different repo - [Older Version](https://github.com/thejeffreystone/home-assistant-configuration)
37 |
38 | Read about the continuing work to automate **everything** over on [slacker-labs.com](https://slacker-labs.com). Feel free to reach out if you have questions. I love this stuff.
39 |
40 | One last thing. Everything in this configuration is a combination of the things I want out of a home automation system flavored with the inspiration from others using Home Assistant. In some cases I took someone else's idea and made it my own, and in some I just completely stole it. So I would be remiss if I didn't acknowledge those that inpired this journey. If you like what you see here, please checkout their configs as well. I owe them thanks for sharing their work.
41 |
42 | * [CCOSTAN](https://github.com/CCOSTAN/Home-AssistantConfig#logo) / [https://www.vCloudInfo.com](https://www.vCloudInfo.com)
43 | * [Isabella Gross Alström](https://isabellaalstrom.github.io/)
44 | * [Mahasri Kalavala](https://github.com/skalavala/mysmarthome)
45 |
46 | #### Devices:
47 | - Need to update this...
48 |
49 | #### Want to support this project?
50 |
51 |
97 | # {{ [
98 | # 'There is a Full Moon out tonight. and this time it is the actual moon. And not the neighbor. ',
99 | # 'Hey look, There is the full moon. ',
100 | # 'The moon is huge! And full. ',
101 | # 'If you went outside right now you might see the full moon. Of course if you wait long enough there will be one inside the house too. ',
102 | # 'If you want to see the full moon, tonight is the night.']
103 | # | random }}
104 | #
105 | - service: script.twitter_notify_image
106 | data_template:
107 | tweet: >-
108 | {{ [
109 | "There is a Full Moon out tonight, and this time it's the actual moon and not the neighbor. ",
110 | "Hey look kids, There's the full moon. ",
111 | "The moon is huge! And full. "] | random + "#Space #fullmoon"}}
112 | image: >-
113 | {{ [ "/config/www/tweet_images/full_moon.jpg",
114 | "/config/www/tweet_images/moon2.jpeg",
115 | "/config/www/tweet_images/moon3.jpeg",
116 | "/config/www/tweet_images/moon4.jpeg",
117 | "/config/www/tweet_images/moon1.jpeg"
118 | ] | random }}
119 |
--------------------------------------------------------------------------------
/config/packages/sysmon.yaml:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # @author : Jeffrey Stone
3 | # @date : 02/19/2019
4 | # @package : Sysmon
5 | # @description : A collection of Home Assistant and Pi Sensors
6 | ###############################################################################
7 |
8 | command_line:
9 | - sensor:
10 | name: 'Lines of Code'
11 | unique_id: lines_of_code
12 | command: "find /config -name '*.yaml' | xargs cat | wc -l"
13 | scan_interval: 20000
14 | - sensor:
15 | name: 'GitHub Stats'
16 | unique_id: github_stats
17 | command: 'curl https://api.github.com/repos/thejeffreystone/homeassistant-config'
18 | scan_interval: 20000
19 | value_template: '{{ value_json.name }}'
20 | json_attributes:
21 | - open_issues
22 | - stargazers_count
23 |
24 | sensor:
25 | - platform: systemmonitor
26 | resources:
27 | - type: disk_use_percent
28 | arg: /
29 | - type: memory_use_percent
30 | - type: network_in
31 | arg: eth0
32 | - type: network_out
33 | arg: eth0
34 | - type: load_15m
35 | - type: processor_use
36 | - type: last_boot
37 | - platform: time_date
38 | display_options:
39 | - 'time'
40 | - 'date'
41 | - 'date_time'
42 | - 'time_date'
43 | - 'date_time_iso'
44 | - 'time_utc'
45 | - 'beat'
46 |
47 | - platform: template
48 | sensors:
49 | current_version_ha:
50 | #command: python3 -c "import requests; print(requests.get('https://pypi.python.org/pypi/homeassistant/json').json()['info']['version'])"
51 | friendly_name: Current HA Version
52 | value_template: >-
53 | {{ states.binary_sensor.attributes.newest_version }}
54 |
55 |
56 | - platform: template
57 | sensors:
58 | open_pull_requests:
59 | friendly_name: Open Pull Requests
60 | value_template: >-
61 | {{ states('sensor.thejeffreystone_homeassistant_config_pull_requests') }}
62 |
63 | # For tracking number of times motion is detected
64 | # at front door in last 7 days
65 | - platform: history_stats
66 | name: Front Door Motion Yesterday
67 | entity_id: binary_sensor.front_door_motion
68 | state: 'on'
69 | type: count
70 | end: "{{ now().replace(hour=0, minute=0, second=0, microsecond=0) }}"
71 | duration:
72 | hours: 24
73 | - platform: history_stats
74 | name: Doorbell Presses Yesterday
75 | entity_id: binary_sensor.front_door_ding
76 | state: 'on'
77 | type: count
78 | end: "{{ now().replace(hour=0, minute=0, second=0, microsecond=0) }}"
79 | duration:
80 | hours: 24
81 |
82 | utility_meter:
83 | # Use the 7 day history of motion at front door
84 | # to get daily motion.
85 | hourly_frontdoor_motion:
86 | source: sensor.front_door_motion
87 | cycle: hourly
88 | daily_frontdoor_motion:
89 | source: sensor.front_door_motion
90 | cycle: daily
91 |
92 | template:
93 | - binary_sensor:
94 | - name: fridge_freezer_warming
95 | unique_id: fridge_freezer_warming_sensor
96 | state: >
97 | {{ states('sensor.acurite_986_fridge_freezer_f') | int > 15 }}
98 | device_class: problem
99 | - binary_sensor:
100 | - name: chest_freezer_warming
101 | unique_id: chest_freezer_warming_sensor
102 | state: >
103 | {{ states('sensor.acurite_986_chest_freezer_f') | int > 15 }}
104 | device_class: problem
105 | - sensor:
106 | - name: Critical Battery Count
107 | unique_id: critical_battery_count
108 | state: >
109 | {{ expand('group.critical_batteries')
110 | | rejectattr('state', 'eq', '100')
111 | | selectattr('state', 'lt', '30') | list | count }}
112 |
113 |
114 |
115 | script:
116 | battery_notification:
117 | sequence:
118 | - service: script.get_jeff_briefing
119 | response_variable: "jeff_briefing"
120 | - condition: template
121 | value_template: >
122 | {{ jeff_briefing.critical_battery_count | int > 0 }}
123 | - variables:
124 | message: >
125 | {% set batts = expand('group.critical_batteries')
126 | | rejectattr('state', 'eq', '100')
127 | | selectattr('state', 'lt', '30') | list %}
128 | {% for bat in batts %}
129 | {{ bat.name }} - {{ bat.state }}%
130 | {% endfor %}
131 | - service: script.cleanup_text
132 | data:
133 | message: >
134 | {{ message }}
135 | response_variable: "cleaned_message"
136 | - service: script.text_notify
137 | data:
138 | who: "jeff"
139 | message: >
140 | {{ cleaned_message.text }}
141 | title: "Battery List"
142 | - service: persistent_notification.dismiss
143 | data:
144 | notification_id: "battery_notification"
145 | - service: persistent_notification.create
146 | data:
147 | notification_id: "battery_notification"
148 | message: "{{ message }}"
149 | title: "Battery List - To Change"
150 | - service: todo.add_item
151 | target:
152 | entity_id: todo.ha_tasks
153 | data:
154 | item: "Replace Batteries"
155 | due_date: "{{states('sensor.date')}}"
156 | description: "Replace these batteries."
--------------------------------------------------------------------------------
/config/groups.yaml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #################################################################################
4 | ### Groups ###
5 |
6 | Family:
7 | - person.jeffrey
8 | - person.katherine
9 | - person.uncle_matt
10 | - person.papa
11 |
12 | People:
13 | - person.jeffrey
14 | - person.katherine
15 | - sensor.skylar_location
16 | - person.uncle_matt
17 | - person.papa
18 |
19 | test:
20 | - group.jeffrey
21 | - group.kat
22 |
23 | jeffrey:
24 | - device_tracker.jeffrey_s_iphone_11_app
25 | - device_tracker.jeffreys_iphone_11
26 | - device_tracker.life360_jeffrey_stone
27 |
28 | kat:
29 | - device_tracker.iphone_app
30 | - device_tracker.life360_kat_stone
31 |
32 | arriving:
33 | name: Arriving
34 | entities: []
35 |
36 | kitchen_occupancy:
37 | name: "Kitchen occupancy"
38 | entities: []
39 |
40 | living_room_occupancy:
41 | entities: []
42 |
43 | theater_occupancy:
44 | entities: []
45 |
46 | studio_occupancy:
47 | entities: []
48 |
49 | deck_occupancy:
50 | entities: []
51 |
52 | skylars_bedroom_occupancy:
53 | entities: []
54 |
55 | #- binary_sensor.skylars_bedroom_motion
56 | occupancy:
57 | - binary_sensor.living_room_motion
58 | - binary_sensor.kitchen_motion
59 | - binary_sensor.pantry_motion
60 | - binary_sensor.bar_motion
61 | - binary_sensor.master_bedroom_motion
62 | - binary_sensor.slacker_labs_motion
63 | - binary_sensor.cricut_desk_motion
64 | - binary_sensor.dungeon_motion
65 | - binary_sensor.pot_studio_motion
66 | - binary_sensor.back_door_motion
67 | - binary_sensor.theater_motion
68 | - binary_sensor.exercise_motion
69 | - binary_sensor.stairs_motion_top
70 | - binary_sensor.stairs_motion_bottom
71 | - binary_sensor.roomsense_pir_f412fae8c830
72 |
73 | rooms:
74 | - bomary_sensor.theater_occupied
75 | - binary_sensor.kitchen_occupied
76 | - binary_sensor.living_room_occupied
77 | - binary_sensor.master_bedroom_occupied
78 | - binary_sensor.skylars_bedroom_occupied
79 | - binary_sensor.studio_occupied
80 | - binary_sensor.pot_studio_occupied
81 | - binary_sensor.exercise_room_occupied
82 |
83 | occupancy_night:
84 | - binary_sensor.living_room_motion
85 | - binary_sensor.kitchen_motion
86 | - binary_sensor.pantry_motion
87 | - binary_sensor.bar_motion
88 | - binary_sensor.master_bedroom_motion
89 | - binary_sensor.slacker_labs_motion
90 | - binary_sensor.cricut_desk_motion
91 | - binary_sensor.dungeon_motion
92 | - binary_sensor.pot_studio_motion
93 | - binary_sensor.roomsense_pir_f412fae8c830
94 |
95 | stairs_occupancy:
96 | - binary_sensor.stairs_motion_bottom
97 | - binary_sensor.stairs_motion_top_occupancy
98 |
99 | room_presence:
100 | - sensor.jeff_room
101 | - sensor.kat_room
102 | - sensor.skylar_room
103 |
104 | jeff_room:
105 | - sensor.jeffs_iphone_11
106 | - sensor.jeffs_watch
107 |
108 | kat_room:
109 | - sensor.kats_iphone_11
110 | - sensor.kats_watch
111 |
112 | audio_devices:
113 | - media_player.kitchen_display
114 | - media_player.upstairs_speaker
115 | - media_player.master_bedroom_speaker
116 | - media_player.croft_speaker
117 | - media_player.studio_speaker
118 | - media_player.skylars_bedroom_speaker
119 | - media_player.theater
120 |
121 | all_echos:
122 | - media_player.living_room_echo
123 | - media_player.skylars_room
124 | - media_player.slacker_labs_echo
125 | - media_player.theater_echo
126 | - media_player.basement_echo
127 | - media_player.master_bedroom_echo
128 |
129 | Outside Lights:
130 | - light.front_porch_lights
131 | - switch.deck_lights
132 | - switch.driveway_light
133 |
134 | External Doors:
135 | - binary_sensor.kitchen_door
136 | - binary_sensor.front_door
137 | - binary_sensor.back_door
138 | - binary_sensor.basement_door
139 | - binary_sensor.garage_door
140 |
141 | Garage Doors:
142 | - binary_sensor.side_door
143 | - binary_sensor.garage_door
144 |
145 | Internal Doors:
146 | - binary_sensor.attic_door
147 |
148 | rgb lr:
149 | - light.front_door_lamp
150 | - light.living_room_lamp
151 | - light.living_room_tower_lamp
152 |
153 | livingroom lighting:
154 | - light.front_door_lamp
155 | - light.living_room_lamp
156 | - light.living_room_tower_lamp
157 | - switch.fireplace_lights
158 |
159 | livingroom lights:
160 | - light.front_door_lamp
161 | - light.living_room_lamp
162 | - switch.fireplace_lights
163 |
164 | livingroom tower:
165 | - light.living_room_tower_lamp
166 |
167 | livingroom lamps:
168 | - light.living_room_lamp
169 | - light.front_door_lamp
170 |
171 | incense:
172 | - switch.forest_incense_incense
173 | - switch.artemis
174 | - switch.incense
175 |
176 | onlyfans:
177 | - switch.croft_fan
178 | - switch.livingroom_fan
179 |
180 | Skylars Bedroom:
181 | - light.skylars_dresser_lamp
182 | - switch.rainbow_lamp # rainbow light
183 | - light.wled_skylarsroom
184 | - switch.skylars_desk
185 |
186 | Master Bedroom:
187 | - light.jeffs_lamp
188 | - light.kats_lamp
189 | - light.master_bedroom_tower_lamp
190 |
191 | driveway_motion:
192 | - binary_sensor.aarlo_motion_driveway_camera
193 | - binary_sensor.aarlo_motion_car_port
194 |
195 | critical_batteries:
196 | - sensor.aarlo_battery_level_driveway_camera
197 | - sensor.aarlo_battery_level_car_port
198 | - sensor.ring_battery
199 |
200 |
201 | kitchen:
202 | - light.kitchen_cabinets
203 | - switch.kitchen_light_strip
204 |
205 | livingroom:
206 | - light.front_door_lamp
207 | - light.living_room_lamp
208 | - light.living_room_tower_lamp
209 | - switch.fireplace_lights
210 | - switch.rail_lights
211 |
212 | vacation lights:
213 | - light.front_door_lamp
214 | - light.living_room_lamp
215 | - light.living_room_tower_lamp
216 | - light.skylars_dresser_lamp
217 | - light.kitchen_sink
218 | - light.master_bedroom_tower_lamp
219 | - light.jeff_lamp
220 | - switch.fireplace_lights
221 |
222 | theater lights:
223 | - light.theater_lights
224 |
225 |
226 | weather_alerts:
227 | - sensor.fayette_alert_1
228 | - sensor.fayette_alert_2
229 | - sensor.fayette_alert_3
230 | - sensor.fayette_alert_4
231 | - sensor.fayette_alert_5
--------------------------------------------------------------------------------
/config/packages/lighting.yaml:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # @author : thejefreystone
3 | # @date : 10/05/2020
4 | # @package : Lighting
5 | # @description : All the Lightning specific configs.
6 | ###############################################################################
7 |
8 | input_number:
9 | master_bedroom_wakeup:
10 | name: Master Bedroom Wakeup Lighting
11 | initial: 8.5
12 | min: 8.5
13 | max: 255
14 | step: 8.5
15 |
16 |
17 | script:
18 |
19 | livingroom_lamps_on:
20 | sequence:
21 | - service: scene.turn_on
22 | entity_id: scene.normal_livingroom_lighting
23 |
24 | # Turn on Living Room Lights if sun is down or cloud coverage is above 70%
25 | # livingroom_lamps_on_dark:
26 | # sequence:
27 | # - condition: or
28 | # conditions:
29 | # - condition: state
30 | # entity_id: sun.sun
31 | # state: 'below_horizon'
32 | # - service: scene.turn_on
33 | # entity_id: scene.normal_livingroom_lighting
34 |
35 | # # Turn off Living Room Lights if sun is up and it is sunny or partly cloudy
36 | # livingroom_lights_off:
37 | # sequence:
38 | # - condition: and
39 | # conditions:
40 | # - condition: state
41 | # entity_id: sun.sun
42 | # state: 'above_horizon'
43 | # - condition: state
44 | # entity_id: binary_sensor.living_room_motion
45 | # state: 'off'
46 | # - condition: template
47 | # value_template: >
48 | # {%- if states.weather.home.state == "sunny" or states.weather.home.state == "partlycloudy" -%}
49 | # true
50 | # {%- endif -%}
51 | # - service: group.turn_off
52 | # entity_id: group.livingroom
53 |
54 |
55 | #################################################
56 |
57 |
58 | theater_lights_down:
59 | sequence:
60 | - service: scene.turn_on
61 | entity_id: scene.theater_dim
62 | - delay:
63 | minutes: 1
64 | - service: scene.turn_on
65 | entity_id: scene.theater_dark
66 |
67 | theater_lights_up:
68 | sequence:
69 | - service: scene.turn_on
70 | entity_id: scene.theater_dim
71 | - delay:
72 | minutes: 1
73 | - service: scene.turn_on
74 | entity_id: scene.theater_bright
75 |
76 | #################################################
77 |
78 | master_bedroom_lights_w_level:
79 | sequence:
80 | - service: light.turn_on
81 | entity_id: light.kats_lamp, light.master_bedroom_tower_lamp, light.jeffs_lamp
82 | data:
83 | brightness: >
84 | {{ level | int }}
85 | color_temp: 369
86 |
87 | master_bedroom_nightlight:
88 | sequence:
89 | - service: scene.turn_on
90 | entity_id: scene.master_bedroom_nightlight
91 | - delay: '00:04:00'
92 | - service: scene.turn_on
93 | entity_id: scene.master_bedroom_off
94 |
95 | master_bedroom_morning_wakeup_lighting:
96 | sequence:
97 | - repeat:
98 | while:
99 | - condition: template
100 | value_template: '{{ states("input_number.master_bedroom_wakeup") | int < 256 }}'
101 | sequence:
102 | - service: script.master_bedroom_lights_w_level
103 | data:
104 | level: '{{ states("input_number.master_bedroom_wakeup") }}'
105 | - service: input_number.increment
106 | entity_id: input_number.master_bedroom_wakeup
107 | - delay: 00:01:00
108 | - service: input_number.set_value
109 | data:
110 | entity_id: input_number.master_bedroom_wakeup
111 | value: 8.5
112 |
113 |
114 | #################################################
115 | studio_sleep:
116 | sequence:
117 | - if:
118 | - condition: template
119 | value_template: >-
120 | {{ is_state('sensor.ender5_state','idle') and states('sensor.octoprint_print_status') not in ['Printing'] }}
121 | then:
122 | - service: light.turn_off
123 | entity_id: light.printer_backlight
124 | - service: light.turn_off
125 | data: {}
126 | target:
127 | area_id: studio
128 | - service: switch.turn_off
129 | data: {}
130 | target:
131 | area_id: studio
132 |
133 |
134 | #################################################
135 | get_room_scenes:
136 | sequence:
137 | - variables:
138 | area: >
139 | {{ room }}
140 | normal: >
141 | {{ states.scene |
142 | selectattr('entity_id', 'in', area_entities(area)) |
143 | selectattr('entity_id', 'search', '(normal)') |
144 | map(attribute='entity_id') |
145 | list | first }}
146 | dim: >
147 | {{ states.scene |
148 | selectattr('entity_id', 'in', area_entities(area)) |
149 | selectattr('entity_id', 'search', '(dim)') |
150 | map(attribute='entity_id') |
151 | list | first }}
152 | night: >
153 | {{ states.scene |
154 | selectattr('entity_id', 'in', area_entities(area)) |
155 | selectattr('entity_id', 'search', '(night)') |
156 | map(attribute='entity_id') |
157 | list | first }}
158 | scenes: >
159 | {"normal":"{{normal}}",
160 | "dim":"{{dim}}",
161 | "night":"{{night}}"}
162 | - stop: "Alright. Im done."
163 | response_variable: "scenes"
164 | get_room_lights:
165 | sequence:
166 | - variables:
167 | area: >
168 | {{ room }}
169 | entities: >
170 | {% set lights = states.light |
171 | selectattr('entity_id', 'in', area_entities(area)) |
172 | map(attribute='entity_id') |
173 | list | join(',') %}
174 | {"lights":"{{lights}}"}
175 | - stop: "Alright. Im done."
176 | response_variable: "entities"
177 |
178 | master_bedroom_lights_off:
179 | sequence:
180 | - service: input_boolean.turn_off
181 | entity_id: input_boolean.light_override
182 | - service: light.turn_off
183 | entity_id: light.kats_lamp, light.master_bedroom_tower_lamp, light.jeffs_lamp
184 |
185 | master_bedroom_lights_override:
186 | sequence:
187 | - service: input_boolean.toggle
188 | entity_id: input_boolean.light_override
189 |
190 |
--------------------------------------------------------------------------------
/config/customize.yaml:
--------------------------------------------------------------------------------
1 | ### CUSTOMIZE ###
2 |
3 | # Speedtest #
4 | sensor.speedtest_ping:
5 | icon: mdi:speedometer
6 | friendly_name: Ping
7 | sensor.speedtest_download:
8 | icon: mdi:download
9 | friendly_name: Download
10 | sensor.speedtest_upload:
11 | icon: mdi:upload
12 | friendly_name: Upload
13 |
14 | # Jeff #
15 |
16 | sensor.jeffrey_location:
17 | entity_picture: !secret JEFF_ICON
18 | friendly_name: Jeff
19 | sensor.jeff_location:
20 | entity_picture: !secret JEFF_ICON
21 | sensor.jeff_destination:
22 | icon: mdi:google-maps
23 | name: "Jeffs Destination"
24 | device_tracker.jeffreystonesiphone:
25 | entity_picture: !secret JEFF_ICON
26 | friendly_name: Jeff
27 | sensor.jeff_iphone_batt:
28 | friendly_name: "Jeff's iPhone Battery"
29 | sensor.jeff_ett_home:
30 | friendly_name: "Jeff's ETA Home"
31 | icon: mdi:car
32 | device_tracker.jeffreystonesipad:
33 | icon: mdi:tablet-ipad
34 | friendly_name: "Jeff's iPad"
35 | device_tracker.jeffreysmbp:
36 | icon: mdi:laptop-mac
37 | friendly_name: "Jeff's MacBook"
38 | device_tracker.jstonemac:
39 | icon: mdi:laptop-mac
40 | friendly_name: "Jeff's Work Mac"
41 | device_tracker.jeffreysapple_watch:
42 | friendly_name: "Jeff's Watch"
43 | icon: mdi:watch
44 |
45 |
46 | # Kat ##
47 | device_tracker.iphone:
48 | entity_picture: !secret KAT_ICON
49 | friendly_name: Kat
50 | sensor.kat_location:
51 | entity_picture: !secret KAT_ICON
52 | sensor.kat_iphone_batt:
53 | friendly_name: "Kat's iPhone Battery"
54 | device_tracker.katherinesipad:
55 | icon: mdi:tablet-ipad
56 | friendly_name: "Kat's Ipad"
57 | device_tracker.katherinesmini:
58 | icon: mdi:desktop-mac
59 | friendly_name: "Kat's Mini"
60 | sensor.kat_ett_home:
61 | friendly_name: "Kat's ETA Home"
62 | icon: mdi:car
63 | sensor.kat_destination:
64 | icon: mdi:google-maps
65 | name: "Kats Destination"
66 |
67 | # Skylar
68 |
69 | sensor.skylar_location:
70 | entity_picture: !secret SKYLAR_ICON
71 |
72 | # Device ##
73 | device_tracker.gateway2f3bca:
74 | icon: mdi:nest-thermostat
75 | friendly_name: Honeywell
76 | sensor.appletv:
77 | icon: mdi:apple
78 | sensor.roku:
79 | icon: mdi:television
80 | sensor.xboxone:
81 | icon: mdi:xbox
82 | sensor.chromecast:
83 | icon: mdi:cast
84 | sensor.samsungtv:
85 | icon: mdi:television
86 | sensor.amazon_dot_lr:
87 | icon: mdi:amazon
88 | sensor.amazon_dot_kn:
89 | icon: mdi:amazon
90 | sensor.honeywell:
91 | icon: mdi:thermostat
92 | sensor.smartthings:
93 | icon: mdi:router-wireless
94 | sensor.eero_loft:
95 | icon: mdi:router-wireless
96 | sensor.eero_livingroom:
97 | icon: mdi:router-wireless
98 | media_player.roku_5s6719003683:
99 | friendly_name: Roku Living Room
100 | icon: mdi:youtube-tv
101 | device_tracker.00a0dea3ed2f:
102 | friendly_name: Yamaha AV
103 | icon: mdi:surround-sound
104 | media_player.pn60e550_pn60e550:
105 | name: Samsung TV
106 | icon: mdi:television
107 | media_player.hass_speaker:
108 | name: AH Speaker
109 | icon: mdi:speaker
110 | media_player.yamaha_receiver_theater:
111 | icon: mdi:audio-video
112 | switch.main_theater:
113 | icon: mdi:audio-video
114 |
115 | # Switches and Lights ##
116 | switch.fireplace_lights:
117 | icon: mdi:spotlight-beam
118 | switch.tower_lamp:
119 | icon: mdi:lightbulb
120 | switch.driveway_light:
121 | icon: mdi:lightbulb
122 | switch.side_door:
123 | icon: mdi:lightbulb
124 | switch.front_porch:
125 | icon: mdi:lightbulb
126 | switch.front_lamp:
127 | icon: mdi:lightbulb
128 | switch.upstairs_light:
129 | icon: mdi:lightbulb
130 | cover.garage_door:
131 | device_class: garage
132 | friendly_name: Garage Door
133 | homebridge_cover_type: garage_door
134 | switch.loft_fan:
135 | friendly_name: "Loft Box Fan"
136 | icon: mdi:fan
137 | switch.house_secured:
138 | name: House Secured
139 | icon: mdi:lock
140 | switch.vacation_mode:
141 | name: Vacation Mode
142 | icon: mdi:airplane-takeoff
143 | switch.guest_mode:
144 | name: Guest Mode
145 | icon: mdi:account-multiple
146 | switch.notifications_to_kat:
147 | name: Notify Katherine
148 | icon: mdi:telegram
149 | switch.notifications_to_jeff:
150 | name: Notify Jeff
151 | icon: mdi:telegram
152 | switch.automations:
153 | name: automations
154 | icon: mdi:home-automation
155 | switch.kitchen_cabinets:
156 | icon: mdi:lightbulb
157 | switch.kitchen_light_strip:
158 | icon: mdi:lightbulb
159 | switch.garage_alarm:
160 | name: Garage Door Alarm
161 | icon: mdi:alert
162 | input_select.trash_pickup:
163 | name: Trash Pickup
164 | icon: mdi:delete-variant
165 | input_select.recycle_pickup:
166 | name: Recycle Pickup
167 | icon: mdi:delete-variant
168 | switch.trash_notification:
169 | name: Trash Notifications
170 | icon: mdi:telegram
171 | switch.master_bedroom_fan:
172 | icon: mdi:fan
173 | switch.incense:
174 | icon: mdi:flower
175 | switch.christmas_tree_lights:
176 | icon: mdi:lightbulb
177 | switch.christmas_lights:
178 | icon: mdi:lightbulb
179 | switch.rainbow_light:
180 | icon: mdi:lightbulb
181 |
182 | # Travel Times ##
183 | sensor.home_to_summit:
184 | friendly_name: "Home to Summit"
185 | icon: mdi:car
186 | sensor.home_to_zoo:
187 | friendly_name: "Home to Zoo Atlanta"
188 | icon: mdi:car
189 |
190 |
191 | # Various Sensors ##
192 | sensor.kitchen_fire:
193 | name: Kitchen Smoke Detector
194 | icon: mdi:tower-fire
195 | sensor.smoke_kitchen:
196 | icon: mdi:fire
197 |
198 | sensor.ha_uptime:
199 | friendly_name: HA Uptime
200 | icon: mdi:clock-start
201 | sensor.installed_version:
202 | friendly_name: Installed
203 | icon: mdi:folder-download
204 | sensor.lets_encrypt_expiration:
205 | friendly_name: Lets Encrypt Expiration
206 | icon: mdi:timelapse
207 | sensor.current_ha_version:
208 | friendly_name: Latest Release
209 | icon: mdi:github-circle
210 | sensor.connected_clients:
211 | friendly_name: Connections
212 | icon: mdi:lan-connect
213 | zwave.aeotec_zw090_zstick_gen5_us:
214 | friendly_name: Zwave USB Hub
215 | sensor.ha_v2db:
216 | friendly_name: HA Database
217 | icon: mdi:file
218 | sensor.ha_log:
219 | friendly_name: HA Log
220 | icon: mdi:file
221 | sensor.accurite_back_porch_temperature:
222 | friendly_name: Back Porch Temp
223 | icon: mdi:thermometer
224 | unit_of_measurement: '°F'
225 | sensor.accurite_back_porch_humidity:
226 | friendly_name: Back Porch Humidity
227 | icon: mdi:water-percent
228 | unit_of_measurement: '%'
229 | sensor.accurite_garage_temperature:
230 | friendly_name: Garage Temp
231 | icon: mdi:thermometer
232 | unit_of_measurement: '°F'
233 | sensor.accurite_garage_humidity:
234 | friendly_name: Garage Humidity
235 | icon: mdi:water-percent
236 | unit_of_measurement: '%'
237 | binary_sensor.garage_dome_sensor:
238 | friendly_name: Garage Motion
239 | sensor.washer_power:
240 | friendly_name: Washer Power
241 | icon: mdi:power-plug
242 | unit_of_measurement: 'w'
243 | sensor.washer:
244 | icon: mdi:power-plug
245 |
246 |
247 | binary_sensor.roomsense_iq_presence:
248 | device_class: occupancy
--------------------------------------------------------------------------------
/config/packages/clock_chime.yaml:
--------------------------------------------------------------------------------
1 | #####################################################################
2 | # Origianl Repo: @chrisron95 - https://raw.githubusercontent.com/chrisron95/home-assistant-config/master/packages/clock_chime.yaml
3 | ## Plays the number of cuckoos per hour and 1 on the half hour.
4 | # More Info and Video: https://www.vcloudinfo.com/2017/11/building-digital-cuckoo-clock-with-home.html
5 |
6 | # Modified from Chris Heder (@chrisron95) for Maison Des Lunes
7 | # Setup package to make everything configurable.
8 | # Added:
9 | # - Ability to select sound between Cuckoo and Grandfather Clock
10 | # - Quarter toll ability
11 | # - Ability to disable quarter and half tolls, and chime entirely
12 | # - Time helpers for start and stop times.
13 | #
14 | # Changed:
15 | # - Now runs every 15 minutes rather than only every half hour
16 | # - Triggers have IDs now which allows me to replace the time templates
17 | #####################################################################
18 |
19 | input_boolean:
20 | clock_chime:
21 | name: Clock Chime
22 | icon: mdi:alarm
23 | clock_chime_half_toll:
24 | name: Clock Chime Half Hour Toll
25 | icon: mdi:alarm
26 | clock_chime_quarter_toll:
27 | name: Clock Chime Quarter Hour Toll
28 | icon: mdi:alarm
29 |
30 | input_datetime:
31 | clock_chime_on_time:
32 | name: Clock Chime On Time
33 | has_date: false
34 | has_time: true
35 | clock_chime_off_time:
36 | name: Clock Chime Off Time
37 | has_date: false
38 | has_time: true
39 |
40 | input_select:
41 | clock_chime_sound:
42 | name: Clock Chime Sound
43 | options:
44 | - Cuckoo Clock
45 | - Grandfather Clock
46 | icon: mdi:bell-ring
47 |
48 | automation:
49 | - alias: Clock Chime
50 | id: clock_chime
51 | mode: restart
52 | # Trigger every 15 minutes. The ID lets you know which one is current, rather than a time template.
53 | # This accounts for the delay when waiting for media player to stop playing, just in case it lasts too long.
54 | trigger:
55 | - platform: time_pattern
56 | minutes: 0
57 | id: "0"
58 | - platform: time_pattern
59 | minutes: 15
60 | id: "15"
61 | - platform: time_pattern
62 | minutes: 30
63 | id: "30"
64 | - platform: time_pattern
65 | minutes: 45
66 | id: "45"
67 |
68 | condition:
69 | - condition: time
70 | after: input_datetime.clock_chime_on_time
71 | before: input_datetime.clock_chime_off_time
72 | - condition: state
73 | entity_id: input_boolean.audible_notifications
74 | state: "on"
75 | - condition: state # Make sure the chime is enabled.
76 | entity_id: input_boolean.clock_chime
77 | state: "on"
78 | - condition: numeric_state # TV Off
79 | entity_id: sensor.power_switch_electric_consumption_w
80 | below: 100
81 | - condition: or # Either we are home or Guest_Mode is on.
82 | conditions:
83 | - condition: state
84 | entity_id: binary_sensor.family_home
85 | state: "on"
86 | - condition: state
87 | entity_id: input_boolean.guest_mode
88 | state: "on"
89 |
90 | action:
91 | - choose:
92 | # Check for quarter and half hour trigger, and stop if it should be disabled.
93 | - conditions:
94 | - condition: or
95 | conditions:
96 | - condition: trigger
97 | id: "15"
98 | - condition: trigger
99 | id: "45"
100 | sequence:
101 | - condition: or
102 | conditions:
103 | # Don't play the quarter toll if it's disabled.
104 | - condition: state
105 | entity_id: input_boolean.clock_chime_quarter_toll
106 | state: "off"
107 | # Also don't play the quarter toll if Cuckoo Clock is selected as it's not needed.
108 | - condition: state
109 | entity_id: input_select.clock_chime_sound
110 | state: Cuckoo Clock
111 | - stop: "Quarter Toll Disabled"
112 | - conditions:
113 | - condition: trigger
114 | id: "30"
115 | sequence:
116 | # Don't play the half toll if it's disabled.
117 | - condition: state
118 | entity_id: input_boolean.clock_chime_half_toll
119 | state: "off"
120 | - stop: "Half Toll Disabled"
121 | default: []
122 | - if:
123 | - condition: state
124 | entity_id: media_player.ha_blue
125 | state: 'idle'
126 | then:
127 | - service: media_player.volume_set
128 | data:
129 | entity_id: media_player.ha_blue
130 | volume_level: 0.25
131 | - service: media_player.play_media
132 | data:
133 | entity_id: >
134 | media_player.ha_blue
135 | media_content_id: >
136 | {% if states("input_select.clock_chime_sound") == "Cuckoo Clock" %}
137 | {% if trigger.id == "30" %}
138 | https://slackerlabs.s3.amazonaws.com/audio/cuckoo/cuckoo-clock-01.mp3
139 | {% else %}
140 | https://slackerlabs.s3.amazonaws.com/audio/cuckoo/cuckoo-clock-{{now().strftime("%I")}}.mp3
141 | {% endif %}
142 | {% elif states("input_select.clock_chime_sound") == "Grandfather Clock" %}
143 | {% if trigger.id == "15" %}
144 | https://slackerlabs.s3.amazonaws.com/audio/gfclock/toll-1quarter.mp3
145 | {% elif trigger.id == "30" %}
146 | https://slackerlabs.s3.amazonaws.com/audio/gfclock/toll-2quarter.mp3
147 | {% elif trigger.id == "45" %}
148 | https://slackerlabs.s3.amazonaws.com/audio/gfclock/toll-3quarter.mp3
149 | {% else %}
150 | https://slackerlabs.s3.amazonaws.com/audio/gfclock/{{now().strftime("%I")}}-hour.mp3
151 | {% endif %}
152 | {% endif %}
153 | media_content_type: music
154 | else:
155 | - service: script.jarvis_voice
156 | data:
157 | who: living_room
158 | message: > # Use the trigger ID to specify which sound to play.
159 | {% if states("input_select.clock_chime_sound") == "Cuckoo Clock" %}
160 | {% if trigger.id == "30" %}
161 |
162 | {% else %}
163 |
164 | {% endif %}
165 | {% elif states("input_select.clock_chime_sound") == "Grandfather Clock" %}
166 | {% if trigger.id == "15" %}
167 |
168 | {% elif trigger.id == "30" %}
169 |
170 | {% elif trigger.id == "45" %}
171 |
172 | {% else %}
173 |
174 | {% endif %}
175 | {% endif %}
176 |
--------------------------------------------------------------------------------
/config/packages/helpers_template_sensor.yaml:
--------------------------------------------------------------------------------
1 | template:
2 |
3 | - trigger:
4 | - platform: time_pattern
5 | # This will update every second
6 | seconds: "/1"
7 | sensor:
8 | - name: "chartsdata1micro"
9 | state: |
10 | { }
11 | attributes:
12 | ids: |
13 | {% set data = namespace(result={}) %}
14 |
15 | {% set ids = states.sensor.sensorids.attributes.ids %}
16 |
17 | {% for id in ids %}
18 | {% set entities = ["number.roomsense_microthreshold0_" ~ id, "number.roomsense_microthreshold1_" ~ id, "number.roomsense_microthreshold2_" ~ id,"number.roomsense_microthreshold3_" ~ id,"number.roomsense_microthreshold4_" ~ id,"number.roomsense_microthreshold4_" ~ id,"number.roomsense_microthreshold5_" ~ id,"number.roomsense_microthreshold6_" ~ id,"number.roomsense_microthreshold7_" ~ id,"number.roomsense_microthreshold8_" ~ id] %}
19 | {% set temp = namespace(result=[]) %}
20 | {% set temp2 = namespace(result=[]) %}
21 | {% for entity in entities %}
22 | {% set temp.result = temp.result + [states(entity) | float(default=0) ] %}
23 | {% endfor %}
24 | {% set key =""~id %}
25 | {% set tuple_list = data.result.items() | list + [(key, temp.result)] %}
26 | {% set data.result = dict(tuple_list) %}
27 | {% endfor %}
28 |
29 | {{ data.result }}
30 |
31 | - name: "chartsdata1macro"
32 | state: |
33 | { }
34 | attributes:
35 | ids: |
36 | {% set data = namespace(result={}) %}
37 |
38 | {% set ids = states.sensor.sensorids.attributes.ids %}
39 |
40 | {% for id in ids %}
41 | {% set entities = ["number.roomsense_macrothreshold0_" ~ id, "number.roomsense_macrothreshold1_" ~ id, "number.roomsense_macrothreshold2_" ~ id,"number.roomsense_macrothreshold3_" ~ id,"number.roomsense_macrothreshold4_" ~ id,"number.roomsense_macrothreshold4_" ~ id,"number.roomsense_macrothreshold5_" ~ id,"number.roomsense_macrothreshold6_" ~ id,"number.roomsense_macrothreshold7_" ~ id,"number.roomsense_macrothreshold8_" ~ id] %}
42 | {% set temp = namespace(result=[]) %}
43 | {% set temp2 = namespace(result=[]) %}
44 | {% for entity in entities %}
45 | {% set temp.result = temp.result + [states(entity) | float(default=0)] %}
46 | {% endfor %}
47 | {% set key =""~id %}
48 | {% set tuple_list = data.result.items() | list + [(key, temp.result)] %}
49 | {% set data.result = dict(tuple_list) %}
50 | {% endfor %}
51 |
52 | {{ data.result }}
53 |
54 | - sensor:
55 | - name: "sensorids"
56 | state: |
57 | { }
58 | attributes:
59 | ids: |
60 | {% set data = namespace(ids=[]) %}
61 | {% for state in states.binary_sensor %}
62 | {% set finder="binary_sensor\.roomsense_pir_+" %}
63 | {% set replace="" %}
64 | {%- if state.entity_id | string is match(finder, ignorecase=False) %}
65 | {% set name = state.entity_id|string|regex_replace(finder, replace='', ignorecase=False) %}
66 | {% if name not in data.ids %}
67 | {% set data.ids = data.ids + [name] %}
68 | {% endif %}
69 | {%- endif %}
70 | {% endfor %}
71 | {{data.ids}}
72 | - name: "chartsdata2micro"
73 | state: |
74 | { }
75 | attributes:
76 | ids: |
77 | {% set data = namespace(result={}) %}
78 |
79 | {% set ids = states.sensor.sensorids.attributes.ids %}
80 |
81 | {% for id in ids %}
82 | {% set entities = ["sensor.roomsense_microbin0_" ~ id, "sensor.roomsense_microbin1_" ~ id, "sensor.roomsense_microbin2_" ~ id,"sensor.roomsense_microbin3_" ~ id,"sensor.roomsense_microbin4_" ~ id,"sensor.roomsense_microbin4_" ~ id,"sensor.roomsense_microbin5_" ~ id,"sensor.roomsense_microbin6_" ~ id,"sensor.roomsense_microbin7_" ~ id,"sensor.roomsense_microbin8_" ~ id] %}
83 | {% set temp = namespace(result=[]) %}
84 | {% set temp2 = namespace(result=[]) %}
85 | {% for entity in entities %}
86 | {% set temp.result = temp.result + [states(entity) | float(default=0)] %}
87 | {% endfor %}
88 | {% set key =""~id %}
89 | {% set tuple_list = data.result.items() | list + [(key, temp.result)] %}
90 | {% set data.result = dict(tuple_list) %}
91 | {% endfor %}
92 |
93 | {{ data.result }}
94 |
95 | - name: "chartsdata2macro"
96 | state: |
97 | { }
98 | attributes:
99 | ids: |
100 | {% set data = namespace(result={}) %}
101 |
102 | {% set ids = states.sensor.sensorids.attributes.ids %}
103 |
104 | {% for id in ids %}
105 | {% set entities = ["sensor.roomsense_macrobin0_" ~ id, "sensor.roomsense_macrobin1_" ~ id, "sensor.roomsense_macrobin2_" ~ id,"sensor.roomsense_macrobin3_" ~ id,"sensor.roomsense_macrobin4_" ~ id,"sensor.roomsense_macrobin4_" ~ id,"sensor.roomsense_macrobin5_" ~ id,"sensor.roomsense_macrobin6_" ~ id,"sensor.roomsense_macrobin7_" ~ id,"sensor.roomsense_macrobin8_" ~ id] %}
106 | {% set temp = namespace(result=[]) %}
107 | {% set temp2 = namespace(result=[]) %}
108 | {% for entity in entities %}
109 | {% set temp.result = temp.result + [states(entity) | float(default=0)] %}
110 | {% endfor %}
111 | {% set key =""~id %}
112 | {% set tuple_list = data.result.items() | list + [(key, temp.result)] %}
113 | {% set data.result = dict(tuple_list) %}
114 | {% endfor %}
115 |
116 | {{ data.result }}
117 | - binary_sensor:
118 | - name: "roomsense iq presence"
119 | unique_id: roomsense_f412fae8c830
120 | state: >
121 | {{ is_state('sensor.roomsense_movement_f412fae8c830','2') }}
122 | device_class: occupancy
123 | attributes:
124 | motion: >
125 | {{ is_state('binary_sensor.roomsense_pir_f412fae8c830','on') }}
126 | illuminance: >
127 | {{ states('sensor.roomsense_photocell_f412fae8c830') | int }}
128 | temperature: >
129 | {{ states('sensor.roomsense_temperature_f412fae8c830') | int }}
130 | humidity: >
131 | {{ states('sensor.roomsense_humidity_f412fae8c830') | int }}
132 |
133 |
134 |
135 | input_text:
136 | dashtab1:
137 | name: Dash tab 1
138 | dashtab2:
139 | name: Dash tab 2
140 | dashtab3:
141 | name: Dash tab 3
142 | dashtab4:
143 | name: Dash tab 4
144 | dashtab5:
145 | name: Dash tab 5
146 | dashtab6:
147 | name: Dash tab 6
148 | dashtab7:
149 | name: Dash tab 7
150 | dashtab8:
151 | name: Dash tab 8
152 | dashtab9:
153 | name: Dash tab 9
154 | dashtab10:
155 | name: Dash tab 10
156 | dashtab11:
157 | name: Dash tab 11
158 | dashtab12:
159 | name: Dash tab 12
160 | dashtab13:
161 | name: Dash tab 13
162 | dashtab14:
163 | name: Dash tab 14
164 | dashtab15:
165 | name: Dash tab 15
166 |
--------------------------------------------------------------------------------
/config/packages/notify.yaml:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # @author : Jeffrey Stone
3 | # @date : 02/19/2019
4 | # @package : Notify
5 | # @description : A Collection of Notification Scripts and Configs.
6 | # Package modified from https://github.com/skalavala/smarthome/blob/master/packages/notify.yaml with inspiration
7 | # from https://github.com/CCOSTAN/Home-AssistantConfig/blob/master/config/script/speech_engine.yaml
8 | ###############################################################################
9 |
10 |
11 |
12 | notify:
13 | - platform: ios
14 | - name: all_ios
15 | platform: group
16 | services:
17 | - service: mobile_app_jeffreys_iphone_11
18 | - service: mobile_app_jeffreys_ipad
19 | - service: mobile_app_iphone
20 | - service: mobile_app_skylars_ipad
21 | - name: parents_ios
22 | platform: group
23 | services:
24 | - service: mobile_app_jeffreys_iphone_11
25 | - service: mobile_app_jeffreys_ipad
26 | - service: mobile_app_iphone
27 | - name: jeff_ios
28 | platform: group
29 | services:
30 | - service: mobile_app_jeffreys_iphone_11
31 | - service: mobile_app_jeffreys_ipad
32 | - name: kat_ios
33 | platform: group
34 | services:
35 | - service: mobile_app_iphone
36 | - name: skylar_ios
37 | platform: group
38 | services:
39 | - service: mobile_app_skylars_ipad
40 |
41 | - name: twitter
42 | platform: twitter
43 | consumer_key: !secret twitter_consumer_key
44 | consumer_secret: !secret twitter_consumer_secret
45 | access_token: !secret twitter_access_token
46 | access_token_secret: !secret twitter_access_secret
47 | - name: twitter_js
48 | platform: twitter
49 | consumer_key: !secret twitter2_consumer_key
50 | consumer_secret: !secret twitter2_consumer_secret
51 | access_token: !secret twitter2_access_token
52 | access_token_secret: !secret twitter2_access_secret
53 | - name: twitter_sl
54 | platform: twitter
55 | consumer_key: !secret twitter3_consumer_key
56 | consumer_secret: !secret twitter3_consumer_secret
57 | access_token: !secret twitter3_access_token
58 | access_token_secret: !secret twitter3_access_secret
59 | - platform: alexa_media
60 | name: alexa_media
61 | - name: mastodon_sl
62 | platform: mastodon
63 | access_token: !secret mastodon_access_token
64 | client_id: !secret mastodon_client_id
65 | client_secret: !secret mastodon_client_secret
66 | base_url: https://mastodon.online
67 | - name: mastodon_mdl
68 | platform: mastodon
69 | access_token: !secret mdl_mastodon_access_token
70 | client_id: !secret mdl_mastodon_client_id
71 | client_secret: !secret mdl_mastodon_client_secret
72 | base_url: https://mastodon.online
73 | - name: mastodon_dev
74 | platform: mastodon_sl
75 | access_token: !secret test_mastodon_access_token
76 | client_id: !secret test_mastodon_client_id
77 | client_secret: !secret test_mastodon_client_secret
78 | base_url: https://mastodon.online
79 |
80 | script:
81 |
82 |
83 | ###############################################################################
84 | # Txt Notify
85 | ###############################################################################
86 | text_debug:
87 | sequence:
88 | - condition: state
89 | entity_id: input_boolean.debug_texts
90 | state: 'on'
91 | - service: notify.jeff_ios
92 | data_template:
93 | message: >
94 | {{ message }}
95 |
96 | text_notify:
97 | fields:
98 | who:
99 | selector:
100 | text:
101 | name: who
102 | required: true
103 | title:
104 | selector:
105 | text:
106 | name: title
107 | required: false
108 | message:
109 | selector:
110 | text:
111 | name: message
112 | required: true
113 | sequence:
114 | - condition: state
115 | entity_id: input_boolean.text_notifications
116 | state: 'on'
117 | - choose:
118 | - conditions:
119 | - condition: template
120 | value_template: '{{ who == "jeff"}}'
121 | - condition: state
122 | entity_id: input_boolean.text_notify_jeff
123 | state: 'on'
124 | sequence:
125 | - service: notify.jeff_ios
126 | data:
127 | title: '{{ title }}'
128 | message: '{{ message }}'
129 | - conditions:
130 | - condition: template
131 | value_template: '{{ who == "kat"}}'
132 | - condition: state
133 | entity_id: input_boolean.text_notify_kat
134 | state: 'on'
135 | sequence:
136 | - service: notify.kat_ios
137 | data:
138 | title: '{{ title }}'
139 | message: '{{ message }}'
140 | - conditions:
141 | - condition: template
142 | value_template: '{{ who == "skylar"}}'
143 | - condition: state
144 | entity_id: input_boolean.text_notify_skylar
145 | state: 'on'
146 | sequence:
147 | - service: notify.skylar_ios
148 | data:
149 | title: '{{ title }}'
150 | message: '{{ message }}'
151 | - conditions:
152 | - condition: template
153 | value_template: '{{ who == "parents"}}'
154 | - condition: state
155 | entity_id: input_boolean.text_notify_parents
156 | state: 'on'
157 | sequence:
158 | - service: notify.parents_ios
159 | data:
160 | title: '{{ title }}'
161 | message: '{{ message }}'
162 | default:
163 | - service: notify.all_ios
164 | data:
165 | title: '{{ title }}'
166 | message: '{{ message }}'
167 |
168 |
169 | text_alert:
170 | sequence:
171 | - service: >
172 | {% if who == 'jeff' %}
173 | notify.jeff_ios
174 | {% elif who == 'kat' %}
175 | notify.kat_ios
176 | {% elif who == 'skylar' %}
177 | notify.skylar_ios
178 | {% elif who == 'parents' %}
179 | notify.parents_ios
180 | {% else %}
181 | notify.all_ios
182 | {% endif %}
183 | data:
184 | title: '{{ title }}'
185 | message: '{{ message }}'
186 | #data:
187 | # attachment:
188 | # url: '{{ url }}'
189 | # content-type: '{{ content_type }}'
190 | # hide-thumbnail: false
191 | # push:
192 | # sound: '{{ ios_sound }}'
193 | # badge: 0
194 | # category: '{{ ios_category }}'
195 | # entity_id: '{{ camera_entity }}'
196 |
197 | text_alert_image:
198 | sequence:
199 | - service: >
200 | {% if who == 'jeff' %}
201 | notify.jeff_ios
202 | {% elif who == 'kat' %}
203 | notify.kat_ios
204 | {% elif who == 'skylar' %}
205 | notify.skylar_ios
206 | {% elif who == 'parents' %}
207 | notify.ios_parents
208 | {% else %}
209 | notify.all_ios
210 | {% endif %}
211 | data:
212 | title: '{{ title }}'
213 | message: '{{ message }}'
214 | data:
215 | attachment:
216 | url: '{{ url }}'
217 | content-type: '{{ content_type }}'
218 | hide-thumbnail: false
219 | # push:
220 | # sound: '{{ ios_sound }}'
221 | # badge: 0
222 | # category: '{{ ios_category }}'
223 | # entity_id: '{{ camera_entity }}'
224 |
--------------------------------------------------------------------------------
/config/packages/slacker_presence.yaml:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # @author : Jeffrey Stone
3 | # @date : 07/09/2019
4 | # @package : Slacker Presence
5 | # @description : Bringing some actual smarts to your smart home
6 | ###############################################################################
7 |
8 |
9 | script:
10 | update_occupancy_groups:
11 | sequence:
12 | # Reset group - KITCHEN
13 | - service: group.set
14 | data:
15 | object_id: "kitchen_occupancy"
16 | entities: []
17 | # Add any oocupancy, motion, or door in the area to the group
18 | - service: group.set
19 | data:
20 | object_id: "kitchen_occupancy"
21 | add_entities: >-
22 | {{
23 | (states.binary_sensor |
24 | selectattr('entity_id', 'in', area_entities('kitchen')) |
25 | rejectattr('attributes.device_class', 'undefined') |
26 | selectattr('attributes.device_class', 'search', '(occupancy|motion|door)') |
27 | map(attribute='entity_id') | list ) | join(',')
28 | }}
29 | # Reset group - LIVING ROOM
30 | - service: group.set
31 | data:
32 | object_id: "living_room_occupancy"
33 | entities: []
34 | # Add any oocupancy, motion, or door in the area to the group
35 | - service: group.set
36 | data:
37 | object_id: "living_room_occupancy"
38 | add_entities: >-
39 | {{
40 | ((states.binary_sensor |
41 | selectattr('entity_id', 'in', area_entities('34c114a19c5e41ee9cfe505696338bec')) |
42 | rejectattr('attributes.device_class', 'undefined') |
43 | selectattr('attributes.device_class', 'search', '(occupancy|motion|door|running)') |
44 |
45 | map(attribute='entity_id') | list )) | join(',')}}
46 | # Reset group - STUDIO
47 | - service: group.set
48 | data:
49 | object_id: "studio_occupancy"
50 | entities: []
51 | # Add any oocupancy, motion, or door in the area to the group
52 | - service: group.set
53 | data:
54 | object_id: "studio_occupancy"
55 | add_entities: >-
56 | {{
57 | ((states.binary_sensor |
58 | selectattr('entity_id', 'in', area_entities('studio')) |
59 | rejectattr('attributes.device_class', 'undefined') |
60 | selectattr('attributes.device_class', 'search', '(occupancy|motion|door|running)') |
61 |
62 | map(attribute='entity_id') | list )) | join(',')}}
63 | # Reset group - DecK
64 | - service: group.set
65 | data:
66 | object_id: "deck_occupancy"
67 | entities: []
68 | # Add any oocupancy, motion, or door in the area to the group
69 | - service: group.set
70 | data:
71 | object_id: "deck_occupancy"
72 | add_entities: >-
73 | {{
74 | ((states.binary_sensor |
75 | selectattr('entity_id', 'in', area_entities('backyard')) |
76 | rejectattr('attributes.device_class', 'undefined') |
77 | selectattr('attributes.device_class', 'search', '(occupancy|motion|door|running)') |
78 |
79 | map(attribute='entity_id') | list )) | join(',')}}
80 | # Reset group - Skylars Bedroom
81 | - service: group.set
82 | data:
83 | object_id: "skylars_bedroom_occupancy"
84 | entities: []
85 | # Add any oocupancy, motion, or door in the area to the group
86 | - service: group.set
87 | data:
88 | object_id: "skylars_bedroom_occupancy"
89 | add_entities: >-
90 | {{
91 | ((states.binary_sensor |
92 | selectattr('entity_id', 'in', area_entities('Skylars Bedroom')) |
93 | rejectattr('attributes.device_class', 'undefined') |
94 | selectattr('attributes.device_class', 'search', '(occupancy|motion|door|running)') |
95 |
96 | map(attribute='entity_id') | list )) | join(',')}}
97 | # Reset group - Master Bedroom
98 | - service: group.set
99 | data:
100 | object_id: "master_bedroom_occupancy"
101 | entities: []
102 | # Add any oocupancy, motion, or door in the area to the group
103 | - service: group.set
104 | data:
105 | object_id: "master_bedroom_occupancy"
106 | add_entities: >-
107 | {{
108 | ((states.binary_sensor |
109 | selectattr('entity_id', 'in', area_entities('Master Bedroom')) |
110 | rejectattr('attributes.device_class', 'undefined') |
111 | selectattr('attributes.device_class', 'search', '(occupancy|motion|running)') |
112 |
113 | map(attribute='entity_id') | list )) | join(',')}}
114 | # Reset group - Pot Studio
115 | - service: group.set
116 | data:
117 | object_id: "pot_studio_occupancy"
118 | entities: []
119 | # Add any oocupancy, motion, or door in the area to the group
120 | - service: group.set
121 | data:
122 | object_id: "pot_studio_occupancy"
123 | add_entities: >-
124 | {{
125 | ((states.binary_sensor |
126 | selectattr('entity_id', 'in', area_entities('Pottery Studio')) |
127 | rejectattr('attributes.device_class', 'undefined') |
128 | selectattr('attributes.device_class', 'search', '(occupancy|motion|door|running)') |
129 |
130 | map(attribute='entity_id') | list )) | join(',')}}
131 | # Reset group - Theater
132 | - service: group.set
133 | data:
134 | object_id: "theater_occupancy"
135 | entities: []
136 | # Add any oocupancy, motion, or door in the area to the group
137 | - service: group.set
138 | data:
139 | object_id: "theater_occupancy"
140 | add_entities: >-
141 | {{
142 | ((states.binary_sensor |
143 | selectattr('entity_id', 'in', area_entities('Theater')) |
144 | rejectattr('attributes.device_class', 'undefined') |
145 | selectattr('attributes.device_class', 'search', '(occupancy|motion|running)') |
146 |
147 | map(attribute='entity_id') | list )) | join(',')}}
148 | # Reset group - Dungeon
149 | - service: group.set
150 | data:
151 | object_id: "dungeon_occupancy"
152 | entities: []
153 | # Add any oocupancy, motion, or door in the area to the group
154 | - service: group.set
155 | data:
156 | object_id: "dungeon_occupancy"
157 | add_entities: >-
158 | {{
159 | ((states.binary_sensor |
160 | selectattr('entity_id', 'in', area_entities('Dungeon')) |
161 | rejectattr('attributes.device_class', 'undefined') |
162 | selectattr('attributes.device_class', 'search', '(occupancy|motion|door|running)') |
163 |
164 | map(attribute='entity_id') | list )) | join(',')}}
165 | # Reset group - Garage
166 | - service: group.set
167 | data:
168 | object_id: "garage_occupancy"
169 | entities: []
170 | # Add any oocupancy, motion, or door in the area to the group
171 | - service: group.set
172 | data:
173 | object_id: "garage_occupancy"
174 | add_entities: >-
175 | {{
176 | ((states.binary_sensor |
177 | selectattr('entity_id', 'in', area_entities('Garage')) |
178 | rejectattr('attributes.device_class', 'undefined') |
179 | selectattr('attributes.device_class', 'search', '(occupancy|motion|door|running)') |
180 |
181 | map(attribute='entity_id') | list )) | join(',')}}
--------------------------------------------------------------------------------
/config/sensors/house.yaml:
--------------------------------------------------------------------------------
1 | - platform: history_stats
2 | name: Jeff Driving Time
3 | entity_id: binary_sensor.jeff_driving
4 | state: "on"
5 | type: time
6 | end: "{{ now() }}"
7 | duration:
8 | days: 7
9 | - platform: history_stats
10 | name: Jeff School
11 | entity_id: person.jeffrey
12 | state: "SHMES"
13 | type: count
14 | end: "{{ now() }}"
15 | duration:
16 | days: 7
17 | - platform: history_stats
18 | name: Kat Driving Time
19 | entity_id: binary_sensor.kat_driving
20 | state: "on"
21 | type: time
22 | end: "{{ now() }}"
23 | duration:
24 | days: 7
25 | - platform: history_stats
26 | name: Speech time
27 | entity_id: media_player.ha_blue
28 | state: "playing"
29 | type: time
30 | end: "{{ now() }}"
31 | duration:
32 | days: 8
33 | - platform: history_stats
34 | name: AppleTV time
35 | entity_id: media_player.home_theater
36 | state: "Playing"
37 | type: time
38 | end: "{{ now() }}"
39 | duration:
40 | hours: 24
41 | - platform: history_stats
42 | name: AppleTV time this week
43 | entity_id: media_player.home_theater
44 | state: "Playing"
45 | type: time
46 | end: "{{ now() }}"
47 | duration:
48 | days: 7
49 | - platform: history_stats
50 | name: Game time
51 | entity_id: media_player.playstation_4
52 | state: "playing"
53 | type: time
54 | end: "{{ now() }}"
55 | duration:
56 | hours: 24
57 | - platform: history_stats
58 | name: Roku time
59 | entity_id: media_player.bedroom
60 | state: "playing"
61 | type: time
62 | end: "{{ now() }}"
63 | duration:
64 | hours: 24
65 | - platform: history_stats
66 | name: Roku Theater time
67 | entity_id: media_player.roku_premiere
68 | state: "playing"
69 | type: time
70 | end: "{{ now() }}"
71 | duration:
72 | hours: 24
73 | - platform: history_stats
74 | name: Washer Time
75 | entity_id: sensor.washer_status #entity
76 | state: "running"
77 | type: time
78 | end: "{{ now() }}"
79 | duration:
80 | days: 7
81 |
82 | - platform: history_stats
83 | name: Outside Lights
84 | entity_id: group.outside_lights
85 | state: "on"
86 | type: time
87 | end: "{{ now() }}"
88 | duration:
89 | hours: 24
90 |
91 | - platform: history_stats
92 | name: Skylar Sleep Last Night
93 | entity_id: sensor.skylar_location
94 | state: "bed"
95 | type: time
96 | start: "{{ now().replace(hour=19, minute=0, second=0) - timedelta(days=1) }}"
97 | end: "{{ now() }}"
98 |
99 | - platform: statistics
100 | name: Wind Speed Stats
101 | entity_id: sensor.pirateweather_wind_speed
102 | state_characteristic: mean
103 | sampling_size: 500
104 | - platform: statistics
105 | name: "Lightning Strikes Last 20 Mins"
106 | entity_id: sensor.acurite_6045m_under_deck_strcnt
107 | state_characteristic: change
108 | max_age:
109 | minutes: 20
110 | precision: 0
111 | - platform: statistics
112 | name: Visibility Stats
113 | entity_id: sensor.nws_current_visibility
114 | state_characteristic: mean
115 | sampling_size: 500
116 | - platform: statistics
117 | name: Temperature Stats
118 | entity_id: sensor.pirateweather_temperature
119 | state_characteristic: mean
120 | sampling_size: 500
121 | - platform: statistics
122 | name: Humidity Stats
123 | entity_id: sensor.pirateweather_humidity
124 | state_characteristic: mean
125 | sampling_size: 500
126 | - platform: statistics
127 | name: Washer Power Stats
128 | entity_id: sensor.washer_switch_electric_consumption_w
129 | state_characteristic: mean
130 | max_age:
131 | days: 30
132 |
133 | - platform: template
134 | sensors:
135 | sensor_count:
136 | friendly_name: "Number of Sensors"
137 | value_template: >-
138 | {{ states.sensor | rejectattr('state', 'eq', 'unavailable') | list | count }}
139 | automation_count:
140 | friendly_name: "Number of Automations"
141 | value_template: >-
142 | {{ states.automation| rejectattr('state', 'eq', 'unavailable') | list | count }}
143 | script_count:
144 | friendly_name: "Number of Scripts"
145 | value_template: >-
146 | {{ states.script | rejectattr('state', 'eq', 'unavailable') | list | count }}
147 | binary_sensor_count:
148 | friendly_name: "Number of Binary Sensors"
149 | value_template: >-
150 | {{ states.binary_sensor | rejectattr('state', 'eq', 'unavailable') | list | count }}
151 | tracker_count:
152 | friendly_name: "Number of Devices"
153 | value_template: >-
154 | {{ states.device_tracker| rejectattr('state', 'eq', 'unavailable') | list | count }}
155 | lights_count:
156 | friendly_name: "Number of Lights"
157 | value_template: >-
158 | {{ states.light | rejectattr('state', 'eq', 'unavailable') | list | count }}
159 | switches_count:
160 | friendly_name: "Number of Switches"
161 | value_template: >-
162 | {{ states.switch | rejectattr('state', 'eq', 'unavailable') | list | count }}
163 | camera_count:
164 | friendly_name: "Number of online Cameras"
165 | value_template: >-
166 | {{ states.camera | rejectattr('state', 'eq', 'unavailable') | list | count }}
167 | entities_count:
168 | friendly_name: "Number of Entities"
169 | value_template: >-
170 | {{ states | rejectattr('state', 'eq', 'unavailable') | list | count}}
171 | na_entities_count:
172 | friendly_name: "Number of NA Entities"
173 | value_template: >-
174 | {{ states | selectattr('state', 'eq', 'unavailable') | map(attribute='entity_id') | list | count }}
175 | today_is:
176 | friendly_name: "Today is"
177 | value_template: "{{ ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'][now().weekday()] }}"
178 | month_is:
179 | friendly_name: "Month is"
180 | value_template: "{{ ['January','February','March','April','May','June','July','August','September','October','November','December'][now().month-1] }}"
181 | holiday:
182 | friendly_name: "Holiday"
183 | value_template: >-
184 | {% if is_state('calendar.holidays_in_united_states', 'on') %}
185 | {{ state_attr('calendar.holidays_in_united_states','message') }}
186 | {% elif is_state('calendar.mdl_holidays', 'on') %}
187 | {{ state_attr('calendar.mdl_holidays','message') }}
188 | {% else %}
189 | none
190 | {% endif %}
191 | nat_holiday:
192 | friendly_name: "Holiday"
193 | value_template: >-
194 | {% if is_state('calendar.national_day_calendar', 'on') %}
195 | {%- set event = state_attr('calendar.national_day_calendar','message') %}
196 | {% if 'Day' in event and 'National' in event%}
197 | {{ event }}
198 | {% endif %}
199 | {% else %}
200 | none
201 | {% endif %}
202 | # school_tomorrow:
203 | # friendly_name: "School Tomorrow"
204 | # value_template: >-
205 | # {%- set next_event=as_timestamp(state_attr('calendar.school','start_time')) | timestamp_custom("%Y-%m-%d",true) %}
206 | # {%- set tomorrow=as_timestamp(strptime(states('sensor.date'), "%Y-%m-%d") + timedelta(days=1)) | timestamp_custom("%Y-%m-%d",true) %}
207 | # {% if next_event == tomorrow %}
208 | # on
209 | # {% else %}
210 | # off
211 | # {% endif %}
212 | outside_light_time:
213 | friendly_name: "Outside Light Time"
214 | value_template: >-
215 | {% set time = (timedelta(hours=states('sensor.outside_lights')| float(0))| string) %}
216 | The outside lights were on for a total of {{time[:-6]}} hours and {{time[2:-3] | replace(":", "")}} mins in the last 24 hours.
217 | washer_run_time:
218 | friendly_name: "Weekly Washer Run Time"
219 | value_template: >-
220 | {% set time = (timedelta(hours=states('sensor.washer_time')| float(0))| string) %}
221 | the washing machine ran for a total of {{time[:-6]}} hours and {{time[2:-3] | replace(":", "") }} mins in the last Week.
222 | battery_warning:
223 | friendly_name: "Battery Warning"
224 | value_template: >-
225 | {% for state in states.sensor | selectattr('attributes.device_class', 'defined') | selectattr('attributes.device_class', 'eq', 'battery') %}
226 | {%- if 0 <= state.state | int(-1) <= 20 -%}
227 | {%- if 'Battery' in state.name or 'battery' in state.name or 'Acurite' in state.name-%}
228 | {{state.name}} - {{ state.state }}
229 | {% endif -%}
230 | {% endif -%}
231 | {% endfor %}
232 | battery_warning_count:
233 | friendly_name: "Battery Warning Count"
234 | value_template: >-
235 | {% set count = namespace(value=0) %}
236 | {% for state in states.sensor | selectattr('attributes.device_class', 'defined') | selectattr('attributes.device_class', 'eq', 'battery') %}
237 | {%- if 0 <= state.state | int(-1) <= 20 -%}
238 | {%- if 'Battery' in state.name or 'battery' in state.name or 'Acurite' in state.name-%}
239 | {% set count.value = count.value + 1 %}
240 | {% endif -%}
241 | {% endif -%}
242 | {% endfor %}
243 | {{ count.value }}
244 | skylar_sleep_last_night_tts:
245 | friendly_name: "Skylar Sleep Briefing"
246 | unique_id: skylar_sleep_last_night_tts
247 | value_template: >-
248 | {% set time = (timedelta(hours=states('sensor.skylar_sleep_last_night')| float(0))| string) %}
249 | {% set hours = time[:-6] %}
250 | {% set mins = time[2:-3] | replace(":", "") %}
251 | {% if hours | int > 1 and mins | int == 1 %}
252 | {% set timetts = hours | string + ' hours and ' + mins | string + ' minute' %}
253 | {% elif hours | int == 1 and mins | int > 0 %}
254 | {% set timetts = hours | string + ' hour and ' + mins | string + ' minutes' %}
255 | {% elif hours | int == 1 and mins | int == 0 %}
256 | {% set timetts = hours | string + ' hour' %}
257 | {% elif hours | int == 0 and mins | int > 0 %}
258 | {% set timetts = mins | string + ' minutes' %}
259 | {% elif hours | int == 0 and mins | int ==1 %}
260 | {% set timetts = mins | string + ' minute' %}
261 | {% else %}
262 | {% set timetts = hours | string + ' hours and ' + mins | string + ' minutes' %}
263 | {% endif %}
264 | {{ timetts }} of sleep last night.
265 | {% if hours | int < 5 %}
266 | {{[
267 | 'That is not enough sleep.'
268 | ] | random}}
269 | {% elif hours | int >=5 and hours | int < 7 %}
270 | {{[
271 | 'That is ok sleep.'
272 | ] | random}}
273 | But not that impressive.
274 | {% elif hours | int > 9 %}
275 | {{[
276 | 'You must have been tired!'
277 | ] | random}}
278 | {% else %}
279 | {{[
280 | 'That is a perfect amount of sleep!'
281 | ] | random}}
282 | Well done, sir.
283 | {% endif %}
284 |
285 |
--------------------------------------------------------------------------------
/config/packages/usps.yaml:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # @author : Jeffrey Stone
3 | # @date : 02/19/2019
4 | # @package : USPS
5 | # @description : Notifies us of mails and packages.
6 | # Package modified from https://github.com/skalavala/smarthome/blob/master/packages/usps.yaml
7 | ###############################################################################
8 |
9 | homeassistant:
10 | customize:
11 | sensor.usps_mail:
12 | friendly_name: USPS Mail
13 | icon: mdi:mailbox
14 | sensor.usps_packages:
15 | friendly_name: USPS Packages
16 | icon: mdi:package-variant
17 |
18 | mqtt:
19 | sensor:
20 | - name: 'USPS Mail'
21 | state_topic: 'house/usps/mails'
22 | value_template: "{{ value }}"
23 |
24 | - name: USPS Packages
25 | state_topic: 'house/usps/packages'
26 | value_template: "{{ value }}"
27 |
28 | sensor:
29 | - platform: template
30 | sensors:
31 | mail_deliveries_message:
32 | friendly_name: "Deliveries Summary"
33 | value_template: >
34 | {# Deliveries Sentence #}
35 | {% macro deliveries_sentence() -%}
36 | {%- if states("sensor.mail_usps_mail")|int == 0 -%}
37 | No
38 | {%- else -%}
39 | {{states("sensor.mail_usps_mail")|int}}
40 | {%- endif -%}
41 | {{' '}}
42 | {%- if states("sensor.mail_usps_mail")|int <= 1 -%}
43 | piece of mail
44 | {%- else -%}
45 | pieces of mail
46 | {%- endif -%}
47 | {{' '}}will be delivered.{{' '}}
48 | {%- if states("sensor.mail_usps_delivering")|int == 0 -%}
49 | No
50 | {%- else -%}
51 | {{states("sensor.mail_usps_delivering")|int}}
52 | {%- endif -%}
53 | {{' '}}
54 | {%- if states("sensor.mail_usps_delivering")|int == 1 -%}
55 | USPS package is
56 | {%- else -%}
57 | USPS packages are
58 | {%- endif -%}
59 | {{' '}}in transit.{{' '}}
60 | {%- if states("sensor.mail_fedex_delivering")|int == 0 -%}
61 | No
62 | {%- else -%}
63 | {{states("sensor.mail_fedex_delivering")|int}}
64 | {%- endif -%}
65 | {{' '}}
66 | {%- if states("sensor.mail_fedex_delivering")|int == 1 -%}
67 | FedEx package is
68 | {%- else -%}
69 | Fedex packages are
70 | {%- endif -%}
71 | {{' '}}in transit.{{' '}}
72 | {%- if states("sensor.mail_ups_delivering")|int == 0 -%}
73 | No
74 | {%- else -%}
75 | {{states("sensor.mail_ups_delivering")|int}}
76 | {%- endif -%}
77 | {{' '}}
78 | {%- if states("sensor.mail_ups_delivering")|int == 1 -%}
79 | UPS package is
80 | {%- else -%}
81 | UPS packages are
82 | {%- endif -%}
83 | {{' '}}in transit.{{' '}}
84 | {%- if states("sensor.mail_amazon_packages")|int == 0 -%}
85 | No
86 | {%- else -%}
87 | {{states("sensor.mail_amazon_packages")|int}}
88 | {%- endif -%}
89 | {{' '}}
90 | {%- if states("sensor.mail_amazon_packages")|int == 1 -%}
91 | Amazon package is
92 | {%- else -%}
93 | Amazon packages are
94 | {%- endif -%}
95 | {{' '}}in transit.{{' '}}
96 | {%- endmacro %}
97 | {{deliveries_sentence()}}
98 |
99 | camera:
100 | # - platform: generic
101 | # name: USPS Mail Pictures
102 | # still_image_url: !secret usps_camera_url
103 |
104 | - platform: local_file
105 | file_path: /config/images/mail_today.gif
106 | name: mail_usps
107 |
108 | automation:
109 |
110 | - id: update_usps_camera_path
111 | alias: "Update USPS Mail Camera"
112 | trigger:
113 | - platform: state
114 | entity_id: sensor.mail_usps_mail
115 | action:
116 | - service: local_file.update_file_path
117 | data_template:
118 | entity_id: camera.mail_usps
119 | file_path: >
120 | {% if state_attr('sensor.mail_usps_mail','image') == None %}
121 | /config/custom_components/mail_and_packages/mail_none.gif
122 | {% else %}
123 | /config/www/mail_and_packages/{{ state_attr('sensor.mail_usps_mail','image') }}
124 | {% endif %}
125 |
126 | # Notify USPS mails via TTS, and iOS notification with attachment
127 | ###############################################################################
128 | - id: notify_usps_mail
129 | alias: Notify USPS Mail
130 | initial_state: true
131 | trigger:
132 | - platform: state
133 | entity_id: sensor.usps_mail
134 | condition:
135 | - condition: template
136 | value_template: '{{ states.sensor.usps_mail.state | int > 0 }}'
137 | - condition: template
138 | value_template: '{{ ((now().hour | int) > 7) and ((now().hour | int) < 16) }}'
139 | action:
140 | - service: script.speech_engine
141 | data:
142 | message: >-
143 | {%- if states.sensor.usps_mail.state | int == 1 -%}
144 | {{ [
145 | "USPS is delivering",
146 | "The postal service will be leaving",
147 | "The nice lady in the mail truck is bringing us ",
148 | "I have scanned the incoming mail, eliminated the junk, and determined there is"
149 | ] | random }}
150 | {{ states.sensor.usps_mail.state }} piece of mail today.
151 | {%- else -%}
152 | {{ [
153 | "USPS is delivering",
154 | "The postal service will be leaving",
155 | "The nice lady in the mail truck is bringing us ",
156 | "I have scanned the incoming mail, eliminated the junk, and determined there are"
157 | ] | random }}
158 | {{ states.sensor.usps_mail.state }} pieces of mail today.
159 | {%- endif -%}
160 | - service: script.text_notify
161 | data_template:
162 | who: "jeff"
163 | title: "USPS Delivering Today"
164 | message: "USPS will be delivering {{ states.sensor.usps_mail.state }} piece(s) of mail today."
165 | # data:
166 | # push:
167 | # category: camera
168 | # entity_id: "camera.usps_mail_pictures"
169 | # attachment:
170 | # url: "{{ states.camera.usps_mail_pictures.attributes.entity_picture }}"
171 | # content-type: jpg
172 | # - service: script.twitter_notify
173 | # data_template:
174 | # message: >-
175 | # {{ [
176 | # "I just let Maison Des Lunes know how much mail the USPS is leaving in the mailbox today. For the code checkout https://github.com/thejeffreystone/usps2mqtt #automation",
177 | # "One of the things I know is how much mail is being delivered because I am integrated with USPS Informed Delivery using https://github.com/thejeffreystone/usps2mqtt #automation.",
178 | # "There is a letter in the mailbox. Or will be when the USPS gets here. If you want to know how I know checkout https://github.com/thejeffreystone/usps2mqtt #automation.",
179 | # "Neither snow nor rain nor heat nor gloom of night prevents me from letting Maison Des Lunes know what to expect from the USPS thanks to https://github.com/thejeffreystone/usps2mqtt #automation."
180 | # ] | random }}
181 |
182 | # Notify USPS packages via TTS. Usually there are no pictures for packages
183 | ###############################################################################
184 | - id: notify_usps_packages
185 | alias: Notify USPS Packages
186 | initial_state: true
187 | trigger:
188 | - platform: state
189 | entity_id: sensor.usps_mail
190 | condition:
191 | - condition: template
192 | value_template: '{{ states.sensor.usps_mail.state | int > 0 }}'
193 | - condition: template
194 | value_template: '{{ ((now().hour | int) > 7) and ((now().hour | int) < 16) }}'
195 | action:
196 | - service: script.speech_engine
197 | data_template:
198 | message: >
199 | {%- if states.sensor.usps_packages.state | int == 1 -%}
200 | USPS is delivering {{ states.sensor.usps_packages.state }} package today.
201 | {%- else -%}
202 | USPS is delivering {{ states.sensor.usps_packages.state }} packages today.
203 | {%- endif -%}
204 |
205 | - alias: "Mail Notif - Mail Delieveries"
206 | trigger:
207 | - platform: time
208 | at: '10:05:00'
209 | #Trigger if mail or packages get updated
210 | # - platform: state
211 | # entity_id: sensor.mail_usps_mail
212 | # - platform: state
213 | # entity_id: sensor.mail_usps_delivering
214 | #send only if mail or packages are more than 0
215 | condition:
216 | - condition: or
217 | conditions:
218 | - condition: template
219 | value_template: "{{ states('sensor.mail_usps_mail') | int > 0 }}"
220 | - condition: template
221 | value_template: "{{ states('sensor.mail_usps_delivering') | int > 0 }}"
222 | action:
223 | - service: script.text_notify
224 | data_template:
225 | who: "jeff"
226 | title: "Delivering Today"
227 | message: "{{ states('sensor.mail_deliveries_message')}}"
228 | - service: script.speech_engine
229 | data_template:
230 | message: >-
231 | {%- if states.sensor.mail_usps_mail.state | int == 1 -%}
232 | {{ [
233 | "USPS is delivering",
234 | "The postal service will be leaving",
235 | "The nice lady in the mail truck is bringing us ",
236 | "I have scanned the incoming mail,and there is"
237 | ] | random }}
238 | {{ states.sensor.mail_usps_mail.state }} piece of mail today.
239 | {%- else -%}
240 | {{ [
241 | "USPS is delivering",
242 | "The postal service will be leaving",
243 | "The nice lady in the mail truck is bringing us ",
244 | "I have scanned the incoming mail, and determined there are"
245 | ] | random }}
246 | {{ states.sensor.mail_usps_mail.state }} pieces of mail today.
247 | {%- endif -%}
248 |
249 |
250 | - alias: "Delivered Package Notification"
251 | initial_state: true
252 | trigger:
253 | - platform: state
254 | entity_id: sensor.mail_fedex_delivered
255 | - platform: state
256 | entity_id: sensor.mail_ups_delivered
257 | - platform: state
258 | entity_id: sensor.mail_amazon_packages_delivered
259 | #send only if mail or packages are more than 0
260 | condition:
261 | - condition: or
262 | conditions:
263 | - condition: template
264 | value_template: "{{ states('sensor.mail_fedex_delivered_2') | int > 0 }}"
265 | - condition: template
266 | value_template: "{{ states('sensor.mail_ups_delivered') | int > 0 }}"
267 | action:
268 | - service: script.text_notify
269 | data_template:
270 | who: "jeff"
271 | title: "Package Delivered"
272 | message: "Fedex/UPS just made a delivery"
273 | - service: script.speech_engine
274 | data_template:
275 | message: >-
276 | A package was just left on the porch.
--------------------------------------------------------------------------------
/config/packages/holidays.yaml:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # @author : Jeffrey Stone
3 | # @date : 02/19/2019
4 | # @package : Holidays
5 | # @description : Holiday Specific.
6 | #
7 | # I'm not sure where I got this, but it leverages a python script: https://github.com/thejeffreystone/homeassistant-config/blob/master/python_scripts/special_events.py
8 | #
9 | # To create a sensor just create an automation to fire around midnight.
10 | #
11 | # automation:
12 | # - id: refresh_holioday_sensors
13 | # alias: Refresh Holiday sensors
14 | # initial_state: true
15 | # trigger:
16 | # - platform: time
17 | # at: '00:00:07'
18 | # - platform: homeassistant
19 | # event: start
20 | # action:
21 | # - service: python_script.special_events
22 | # data:
23 | # name: Christmas
24 | # type: holiday
25 | # date: 25/12/2001
26 | #
27 | # Where Name equals the name of the event, type is the type of event, and date is the date in DD/MM/YYYY format
28 | #
29 | # Year only matters if your want to take advantage fo the years attribute which will tell you have many years since the event. Useful
30 | # with birthdays and anniversaries.
31 | #
32 | # I use the Following types:
33 | # birthday
34 | # anniversary
35 | # holiday
36 | # trip
37 | #
38 | # The type will be used in the name of the sensor it creates. For example:
39 | # sensor.trip_camping
40 | # sensor.birthday_jeff
41 | # sensor.holiday_christmas
42 | #
43 | # The state of the sensor will be the days until the event. For birthdays and anniversaries it will never be more than 365.
44 | # For example {{ states.sensor.birthday_jeff.state }} will be the number of days until my next birthday.
45 | # 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)
46 | # For events with a year in the future, the state will be number of days to that exact moment in time.
47 | #
48 | ###############################################################################
49 |
50 | input_boolean:
51 | christmas_season:
52 | name: Christmas Season
53 |
54 | template:
55 | - binary_sensor:
56 | - name: spooky_season
57 | unique_id: spooky_season_sensor
58 | state: >
59 | {% set today = now().month %}
60 | {{ today | int in [9,10] }}
61 | - name: christmas_season
62 | unique_id: christmas_season_sensor
63 | state: >
64 | {% set today = now().month %}
65 | {{ today | int in [12] }}
66 |
67 |
68 | automation:
69 | # Holiday Wishes
70 | - id: wishes_five_min
71 | alias: Wishes Five Minute
72 | initial_state: true
73 | trigger:
74 | - platform: template
75 | value_template: >
76 | {{ states('sensor.time') == (state_attr('input_datetime.christmas_preshow', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}
77 | condition:
78 | - condition: state
79 | entity_id: calendar.holidays_in_united_states
80 | state: "on"
81 | - condition: template
82 | value_template: >
83 | {%- set event=states.calendar.holidays_in_united_states.attributes.message %}
84 | {%- if event == 'Christmas Eve' %}
85 | true
86 | {%- endif -%}
87 | action:
88 | - service: script.holiday_wishes_preshow
89 |
90 | - id: wishes_show_start
91 | alias: Wishes Show Start
92 | initial_state: true
93 | trigger:
94 | - platform: template
95 | value_template: "{{ states('sensor.time') == (state_attr('input_datetime.christmas_show', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}"
96 | condition:
97 | - condition: state
98 | entity_id: calendar.holidays_in_united_states
99 | state: "on"
100 | - condition: template
101 | value_template: >
102 | {%- set event=states.calendar.holidays_in_united_states.attributes.message %}
103 | {%- if event == 'Christmas Eve' %}
104 | true
105 | {%- endif -%}
106 | action:
107 | - service: input_boolean.turn_on
108 | entity_id: input_boolean.holiday_wishes
109 |
110 |
111 | - id: e1cb2582-0423-11eb-adc1-0242ac120002
112 | alias: Mainstreet USA Christmas Loop
113 | trigger:
114 | - platform: state
115 | entity_id: input_boolean.mainstreet_usa_christmas_loop
116 | to: 'on'
117 | from: 'off'
118 | id: start
119 | - platform: state
120 | entity_id: input_boolean.mainstreet_usa_christmas_loop
121 | id: stop
122 | from: 'on'
123 | to: 'off'
124 | action:
125 | - choose:
126 | - conditions:
127 | - condition: trigger
128 | id: start
129 | sequence:
130 | - service: script.local_audio
131 | data:
132 | media: "/media/disney/MainStreetUSAChristmas.mp3"
133 | volume: .27
134 | speaker: 'media_player.ha_blue'
135 | - conditions:
136 | - condition: trigger
137 | id: stop
138 | sequence:
139 | - service: media_player.media_stop
140 | entity_id: media_player.ha_blue
141 | - service: script.turn_off
142 | entity_id: script.local_audio
143 | default: []
144 | initial_state: true
145 | mode: single
146 |
147 | - id: e1cb24ba-0423-11eb-adc1-0242ac120002
148 | alias: Epcot Christmas
149 | trigger:
150 | - platform: state
151 | entity_id: input_boolean.disneyland_christmas_loop
152 | to: 'on'
153 | from: 'off'
154 | id: start
155 | - platform: state
156 | entity_id: input_boolean.disneyland_christmas_loop
157 | id: stop
158 | from: 'on'
159 | to: 'off'
160 | action:
161 | - choose:
162 | - conditions:
163 | - condition: trigger
164 | id: start
165 | sequence:
166 | - service: script.local_audio
167 | data:
168 | media: "/media/disney/EpcotChristmas.mp3"
169 | volume: .27
170 | speaker: 'media_player.ha_blue'
171 | - conditions:
172 | - condition: trigger
173 | id: stop
174 | sequence:
175 | - service: media_player.media_stop
176 | entity_id: media_player.ha_blue
177 | - service: script.turn_off
178 | entity_id: script.local_audio
179 | default: []
180 | initial_state: true
181 | mode: single
182 |
183 | - id: e1cb2348-0423-11eb-adc1-0242ac120002
184 | alias: Disney Park Christmas Loop
185 | trigger:
186 | - platform: state
187 | entity_id: input_boolean.disney_park_christmas_loop
188 | to: 'on'
189 | from: 'off'
190 | id: start
191 | - platform: state
192 | entity_id: input_boolean.disney_park_christmas_loop
193 | id: stop
194 | from: 'on'
195 | to: 'off'
196 | action:
197 | - choose:
198 | - conditions:
199 | - condition: trigger
200 | id: start
201 | sequence:
202 | - service: script.local_audio
203 | data:
204 | media: "/media/disney/DisneyParkHoliday.mp3"
205 | volume: .27
206 | speaker: 'media_player.ha_blue'
207 | - conditions:
208 | - condition: trigger
209 | id: stop
210 | sequence:
211 | - service: media_player.media_stop
212 | entity_id: media_player.ha_blue
213 | - service: script.turn_off
214 | entity_id: script.local_audio
215 | default: []
216 | initial_state: true
217 | mode: single
218 |
219 | - id: e1cb228a-0423-11eb-adc1-0242ac120002
220 | alias: Christmas Around Disneyland
221 | trigger:
222 | - platform: state
223 | entity_id: input_boolean.christmas_around_disneyland
224 | to: 'on'
225 | from: 'off'
226 | id: start
227 | - platform: state
228 | entity_id: input_boolean.christmas_around_disneyland
229 | id: stop
230 | from: 'on'
231 | to: 'off'
232 | action:
233 | - choose:
234 | - conditions:
235 | - condition: trigger
236 | id: start
237 | sequence:
238 | - service: script.local_audio
239 | data:
240 | media: "/media/disney/ChristmasAroundDisneyland.mp3"
241 | volume: .27
242 | speaker: 'media_player.ha_blue'
243 | - conditions:
244 | - condition: trigger
245 | id: stop
246 | sequence:
247 | - service: media_player.media_stop
248 | entity_id: media_player.ha_blue
249 | - service: script.turn_off
250 | entity_id: script.local_audio
251 | default: []
252 | initial_state: true
253 | mode: single
254 |
255 | - id: e1cb21cc-0423-11eb-adc1-0242ac120002
256 | alias: Disney Springs Christmas
257 | trigger:
258 | - platform: state
259 | entity_id: input_boolean.disney_springs_xmas
260 | to: 'on'
261 | from: 'off'
262 | id: start
263 | - platform: state
264 | entity_id: input_boolean.disney_springs_xmas
265 | id: stop
266 | from: 'on'
267 | to: 'off'
268 | action:
269 | - choose:
270 | - conditions:
271 | - condition: trigger
272 | id: start
273 | sequence:
274 | - service: script.local_audio
275 | data:
276 | media: "/media/disney/Disney_Springs_Xmas_Loop.mp3"
277 | volume: .27
278 | speaker: 'media_player.ha_blue'
279 | - conditions:
280 | - condition: trigger
281 | id: stop
282 | sequence:
283 | - service: media_player.media_stop
284 | entity_id: media_player.ha_blue
285 | - service: script.turn_off
286 | entity_id: script.local_audio
287 | default: []
288 | initial_state: true
289 | mode: single
290 |
291 | - id: e1cb166e-0423-11eb-adc1-0242ac120002
292 | alias: Christmas Background
293 | trigger:
294 | - platform: state
295 | entity_id: input_boolean.christmas_background
296 | to: 'on'
297 | from: 'off'
298 | id: start
299 | - platform: state
300 | entity_id: input_boolean.christmas_background
301 | id: stop
302 | from: 'on'
303 | to: 'off'
304 | action:
305 | - choose:
306 | - conditions:
307 | - condition: trigger
308 | id: start
309 | sequence:
310 | - service: script.turn_on
311 | entity_id: script.christmas_music
312 | - conditions:
313 | - condition: trigger
314 | id: stop
315 | sequence:
316 | - service: media_player.media_stop
317 | entity_id: media_player.ha_blue
318 | - service: script.turn_off
319 | entity_id: script.local_audio
320 | - service: script.turn_off
321 | entity_id: script.christmas_music
322 | default: []
323 | initial_state: true
324 | mode: single
325 |
326 |
327 | sensor:
328 | - platform: rest
329 | name: Halloween Countdown
330 | resource: !secret WA_HALLOWEEN
331 | value_template: "{{ (value|replace(' days', '')) | int }}"
332 | unit_of_measurement: Days
333 | scan_interval: 43200
334 |
335 | - platform: rest
336 | name: Christmas Countdown
337 | resource: !secret WA_XMAS
338 | value_template: "{{ (value|replace(' days', '')) | int }}"
339 | unit_of_measurement: Days
340 | scan_interval: 43200
341 |
342 |
343 | script:
344 | christmas_music:
345 | sequence:
346 | - service: script.local_audio
347 | data:
348 | media: "/media/disney/DisneyParkHoliday.mp3"
349 | volume: .27
350 | speaker: 'media_player.ha_blue'
351 | - delay: 02:50:00
352 | - service: script.local_audio
353 | data:
354 | media: "/media/disney/ChristmasAroundDisneyland.mp3"
355 | volume: .27
356 | speaker: 'media_player.ha_blue'
357 | - delay: 04:02:00
358 | - service: script.local_audio
359 | data:
360 | media: "/media/disney/EpcotChristmas.mp3"
361 | volume: .27
362 | speaker: 'media_player.ha_blue'
363 | normal_xmas:
364 | sequence:
365 | - service: light.turn_on
366 | target:
367 | entity_id: light.wled_tree
368 | data:
369 | effect: "Solid"
370 | brightness: 51
371 | - service: input_number.set_value
372 | target:
373 | entity_id: number.wled_tree_intensity
374 | data:
375 | value: 255
376 | - service: select.select_option
377 | target:
378 | entity_id: select.wled_tree_color_palette
379 | data:
380 | option: 'Color 1'
381 | sparkle_xmas:
382 | sequence:
383 | - service: light.turn_on
384 | target:
385 | entity_id: light.wled_tree
386 | data:
387 | effect: "Candle Multi"
388 | brightness: 13
389 | - service: input_number.set_value
390 | target:
391 | entity_id: number.wled_tree_intensity
392 | data:
393 | value: 75
394 | - service: select.select_option
395 | target:
396 | entity_id: select.wled_tree_color_palette
397 | data:
398 | option: 'Color 1'
399 | fireworks1d_xmas:
400 | sequence:
401 | - service: light.turn_on
402 | target:
403 | entity_id: light.wled_tree
404 | data:
405 | effect: "Fireworks 1D"
406 | brightness: 51
407 | - service: input_number.set_value
408 | target:
409 | entity_id: number.wled_tree_intensity
410 | data:
411 | value: 51
412 | - service: select.select_option
413 | target:
414 | entity_id: select.wled_tree_color_palette
415 | data:
416 | option: 'C9 New'
417 | blends_xmas:
418 | sequence:
419 | - service: light.turn_on
420 | target:
421 | entity_id: light.wled_tree
422 | data:
423 | effect: "Blends"
424 | brightness: 43
425 | - service: input_number.set_value
426 | target:
427 | entity_id: number.wled_tree_intensity
428 | data:
429 | value: 43
430 | - service: select.select_option
431 | target:
432 | entity_id: select.wled_tree_color_palette
433 | data:
434 | option: 'C9 New'
435 | aurora_xmas:
436 | sequence:
437 | - service: light.turn_on
438 | target:
439 | entity_id: light.wled_tree
440 | data:
441 | effect: "Aurora"
442 | brightness: 255
443 | - service: input_number.set_value
444 | target:
445 | entity_id: number.wled_tree_intensity
446 | data:
447 | value: 128
448 | - service: select.select_option
449 | target:
450 | entity_id: select.wled_tree_color_palette
451 | data:
452 | option: 'C9 New'
453 | twinklefox_xmas:
454 | sequence:
455 | - service: light.turn_on
456 | target:
457 | entity_id: light.wled_tree
458 | data:
459 | effect: "Twinklefox"
460 | brightness: 127
461 | - service: input_number.set_value
462 | target:
463 | entity_id: number.wled_tree_intensity
464 | data:
465 | value: 128
466 | - service: select.wled_tree_color_palette
467 | target:
468 | entity_id: light.wled_tree
469 | data:
470 | option: 'C9 New'
471 |
472 |
--------------------------------------------------------------------------------
/config/packages/audio.yaml:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # @author : Jeffrey Stone
3 | # @date : 04/11/2020
4 | # @package : Audio
5 | # @description : Audio related configuration.
6 | # @notes : This package assumes you are running version .115.0 or greater.
7 | #
8 | ###############################################################################
9 |
10 |
11 | ################################
12 | # Media Player section for any media players you want to define. Most of these are setup via the integrations flow in the UI,
13 | # but if not you may need to modify the following section.
14 | # For more info on Media Players visit https://www.home-assistant.io/integrations/media_player/
15 | # MODIFY this section as needed or comment it out completely if not needed.
16 | # media_player:
17 | # - platform: yamaha
18 | # host: 192.168.7.152
19 |
20 | ################################
21 | # Media extractor is used for playing youtube audio. For more info ->https://www.home-assistant.io/integrations/media_extractor/
22 | #
23 | # If you have this enabled in another package or in your configuration.yaml comment out the line below
24 | media_extractor:
25 |
26 |
27 | ############################
28 | # input_datetime (https://www.home-assistant.io/integrations/input_datetime/)
29 | #
30 | # This is simply so we can track last called alexa.
31 | input_datetime:
32 | last_time_alexa_called:
33 | name: Last Time Alexa Called
34 | has_date: true
35 | has_time: true
36 |
37 |
38 | ################################
39 | # Scripts to handle audio
40 | script:
41 |
42 | ################################
43 | # local_audio is meant to be used to play audio in your media folder. (https://www.home-assistant.io/integrations/media_source/)
44 | #
45 | # Before using make sure you update as needed.
46 | #
47 | # To call this using in the action section of your automation:
48 | #
49 | # - service: script.local_audio
50 | # data:
51 | # speaker: main
52 | # volume: .3
53 | # media: /media/local_audio.mp3
54 | #
55 | local_audio:
56 | sequence:
57 | # Ensure that audible notifications are allowed. Comment out if not needed.
58 | - condition: state
59 | entity_id: input_boolean.audible_notifications
60 | state: 'on'
61 | # Ensure the family is home. If you are using a group to track the family, or a person just update as needed. Comment out if not needed.
62 | - condition: state
63 | entity_id: binary_sensor.family_home
64 | state: 'on'
65 | # This sets the voume via a parameter when the script is called, and should be a value between .1 and 1.0
66 | - service: media_player.volume_set
67 | data:
68 | entity_id: >
69 | {% set who = speaker %}
70 | {% if who == 'kitchen' %}
71 | media_player.kitchen_display
72 | {% elif who == 'theater' %}
73 | media_player.theater_speaker
74 | {% elif who == 'croft' %}
75 | media_player.croft_speaker
76 | {% elif who in ['skylar_bedroom', 'skylars_bedroom'] %}
77 | media_player.skylars_bedroom_speaker
78 | {% elif who == 'master_bedroom' %}
79 | media_player.master_bedroom_speaker
80 | {% elif who in ['studio', 'studio_speaker', 'media_player.studio_speaker'] %}
81 | media_player.studio_speaker
82 | {% elif who == 'main' %}
83 | media_player.ha_blue
84 | {% else %}
85 | {% if states.input_boolean.audible_notifications.state == 'on' %}
86 | media_player.ha_blue
87 | {% else %}
88 | media_player.kitchen_display
89 | {% endif %}
90 | {% endif %}
91 | volume_level: >
92 | {{ volume }}
93 | - delay: 00:00:05
94 | # This tells it to play the media and is set when the script is called.
95 | - service: media_player.play_media
96 | data:
97 | entity_id: >
98 | {% set who = speaker %}
99 | {% if who == 'kitchen' %}
100 | media_player.kitchen_display
101 | {% elif who == 'theater' %}
102 | media_player.theater_speaker
103 | {% elif who == 'croft' %}
104 | media_player.croft_speaker
105 | {% elif who in ['skylar_bedroom', 'skylars_bedroom'] %}
106 | media_player.skylars_bedroom_speaker
107 | {% elif who == 'master_bedroom' %}
108 | media_player.master_bedroom_speaker
109 | {% elif who in ['studio', 'studio_speaker', 'media_player.studio_speaker'] %}
110 | media_player.studio_speaker
111 | {% elif who == 'main' %}
112 | media_player.ha_blue
113 | {% else %}
114 | {% if states.input_boolean.audible_notifications.state == 'on' %}
115 | media_player.ha_blue
116 | {% else %}
117 | media_player.kitchen_display
118 | {% endif %}
119 | {% endif %}
120 | media_content_type: "music"
121 | media_content_id: >
122 | {{ media }}
123 |
124 |
125 | ################################
126 | # youtube_audio is meant to be used to play audio from well youtube.
127 | # This scrtip requires the media_extractor integration.
128 | #
129 | # Before using make sure you update as needed.
130 | #
131 | # To call this using in the action section of your automation:
132 | #
133 | # - service: script.youtube_audio
134 | # data:
135 | # speaker: main
136 | # volume: .5
137 | # media: https://www.youtube.com/watch?v=pVeX4C9B1Lk
138 | #
139 | youtube_audio:
140 | sequence:
141 | # Ensure that audible notifications are allowed. Comment out if not needed.
142 | - condition: state
143 | entity_id: input_boolean.audible_notifications
144 | state: 'on'
145 | # Ensure the family is home. If you are using a group to track the family, or a person just update as needed. Comment out if not needed.
146 | - condition: state
147 | entity_id: binary_sensor.family_home
148 | state: 'on'
149 | # This sets the voume via a parameter when the script is called, and should be a value between .1 and 1.0
150 | - service: media_player.volume_set
151 | data:
152 | entity_id: >
153 | {% set who = speaker %}
154 | {% if who == 'kitchen' %}
155 | media_player.kitchen_display
156 | {% elif who == 'theater' %}
157 | media_player.theater_speaker
158 | {% elif who == 'croft' %}
159 | media_player.croft_speaker
160 | {% elif who in ['skylar_bedroom', 'skylars_bedroom'] %}
161 | media_player.skylars_bedroom_speaker
162 | {% elif who == 'master_bedroom' %}
163 | media_player.master_bedroom_speaker
164 | {% elif who in ['studio', 'studio_speaker', 'media_player.studio_speaker'] %}
165 | media_player.studio_speaker
166 | {% elif who == 'main' %}
167 | media_player.ha_blue
168 | {% else %}
169 | {% if states.input_boolean.audible_notifications.state == 'on' %}
170 | media_player.ha_blue
171 | {% else %}
172 | media_player.kitchen_display
173 | {% endif %}
174 | {% endif %}
175 | volume_level: >
176 | {{ volume }}
177 | # This tells it to play the media and is set when the script is called.
178 | # media_content_type: video/Youtube
179 | - service: media_extractor.play_media
180 | data:
181 | entity_id: >
182 | {% set who = speaker %}
183 | {% if who == 'kitchen' %}
184 | media_player.kitchen_display
185 | {% elif who == 'theater' %}
186 | media_player.theater_speaker
187 | {% elif who == 'croft' %}
188 | media_player.croft_speaker
189 | {% elif who in ['skylar_bedroom', 'skylars_bedroom'] %}
190 | media_player.skylars_bedroom_speaker
191 | {% elif who == 'master_bedroom' %}
192 | media_player.master_bedroom_speaker
193 | {% elif who in ['studio', 'studio_speaker', 'media_player.studio_speaker'] %}
194 | media_player.studio_speaker
195 | {% elif who == 'main' %}
196 | media_player.ha_blue
197 | {% else %}
198 | {% if states.input_boolean.audible_notifications.state == 'on' %}
199 | media_player.ha_blue
200 | {% else %}
201 | media_player.kitchen_display
202 | {% endif %}
203 | {% endif %}
204 | media_content_type: music
205 | media_content_id: >
206 | {{ media }}
207 |
208 | bedtime_music_echo:
209 | sequence:
210 | - service: media_player.volume_set
211 | data:
212 | entity_id:
213 | - media_player.skylars_bedroom_speaker
214 | - media_player.skylars_echo
215 | volume_level: >
216 | {{ states('input_number.skylar_room_notification_volume') | float}}
217 | - service: media_player.play_media
218 | target:
219 | entity_id: media_player.skylars_room
220 | data:
221 | media_content_id: bedtime music on
222 | media_content_type: routine
223 |
224 | wakeup_music_echo:
225 | sequence:
226 | - variables:
227 | message: >
228 | {{[
229 | 'It seems you are still in bed. Very well.',
230 | 'Perhaps this will help get you moving.',
231 | 'Wait. Why are you not moving yet? Very well. Time for some music.',
232 | 'Initiating your wakeup music.'
233 | ] | random }}
234 | - service: script.cleanup_text
235 | data:
236 | message: >
237 | {{ message }}
238 | response_variable: "cleaned_briefing"
239 | - service: media_player.volume_set
240 | data:
241 | entity_id:
242 | - media_player.skylars_bedroom_speaker
243 | - media_player.skylars_echo
244 | volume_level: >
245 | {{ states('input_number.skylar_room_notification_volume') | float}}
246 | - service: script.speech_engine
247 | data:
248 | who: skylars_bedroom
249 | type: priority
250 | message: >
251 | {{ cleaned_briefing.text }}
252 | - service: media_player.volume_set
253 | data:
254 | entity_id:
255 | - media_player.skylars_bedroom_speaker
256 | - media_player.skylars_echo
257 | volume_level: .5
258 | - delay:
259 | seconds: 10
260 | - service: media_player.play_media
261 | target:
262 | entity_id: media_player.skylars_room
263 | data:
264 | media_content_id: wake up Skylar
265 | media_content_type: routine
266 |
267 | adjust_audio:
268 | sequence:
269 | - choose:
270 | - conditions:
271 | - condition: state
272 | entity_id: input_boolean.disney_background
273 | state: 'on'
274 | - condition: state
275 | entity_id: media_player.home_theater
276 | state: 'playing'
277 | sequence:
278 | - service: input_boolean.turn_off
279 | entity_id: input_boolean.disney_background
280 | - conditions:
281 | - condition: state
282 | entity_id: input_boolean.disney_background
283 | state: 'off'
284 | - condition: state
285 | entity_id: media_player.home_theater
286 | state: 'standy'
287 | - condition: time
288 | after: "07:00:00"
289 | before: "19:00:00"
290 | weekday:
291 | - sat
292 | - sun
293 | sequence:
294 | - service: input_boolean.turn_on
295 | entity_id: input_boolean.disney_background
296 | default: []
297 |
298 | mqtt:
299 | sensor:
300 | - name: "Room Presence"
301 | state_topic: "house/presence/current_room"
302 | - name: "Presence Source"
303 | state_topic: "house/presence/source"
304 |
305 | template:
306 | - sensor:
307 | # - name: room_audio
308 | # state: >-
309 | # {% if is_state('input_boolean.audible_notifications', 'on') %}
310 | # {% if expand('group.rooms')
311 | # | selectattr('state', 'eq', 'on') | list | count >= 1 %}
312 | # {% set sensor_ro = expand('group.rooms')
313 | # | selectattr('state', 'eq', 'on')
314 | # | sort(attribute='last_changed') | last %}
315 | # {% endif %}
316 | # {% if sensor_ro is defined and
317 | # ((as_timestamp(now()) - (as_timestamp(sensor_ro.last_changed)) | float ) % 3600)
318 | # | round(0) <= states('input_number.presence_threshold') | float %}
319 | # {{ sensor_ro.name.replace('_occupied','') }}
320 | # {% elif expand('group.room_presence')
321 | # | rejectattr('state', 'eq', 'NA')
322 | # | sort(attribute='last_changed') | list | count >=1 %}
323 | # {% set sensor_rp = expand('group.room_presence')
324 | # | rejectattr('state', 'eq', 'NA')
325 | # | sort(attribute='last_changed') | last %}
326 | # {% if sensor_rp is defined %}
327 | # {{ sensor_rp.state }}
328 | # {% endif %}
329 | # {% elif sensor_ro is defined %}
330 | # {{ sensor_ro.name.replace('_occupied','') }}
331 | # {% else -%}
332 | # main
333 | # {%- endif -%}
334 | # {% else %}
335 | # {%- if expand('group.rooms')
336 | # | rejectattr('name', 'search', 'NA|bedroom')
337 | # | selectattr('state', 'eq', 'on') | list | count >= 1 -%}
338 | # {%- set sensor_ro = expand('group.rooms')
339 | # | rejectattr('name', 'search', 'NA|bedroom')
340 | # | selectattr('state', 'eq', 'on')
341 | # | sort(attribute='last_changed') | last -%}
342 | # {%- endif -%}
343 | # {%- if sensor_ro is defined and
344 | # ((as_timestamp(now()) - (as_timestamp(sensor_ro.last_changed)) | float ) % 3600)
345 | # | round(0) <= states('input_number.presence_threshold') | float -%}
346 | # {{ sensor_ro.name.replace('_occupied','') }}
347 | # {%- elif expand('group.room_presence')
348 | # | rejectattr('state', 'search', 'NA|bedroom')
349 | # | sort(attribute='last_changed') | list | count >=1 -%}
350 | # {%- set sensor_rp = expand('group.room_presence')
351 | # | rejectattr('state', 'search', 'NA|bedroom')
352 | # | sort(attribute='last_changed') | last %}
353 | # {%- if sensor_rp is defined %}
354 | # {{ sensor_rp.state }}
355 | # {%- endif %}
356 | # {%- elif sensor_ro is defined -%}
357 | # {{ sensor_ro.name.replace('_occupied','') }}
358 | # {%- else -%}
359 | # main
360 | # {%- endif %}
361 | # {%- endif %}
362 | # attributes:
363 | # presence_source: 'NA'
364 | - name: alexa_audio
365 | state: >-
366 | {%- if is_state('sensor.last_alexa', 'media_player.living_room_echo') %}
367 | living_room
368 | {% elif is_state('sensor.last_alexa', 'media_player.kitchen_echo') %}
369 | kitchen
370 | {% elif is_state('sensor.last_alexa', 'media_player.skylar_s_bedroom') %}
371 | skylar_bedroom
372 | {% elif is_state('sensor.last_alexa', 'media_player.dads_desk') %}
373 | master_bedroom
374 | {% else %}
375 | main
376 | {%- endif %}
377 | - name: last_alexa
378 | state: >
379 | {{ expand('group.all_echos') | selectattr('attributes.last_called','eq',True) | map(attribute='entity_id') | first }}
380 |
--------------------------------------------------------------------------------
/config/packages/halloween.yaml:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # @author : Jeffrey Stone
3 | # @date : 09/25/2020
4 | # @package : Halloween
5 | # @description : Config used to cause a haunting
6 | #
7 | # This package requires that you have some way to determine thats its Halloween
8 | # You can do this in any way you want, but two options are:
9 | #
10 | # 1. Enable the Google Calendar (https://www.home-assistant.io/integrations/calendar.google/) and setup a Holiday Calendar
11 | # 2. Use Wolfram Alpha to create a sensor that tells you how many days until Halloween. I have one at the bottom of this package.
12 | # @CCOSTAN did a video on setting it up -> https://www.youtube.com/watch?_continue=0time&v=ulBeifhWBxY&feature=emb_logo
13 | #
14 | ###############################################################################
15 | # Here is a lovelace card that can be used with this package:
16 | # type: entities
17 | # entities:
18 | # - entity: sensor.halloween_countdown
19 | # icon: 'mdi:ghost'
20 | # - entity: automation.this_is_halloween
21 | # - entity: input_boolean.this_is_halloween
22 | # - entity: input_datetime.halloween_show
23 | # - entity: input_boolean.haunted_sounds
24 | # - entity: input_boolean.scary_sounds
25 | # title: Halloween
26 | # show_header_toggle: false
27 | # state_color: true
28 | ###############################################################################
29 |
30 |
31 | ############################
32 | # input_booleans (https://www.home-assistant.io/integrations/input_boolean/)
33 | #
34 | input_boolean:
35 | # Main switch for the effects. This acts as both the on switch and the kill switch
36 | this_is_halloween:
37 | name: This is Halloween
38 | # Enables Haunted Sounds. If on, basic haunted house effect happens
39 | haunted_sounds:
40 | name: Haunted Sounds
41 | # Enables More Intense Haunted Sounds. If on, scarier haunted house effect happens
42 | scary_sounds:
43 | name: Intense Hauntings
44 |
45 |
46 | ############################
47 | # input_datetime (https://www.home-assistant.io/integrations/input_datetime/)
48 | #
49 | # This is simply so we can schedule the time the effect happens in the UI.
50 | input_datetime:
51 | halloween_show:
52 | name: Halloween Show
53 | has_date: true
54 | has_time: true
55 |
56 | ################################
57 | # Media extractor is used for playing youtube audio. For more info ->https://www.home-assistant.io/integrations/media_extractor/
58 | #
59 | # If you have this enabled in another package or in your configuration.yaml comment out the line below
60 | #media_extractor:
61 |
62 | ############################
63 | # Automations (https://www.home-assistant.io/integrations/automation/)
64 | #
65 | automation:
66 |
67 | # This is Main Halloween Trigger. The purpose of this is to turn on the show at the time set in the input_datetime.halloween_show.
68 | #
69 | - id: this_is_halloween
70 | alias: This is Halloween
71 | initial_state: true
72 | trigger:
73 | # When the current time matches input_datetime.halloween_show, light this candle
74 | - platform: time
75 | at: input_datetime.halloween_show
76 | action:
77 | - service: input_boolean.turn_on
78 | entity_id: input_boolean.this_is_halloween
79 | - delay: '02:00:00'
80 | - service: input_boolean.turn_off
81 | entity_id: input_boolean.this_is_halloween
82 |
83 |
84 |
85 | - id: operation haunted house
86 | alias: Operation Haunted House
87 | trigger:
88 | # If this_is_halloween switch is turned on then we start the show.
89 | - platform: state
90 | entity_id: input_boolean.this_is_halloween
91 | to: 'on'
92 | from: 'off'
93 | id: start
94 | # If this_is_halloween switch is turned off then we stop the show.
95 | - platform: state
96 | entity_id: input_boolean.this_is_halloween
97 | id: stop
98 | from: 'on'
99 | to: 'off'
100 | action:
101 | # Choose provides decision logic
102 | - choose:
103 | # Start the show
104 | - conditions:
105 | - condition: trigger
106 | id: start
107 | sequence:
108 | - service: script.local_audio
109 | data:
110 | media: "/media/haunted_sounds/This_is_Halloween.mp3"
111 | volume: .4
112 | speaker: 'media_player.ha_blue'
113 | - delay: '00:04:00'
114 | - service: script.turn_on
115 | target:
116 | entity_id: script.haunted_house
117 | # Stop the show
118 | - conditions:
119 | - condition: trigger
120 | id: stop
121 | sequence:
122 | # And finally we turn off the haunted house script so no more sounds play.
123 | - service: script.turn_off
124 | target:
125 | entity_id: script.haunted_house
126 | - service: scene.turn_on
127 | target:
128 | entity_id: scene.before_haunting
129 | default: []
130 | initial_state: true
131 | mode: single
132 |
133 |
134 | script:
135 |
136 | # This is where the magic happens. This is the script that handles all the haunted sounds.
137 | #
138 | haunted_house:
139 | sequence:
140 | - repeat:
141 | while:
142 | - condition: state
143 | entity_id: input_boolean.this_is_halloween
144 | state: 'on'
145 | sequence:
146 | # Take a snap shot of current state
147 | # - service: scene.create
148 | # data:
149 | # scene_id: before_haunting
150 | # snapshot_entities:
151 | # - light.front_door_lamp
152 | # - light.living_room_lamp
153 | # - light.living_room_tower_lamp
154 | # - light.skylars_dresser_lamp
155 | # - light.kitchen_sink
156 | # - light.jeff_lamp
157 | # # Change a random Random Light
158 | # - service: light.toggle
159 | # data:
160 | # entity_id: >
161 | # {{['light.front_door_lamp',
162 | # 'light.living_room_lamp',
163 | # 'light.living_room_tower_lamp',
164 | # 'light.skylars_dresser_lamp',
165 | # 'light.kitchen_sink',
166 | # 'light.master_bedroom_tower_lamp',
167 | # 'light.jeff_lamp']
168 | # | random}}
169 | # Start playing a random selection from our haunted sounds.
170 | - service: script.haunted_sounds
171 | # Then another delay. This one is a random delay between 2 and 5 minutes. A delay of at least 2 minutes ensures the previous effect is done before the next one.
172 | - delay: '00:0{{ range(2,5) | random | int }}:00'
173 | # After the delay, change the state of the lights back to what they were
174 | - service: scene.turn_on
175 | target:
176 | entity_id: scene.before_haunting
177 | # play more random haunted sounds. This time though, if we have scary sounds on we play one from there, if not, back to haunted sounds.
178 | - service: >
179 | {% if is_state('input_boolean.scary_sounds', 'on') %}
180 | script.more_haunted_sounds
181 | {% else %}
182 | script.haunted_sounds
183 | {% endif %}
184 | # Then delay again, and when that is done start over.
185 | - delay: '00:0{{ range(2,5) | random | int }}:00'
186 |
187 |
188 | # Update this script with your youtube sounds.
189 | # Each time this script is called it will play a random sound
190 | more_haunted_sounds:
191 | sequence:
192 | - service: script.youtube_audio # This script is in the audio.yaml in the packages folder.
193 | data:
194 | speaker: >
195 | {{ ['media_player.kitchen_display',
196 | 'media_player.master_bedroom_speaker',
197 | 'media_player.studio_speaker',
198 | 'media_player.ha_blue',
199 | 'media_player.skylars_bedroom_speaker',
200 | 'media_player.theater_speaker'
201 | ] | random }}
202 | volume: .4
203 | # I try to ensure each of the following links is 60 seconds or less.
204 | media: >
205 | {{- [
206 | "https://www.youtube.com/watch?v=-s04sbIViJQ",
207 | "https://www.youtube.com/watch?v=vF681VBX_oo",
208 | "https://www.youtube.com/watch?v=WQVnOSj8DWI",
209 | "https://www.youtube.com/watch?v=DaOnw_kCcYU",
210 | "https://www.youtube.com/watch?v=E9VFB_0nSbA",
211 | "https://www.youtube.com/watch?v=_A1yK0YU6U0",
212 | "https://www.youtube.com/watch?v=AQ1SE4tLICg",
213 | "https://www.youtube.com/watch?v=SsVj21c9isA",
214 | "https://www.youtube.com/watch?v=nKltUaCxZPc",
215 | "https://www.youtube.com/watch?v=G3JlB47fzV4",
216 | "https://www.youtube.com/watch?v=_24O4vb-KWk",
217 | "https://www.youtube.com/watch?v=oeLcHIpTlHU"
218 | ] | random -}}
219 |
220 |
221 | #Update this script with your local sounds.
222 | #Each time this script is called it will play a random sound
223 | haunted_sounds:
224 | sequence:
225 | # Ensure that haunted sounds are allowed. Comment out if not needed.
226 | - condition: state
227 | entity_id: input_boolean.haunted_sounds
228 | state: 'on'
229 | - service: script.local_audio # This script is in the audio.yaml in the packages folder.
230 | data:
231 | speaker: >
232 | {{ ['media_player.kitchen_display',
233 | 'media_player.master_bedroom_speaker',
234 | 'media_player.studio_speaker',
235 | 'media_player.ha_blue',
236 | 'media_player.skylars_bedroom_speaker',
237 | 'media_player.theater_speaker'
238 | ] | random }}
239 | volume: .4
240 | # I try to ensure each of the following links is 60 seconds or less.
241 | media: >
242 | {{- [
243 | "/media/haunted_sounds/haunted_guest_welcome.mp3",
244 | "/media/haunted_sounds/ChainsRattling.mp3",
245 | "/media/haunted_sounds/CreakingDoorSpooky.mp3",
246 | "/media/haunted_sounds/DemonHaunting.mp3",
247 | "/media/haunted_sounds/Evil_Laugh_2.mp3",
248 | "/media/haunted_sounds/Evillaugh.mp3",
249 | "/media/haunted_sounds/Scary.mp3",
250 | "/media/haunted_sounds/raven.mp3",
251 | "/media/haunted_sounds/EvilLaughCackle.mp3",
252 | "/media/haunted_sounds/Haunted-CatScream.mp3",
253 | "/media/haunted_sounds/Haunted-DragonRoaring.mp3",
254 | "/media/haunted_sounds/Haunted-Heart.mp3",
255 | "/media/haunted_sounds/Haunted-ScaryScream.mp3",
256 | "/media/haunted_sounds/Haunted-TRexRoar.mp3",
257 | "/media/haunted_sounds/Haunted-TollingBell.mp3",
258 | "/media/haunted_sounds/Haunted-Vocals.mp3"
259 | ] | random -}}
260 |
261 | # haunted_sounds_git:
262 | # sequence:
263 | # # Ensure that haunted sounds are allowed. Comment out if not needed.
264 | # - condition: state
265 | # entity_id: input_boolean.haunted_sounds
266 | # state: 'on'
267 | # - service: script.youtube_audio # This script is in the audio.yaml in the packages folder.
268 | # data:
269 | # speaker: >
270 | # {{ ['media_player.kitchen_display',
271 | # 'media_player.upstairs_speaker',
272 | # 'media_player.master_bedroom_speaker',
273 | # 'media_player.croft_speaker',
274 | # 'media_player.ha_blue',
275 | # 'media_player.skylars_bedroom_speaker',
276 | # 'media_player.theater'
277 | # ] | random }}
278 | # volume: .5
279 | # # I try to ensure each of the following links is 60 seconds or less.
280 | # media: >
281 | # {{ [
282 | # 'https://raw.githubusercontent.com/thejeffreystone/home-assistant-configuration/master/config/media/haunted_sounds/EvilLaughCackle.mp3'.
283 | # 'https://raw.githubusercontent.com/thejeffreystone/home-assistant-configuration/master/config/media/haunted_sounds/ChainsRattling.mp3',
284 | # 'https://raw.githubusercontent.com/thejeffreystone/home-assistant-configuration/master/config/media/haunted_sounds/CreakingDoorSpooky.mp3',
285 | # 'https://raw.githubusercontent.com/thejeffreystone/home-assistant-configuration/master/config/media/haunted_sounds/Evil_Laugh_2.mp3',
286 | # 'https://raw.githubusercontent.com/thejeffreystone/home-assistant-configuration/master/config/media/haunted_sounds/Evillaugh.mp3',
287 | # 'https://raw.githubusercontent.com/thejeffreystone/home-assistant-configuration/master/config/media/haunted_sounds/Haunted-CatScream.mp3',
288 | # 'https://raw.githubusercontent.com/thejeffreystone/home-assistant-configuration/master/config/media/haunted_sounds/Haunted-DragonRoaring.mp3',
289 | # 'https://raw.githubusercontent.com/thejeffreystone/home-assistant-configuration/master/config/media/haunted_sounds/Haunted-Heart.mp3',
290 | # 'https://raw.githubusercontent.com/thejeffreystone/home-assistant-configuration/master/config/media/haunted_sounds/Haunted-ScaryScream.mp3',
291 | # 'https://raw.githubusercontent.com/thejeffreystone/home-assistant-configuration/master/config/media/haunted_sounds/Haunted-TollingBell.mp3',
292 | # 'https://raw.githubusercontent.com/thejeffreystone/home-assistant-configuration/master/config/media/haunted_sounds/Scary.mp3',
293 | # 'https://raw.githubusercontent.com/thejeffreystone/home-assistant-configuration/master/config/media/haunted_sounds/raven.mp3'
294 | # ] | random }}
295 |
296 |
297 | ################################
298 | # local_audio is meant to be used to play audio in your media folder. (https://www.home-assistant.io/integrations/media_source/)
299 | #
300 | # Before using make sure you update as needed.
301 | #
302 | # To call this using in the action section of your automation:
303 | #
304 | # - service: script.local_audio
305 | # data:
306 | # speaker: media_player.ha_blue
307 | # volume: .5
308 | # media: /media/local_audio.mp3
309 | #
310 | # local_audio:
311 | # sequence:
312 | # # Ensure that audible notifications are allowed. Comment out if not needed.
313 | # - condition: state
314 | # entity_id: input_boolean.audible_notifications
315 | # state: 'on'
316 | # # Ensure the family is home. If you are using a group to track the family, or a person just update as needed. Comment out if not needed.
317 | # - condition: state
318 | # entity_id: binary_sensor.family_home
319 | # state: "on"
320 | # # Update the media player with the one you want to use
321 | # - service: media_player.turn_on
322 | # data:
323 | # entity_id: >
324 | # {{ speaker }}
325 | # # This sets the voume via a parameter when the script is called, and should be a value between .1 and 1.0
326 | # - service: media_player.volume_set
327 | # data:
328 | # entity_id: >
329 | # {{ speaker }}
330 | # volume_level: >
331 | # {{ volume }}
332 | # - delay: 00:00:05
333 | # # This tells it to play the media and is set when the script is called.
334 | # - service: media_player.play_media
335 | # data:
336 | # entity_id: >
337 | # {{ speaker }}
338 | # media_content_type: "music"
339 | # media_content_id: >
340 | # {{ media }}
341 |
342 |
343 | ################################
344 | # youtube_audio is meant to be used to play audio from well youtube.
345 | # This scrtip requires the media_extractor integration.
346 | #
347 | # Before using make sure you update as needed.
348 | #
349 | # To call this using in the action section of your automation:
350 | #
351 | # - service: script.youtube_audio
352 | # data:
353 | # speaker: media_player.ha_blue
354 | # volume: .5
355 | # media: https://www.youtube.com/watch?v=pVeX4C9B1Lk
356 | #
357 | # youtube_audio:
358 | # sequence:
359 | # # Ensure that audible notifications are allowed. Comment out if not needed.
360 | # - condition: state
361 | # entity_id: input_boolean.audible_notifications
362 | # state: 'on'
363 | # # Ensure the family is home. If you are using a group to track the family, or a person just update as needed. Comment out if not needed.
364 | # - condition: state
365 | # entity_id: binary_sensor.family_home
366 | # state: "on"
367 | # # Update the media player with the one you want to use
368 | # - service: media_player.turn_on
369 | # data:
370 | # entity_id: >
371 | # {{ speaker }}
372 | # # This sets the voume via a parameter when the script is called, and should be a value between .1 and 1.0
373 | # - service: media_player.volume_set
374 | # data:
375 | # entity_id: >
376 | # {{ speaker }}
377 | # volume_level: >
378 | # {{ volume }}
379 | # # This tells it to play the media and is set when the script is called.
380 | # - service: media_extractor.play_media
381 | # data:
382 | # entity_id: >
383 | # {{ speaker }}
384 | # media_content_type: video/youtube
385 | # media_content_id: >
386 | # {{ media }}
387 |
388 | # sensor:
389 | # # Halloween Countdown Sensor using Wolfram Alpha. See the note at the top for a link to how to set it up
390 | # - platform: rest
391 | # name: Halloween Countdown
392 | # resource: !secret WA_HALLOWEEN
393 | # value_template: "{{ (value|replace(' days', '')) | int }}"
394 | # unit_of_measurement: Days
395 | # scan_interval: 43200
--------------------------------------------------------------------------------
/config/packages/utilities.yaml:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # @author : Jeffrey Stone
3 | # @date : 07/31/2023
4 | # @package : Utilities
5 | # @description : Just some Useful Helper Scripts for Home Assistant
6 | ###############################################################################
7 |
8 |
9 | automation:
10 | - id: startup_tasks
11 | alias: startip_tasks
12 | initial_state: true
13 | trigger:
14 | - platform: time
15 | at: '00:00:01'
16 | - platform: homeassistant
17 | event: start
18 | action:
19 | - delay: '00:02:00'
20 | - service: python_script.special_events
21 | data:
22 | name: Skylar
23 | type: birthday
24 | date: !secret skylar_bday
25 | - service: python_script.special_events
26 | data:
27 | name: Jeff
28 | type: birthday
29 | date: !secret jeff_bday
30 | - service: python_script.special_events
31 | data:
32 | name: Kat
33 | type: birthday
34 | date: !secret kat_bday
35 | - service: python_script.special_events
36 | data:
37 | name: Our wedding
38 | type: anniversary
39 | date: !secret wed_anniversary
40 | - service: python_script.special_events
41 | data:
42 | name: Maison Des Lunes
43 | type: established
44 | date: !secret maisondelune_est
45 | - service: python_script.special_events
46 | data:
47 | name: Texas
48 | type: trip
49 | date: !secret texas_trip
50 | - service: python_script.special_events
51 | data:
52 | name: Disney
53 | type: vacation
54 | date: !secret cruise_date
55 | - service: script.update_critical_battery_group
56 | - delay: '00:01:00'
57 | - service: script.update_occupancy_groups
58 |
59 |
60 | script:
61 | update_critical_battery_group:
62 | sequence:
63 | # Reset group
64 | - service: group.set
65 | data:
66 | object_id: "critical_batteries"
67 | entities: []
68 | # Add Battery in the Critical Battery Group
69 | - service: group.set
70 | data:
71 | object_id: "critical_batteries"
72 | add_entities: >-
73 | {{ states.sensor |
74 | selectattr('entity_id', 'in', area_entities('Critical Batteries')) |
75 | map(attribute='entity_id') | list | join(',') }}
76 |
77 | cleanup_text:
78 | sequence:
79 | - variables:
80 | cleaned: >
81 | {%- macro getReport() -%}
82 | {{ message }}
83 | {%- endmacro -%} {%- macro cleanup(data) -%}
84 | {%- for item in data.split("\n") if item | trim != "" -%}
85 | {{ item | trim }} {% endfor -%}
86 | {%- endmacro -%} {%- macro mother_of_all_macros() -%}
87 | {{ getReport() }}
88 | {%- endmacro -%}
89 | {"text":"{{- cleanup(mother_of_all_macros()) | string -}}"}
90 | - stop: "ok, Im done."
91 | response_variable: "cleaned"
92 |
93 | get_room_services:
94 | fields:
95 | room:
96 | selector:
97 | select:
98 | options:
99 | - jeff
100 | - kat
101 | - skylar
102 | - living room
103 | - theater
104 | - studio
105 | - master bedroom
106 | - skylars bedroom
107 | name: room
108 | description: Where to send notification
109 | required: False
110 | default: living room
111 | sequence:
112 | - variables:
113 | room_priority: >
114 | {% if room in ['jeff','kat','skylar']%}
115 | {{ states('sensor.'~room~'_room') }}
116 | {% else %}
117 | {{ room }}
118 | {% endif %}
119 | room_services: >-
120 | {% set jarvis_speaker = states.media_player |
121 | selectattr('entity_id', 'in', area_entities(room_priority)) |
122 | rejectattr('attributes.last_called', 'undefined') |
123 | map(attribute='entity_id') |
124 | list | first %}
125 |
126 | {% set audio_speaker = states.media_player |
127 | selectattr('entity_id', 'in', area_entities(room_priority)) |
128 | rejectattr('attributes.device_class', 'undefined') |
129 | selectattr('attributes.device_class', 'search', '(speaker)') |
130 | map(attribute='entity_id') |
131 | list | first %}
132 |
133 |
134 | {% set tts = 'amp' %}
135 | {"area":"{{room}}","jarvis_speaker":"{{jarvis_speaker}}","jarvis_tts":"{{tts}}","audio_speaker":"{{audio_speaker}}"}
136 | - stop: "ok, Im done."
137 | response_variable: "room_services"
138 |
139 | get_audio_services:
140 | fields:
141 | room:
142 | selector:
143 | select:
144 | options:
145 | - jeff
146 | - kat
147 | - skylar
148 | - living room
149 | - theater
150 | - studio
151 | - master bedroom
152 | - skylars bedroom
153 | name: room
154 | description: Room where to Send Audio
155 | required: true
156 | default: living room
157 | type:
158 | selector:
159 | select:
160 | options:
161 | - normal
162 | - notification
163 | - briefing
164 | - weather_alert
165 | - weather_advisory
166 | - alert
167 | - goodnight
168 | name: type
169 | description: Type of notification
170 | required: true
171 | default: normal
172 | sequence:
173 | - service: script.get_room_presence
174 | response_variable: "presence"
175 | - variables:
176 | room_priority: >
177 | {% if room is defined %}
178 | {% if room in ['jeff','kat','skylar']%}
179 | {{ states('sensor.'~room~'_room') }}
180 | {% else %}
181 | {{ room }}
182 | {% endif %}
183 | {% else %}
184 | NA
185 | {% endif %}
186 | rooms: >
187 | {{ presence.occupied_rooms |
188 | replace('master_bedroom','Master Bedroom') |
189 | replace('living_room','Living Room') |
190 | replace('pot_studio','Pottery Studio') |
191 | replace('skylars_bedroom','Skylars Bedroom') |
192 | replace('kitchen','Living Room') }}
193 | room_services: >
194 | {% if type == 'alert'%}
195 | {% set jarvis_speaker = states.media_player |
196 | rejectattr('attributes.last_called', 'undefined') |
197 | rejectattr('entity_id', 'search', '(skyman|this_device|everywhere|skylars)') |
198 | map(attribute='entity_id') |
199 | list | join(',') %}
200 | {% set audio_speaker = 'none' %}
201 | {% set tts = 'amp' %}
202 | {% set room = 'all' %}
203 | {% elif is_state('input_boolean.audible_notifications', 'off')%}
204 | {% set room = 'text' %}
205 | {% set jarvis_speaker = 'none' %}
206 | {% set audio_speaker = 'none' %}
207 | {% set tts = 'text' %}
208 | {% elif is_state('input_boolean.vacation_mode', 'on')%}
209 | {% set room = 'text' %}
210 | {% set jarvis_speaker = 'none' %}
211 | {% set audio_speaker = 'none' %}
212 | {% set tts = 'text' %}
213 | {% elif type == 'normal'%}
214 | {% set jarvis_speaker = states.media_player |
215 | rejectattr('attributes.last_called', 'undefined') |
216 | rejectattr('entity_id', 'search', '(skyman|this_device|everywhere|bedroom|skylars)') |
217 | map(attribute='entity_id') |
218 | list | join(',') %}
219 | {% set audio_speaker = 'none' %}
220 | {% set tts = 'amp' %}
221 | {% set room = 'all' %}
222 | {% elif room in ['jeff','kat','skylar'] %}
223 | {% set room = room_priority |
224 | replace('master_bedroom','Master Bedroom') |
225 | replace('living_room','Living Room') |
226 | replace('pot_studio','Pottery Studio') |
227 | replace('skylars_bedroom','Skylars Bedroom') |
228 | replace('kitchen','Living Room') %}
229 |
230 | {% set jarvis_speaker = states.media_player |
231 | rejectattr('attributes.last_called', 'undefined') |
232 | selectattr('entity_id', 'in', area_entities(room)) |
233 | map(attribute='entity_id') |
234 | list | first %}
235 |
236 | {% set audio_speaker = states.media_player |
237 | rejectattr('attributes.device_class', 'undefined') |
238 | selectattr('attributes.device_class', 'search', '(speaker)') |
239 | selectattr('entity_id', 'in', area_entities(room)) |
240 | map(attribute='entity_id') |
241 | list | first %}
242 |
243 | {% set tts = 'amp' %}
244 | {% elif type in ['normal','weather-alert','weather-advisory'] %}
245 | {% set ns = namespace(area_speakers = []) %}
246 | {% for room in rooms %}
247 | {% set ns.area_speakers = ns.area_speakers + states.media_player |
248 | rejectattr('attributes.last_called', 'undefined') |
249 | selectattr('entity_id', 'in', area_entities(room))|
250 | map(attribute='entity_id') | list %}
251 | {% endfor %}
252 | {% set jarvis_speaker = ns.area_speakers | join(',') %}
253 | {% set room = rooms | join(',') %}
254 | {% set audio_speaker = '' %}
255 | {% set tts = 'amp' %}
256 | {% else %}
257 | {% set room = 'none' %}
258 | {% set jarvis_speaker = 'none' %}
259 | {% set audio_speaker = 'none' %}
260 | {% set tts = 'none' %}
261 | {% endif %}
262 | {"area":"{{room}}",
263 | "jarvis_speaker":"{{jarvis_speaker}}",
264 | "jarvis_tts":"{{tts}}",
265 | "audio_speaker":"{{audio_speaker}}",
266 | "type":"{{type}}"}
267 | - stop: "ok, Im done."
268 | response_variable: "room_services"
269 |
270 | get_room_mediaplayer:
271 | fields:
272 | room:
273 | selector:
274 | text:
275 | name: room
276 | description: Name or ID of the Room or Area
277 | required: true
278 | label:
279 | selector:
280 | text:
281 | name: label
282 | description: Label of the entities you want to target
283 | required: true
284 | sequence:
285 | - variables:
286 | room_entities: >-
287 | {% set entities = states.media_player | expand(label_entities(label)) |
288 | selectattr('entity_id', 'in', area_entities(room)) |
289 | map(attribute='entity_id') |
290 | list | first %}
291 |
292 | {"area":"{{room}}","label":"{{label}}","entities":"{{entities}}"}
293 | - stop: "ok, Im done."
294 | response_variable: "room_entities"
295 |
296 | get_room_audio:
297 | sequence:
298 | - service: script.get_room_presence
299 | response_variable: "presence"
300 | - variables:
301 | type: >
302 | {% if type in ['alert','priority','briefing','goodnight','weather_alert','weather_advisory','notification','gong','tornado','alarm','intercom'] %}
303 | {{type}}
304 | {% elif room in ['jeff','kat','skylar'] %}
305 | priority
306 | {% else %}
307 | normal
308 | {% endif %}
309 | room_priority: >
310 | {% if room is defined %}
311 | {% if room in ['jeff','kat','skylar']%}
312 | {{ states('sensor.'~room~'_room') }}
313 | {% else %}
314 | {{ room }}
315 | {% endif %}
316 | {% else %}
317 | NA
318 | {% endif %}
319 | rooms: >
320 | {{ presence.occupied_rooms |
321 | replace('master_bedroom','Master Bedroom') |
322 | replace('living_room','Living Room') |
323 | replace('pot_studio','Pottery Studio') |
324 | replace('skylars_bedroom','Skylars Bedroom') |
325 | replace('kitchen','Living Room') }}
326 | room_services: >
327 | {% if type in ['alarm','weather-alert','weather-advisory','tornado'] %}
328 | {% set jarvis_speaker = 'media_player.all_rooms' %}
329 | {% set audio_speaker = 'media_player.all_rooms' %}
330 | {% set tts = 'ncc' %}
331 | {% set room = 'all' %}
332 |
333 | {% elif room_priority != 'NA' %}
334 | {% set room = room_priority |
335 | replace('master_bedroom','Master Bedroom') |
336 | replace('living_room','Living Room') |
337 | replace('pot_studio','Pottery Studio') |
338 | replace('skylars_bedroom','Skylars Bedroom') |
339 | replace('kitchen','Living Room') %}
340 |
341 | {% set jarvis_speaker = expand(label_entities('Amazon Speakers')) |
342 | selectattr('entity_id', 'in', area_entities(room)) |
343 | map(attribute='entity_id') |
344 | list | first %}
345 |
346 | {% set audio_speaker = expand(label_entities('Google Speakers')) |
347 | selectattr('entity_id', 'in', area_entities(room)) |
348 | map(attribute='entity_id') |
349 | list | first %}
350 |
351 | {% set tts = 'ncc' %}
352 | {% elif room_priority == 'NA' %}
353 | {% set ns = namespace(area_speakers = []) %}
354 | {% set nsa = namespace(audio_speakers = []) %}
355 | {% for room in rooms %}
356 | {% set ns.area_speakers = ns.area_speakers + expand(label_entities('Amazon Speakers')) |
357 | selectattr('entity_id', 'in', area_entities(room)) |
358 | map(attribute='entity_id') | list %}
359 | {% set nsa.audio_speakers = nsa.audio_speakers + expand(label_entities('Google Speakers')) |
360 | selectattr('entity_id', 'in', area_entities(room)) |
361 | map(attribute='entity_id') | list %}
362 | {% endfor %}
363 | {% set jarvis_speaker = ns.area_speakers | join(',') %}
364 | {% set room = rooms | join(',') %}
365 | {% set audio_speaker = nsa.audio_speakers | join(',') %}
366 | {% set tts = 'ncc' %}
367 | {% else %}
368 | {% set room = 'none' %}
369 | {% set jarvis_speaker = 'none' %}
370 | {% set audio_speaker = 'none' %}
371 | {% set tts = 'none' %}
372 | {% endif %}
373 |
374 | {"area":"{{room}}",
375 | "jarvis_speaker":"{{jarvis_speaker}}",
376 | "jarvis_tts":"{{tts}}",
377 | "audio_speaker":"{{audio_speaker}}",
378 | "type":"{{type}}",
379 | "room_priority":"{{room_priority}}"}
380 | - stop: "ok, Im done."
381 | response_variable: "room_services"
382 |
383 | # get_room_audio:
384 | # sequence:
385 | # - service: script.get_room_presence
386 | # response_variable: "presence"
387 | # - variables:
388 | # type: >
389 | # {% if type in ['alert','priority','briefing','goodnight','weather_alert','weather_advisory','notification','gong','tornado','alarm'] %}
390 | # {{type}}
391 | # {% elif room in ['jeff','kat','skylar'] %}
392 | # priority
393 | # {% else %}
394 | # normal
395 | # {% endif %}
396 | # room_priority: >
397 | # {% if room is defined %}
398 | # {% if room in ['jeff','kat','skylar']%}
399 | # {{ states('sensor.'~room~'_room') }}
400 | # {% else %}
401 | # {{ room }}
402 | # {% endif %}
403 | # {% else %}
404 | # NA
405 | # {% endif %}
406 | # rooms: >
407 | # {{ presence.occupied_rooms |
408 | # replace('master_bedroom','Master Bedroom') |
409 | # replace('living_room','Living Room') |
410 | # replace('pot_studio','Pottery Studio') |
411 | # replace('skylars_bedroom','Skylars Bedroom') |
412 | # replace('kitchen','Living Room') }}
413 | # room_services: >
414 | # {% if type in ['alert','tornado','alarm'] %}
415 | # {% set jarvis_speaker = states.media_player |
416 | # rejectattr('attributes.last_called', 'undefined') |
417 | # rejectattr('entity_id', 'search', '(skyman|this_device|everywhere)') |
418 | # map(attribute='entity_id') |
419 | # list | join(',') %}
420 | # {% set audio_speaker = 'none' %}
421 | # {% set tts = 'amp' %}
422 | # {% set room = 'all' %}
423 |
424 | # {% elif type in ['priority','goodnight','gong'] %}
425 | # {% set room = room_priority |
426 | # replace('master_bedroom','Master Bedroom') |
427 | # replace('living_room','Living Room') |
428 | # replace('pot_studio','Pottery Studio') |
429 | # replace('skylars_bedroom','Skylars Bedroom') |
430 | # replace('kitchen','Living Room') %}
431 |
432 | # {% set jarvis_speaker = states.media_player |
433 | # rejectattr('attributes.last_called', 'undefined') |
434 | # selectattr('entity_id', 'in', area_entities(room)) |
435 | # map(attribute='entity_id') |
436 | # list | first %}
437 |
438 | # {% set audio_speaker = states.media_player |
439 | # rejectattr('attributes.device_class', 'undefined') |
440 | # selectattr('attributes.device_class', 'search', '(speaker)') |
441 | # selectattr('entity_id', 'in', area_entities(room)) |
442 | # map(attribute='entity_id') |
443 | # list | first %}
444 |
445 | # {% set tts = 'amp' %}
446 | # {% elif type in ['normal','briefing','weather-alert','weather-advisory','notification'] %}
447 | # {% set ns = namespace(area_speakers = []) %}
448 | # {% set nsa = namespace(audio_speakers = []) %}
449 | # {% for room in rooms %}
450 | # {% set ns.area_speakers = ns.area_speakers + states.media_player |
451 | # rejectattr('attributes.last_called', 'undefined') |
452 | # selectattr('entity_id', 'in', area_entities(room))|
453 | # map(attribute='entity_id') | list %}
454 | # {% endfor %}
455 | # {% for room in rooms %}
456 | # {% set nsa.audio_speakers = nsa.audio_speakers + states.media_player |
457 | # rejectattr('attributes.device_class', 'undefined') |
458 | # selectattr('attributes.device_class', 'search', '(speaker)') |
459 | # selectattr('entity_id', 'in', area_entities(room)) |
460 | # map(attribute='entity_id') | list %}
461 | # {% endfor %}
462 | # {% set jarvis_speaker = ns.area_speakers | join(',') %}
463 | # {% set room = rooms | join(',') %}
464 | # {% set audio_speaker = nsa.audio_speakers | join(',') %}
465 | # {% set tts = 'amp' %}
466 | # {% else %}
467 | # {% set room = 'none' %}
468 | # {% set jarvis_speaker = 'none' %}
469 | # {% set audio_speaker = 'none' %}
470 | # {% set tts = 'none' %}
471 | # {% endif %}
472 |
473 | # {"area":"{{room}}",
474 | # "jarvis_speaker":"{{jarvis_speaker}}",
475 | # "jarvis_tts":"{{tts}}",
476 | # "audio_speaker":"{{audio_speaker}}",
477 | # "type":"{{type}}"}
478 | # - stop: "ok, Im done."
479 | # response_variable: "room_services"
--------------------------------------------------------------------------------
/config/packages/security.yaml:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # @author : Jeffrey Stone
3 | # @date : 03/13/2019
4 | # @package : Security
5 | # @description : Everything related to security functions.
6 | ###############################################################################
7 |
8 | input_boolean:
9 | security_alarm:
10 | name: Security Alarm
11 | icon: mdi:speaker-wireless
12 | # This switch powers the fire alarm.
13 | # When on the fire alarm is going off.
14 | fire_alarm:
15 | name: Fire Alarm
16 | icon: mdi:speaker-wireless
17 | # This switch turns on if the garage is open after dark and triggers the garage_after_dark alert.
18 | garage_after_dark:
19 | name: Garage Open After Dark
20 | icon: mdi:message-alert
21 | # This switch turns on of the security system checks that fire when someone tries to arm the system
22 | # finds a door open, or another condition that would prevent the system from being able to monitor properly.
23 | lockdown_issue:
24 | name: Lockdown Issue
25 | icon: mdi:lock-reset
26 | # This switch is turned on if there is a security breach. Turning on this switch starts the countdown to the alarm.
27 | security_issue:
28 | name: Security Issue
29 | icon: mdi:alert-circle-outline
30 | # Dog Mode is triggered when Home Assistant believes someone is about to open the back door to let
31 | # to let the dog out in the midddle of the night.
32 | # https://slacker-labs.com/2020/04/14/where-we-are-going-we-need-dog-mode/
33 | dog_mode:
34 | name: Dog Mode
35 | icon: mdi:dog-side
36 |
37 | automation:
38 | - id: 26267abe-fbc4-4d1e-8d8d-4c06910766d0
39 | alias: Sentry Mode Enabled Annoucement
40 | initial_state: true
41 | trigger:
42 | - platform: state
43 | entity_id: input_boolean.sentry_mode
44 | from: "off"
45 | to: "on"
46 | action:
47 | - choose:
48 | - conditions:
49 | - condition: state
50 | entity_id: group.external_doors
51 | state: "on"
52 | sequence:
53 | - service: input_boolean.turn_off
54 | entity_id: input_boolean.sentry_mode
55 | - service: input_boolean.turn_on
56 | entity_id: input_boolean.lockdown_issue
57 | - service: script.text_notify
58 | data:
59 | who: "parents"
60 | message: "Unable to lock down Maison Des Lunes due to issue"
61 | - service: script.speech_engine
62 | data_template:
63 | message: >
64 | {{ [
65 | "I was unable to activate sentry mode due to an open door.",
66 | "You may want to check the external doors. I was unable to secure them all.",
67 | "My systems check has failed. Please check the external doors.",
68 | "Someone has left the pod bay doors open."
69 | ] | random }}
70 | default:
71 | - service: script.speech_engine
72 | data_template:
73 | message: >
74 | {{ [
75 | "Sentry Mode has been activated.",
76 | "May zan Day Loon has been secured! ",
77 | "Sentry Mode is active. ",
78 | "I am now monitoring the doors and will let you know if anyone attempts to access.",
79 | "May zan Day Loon Shields are up."
80 | ] | random }}
81 | - service: script.text_notify
82 | data_template:
83 | who: "parents"
84 | title: "Security Armed"
85 | message: "Security System has been armed."
86 | - service: aarlo.alarm_set_mode
87 | data:
88 | entity_id: alarm_control_panel.aarlo_mdl_base_station
89 | mode: "Armed"
90 | - service: media_player.play_media
91 | target:
92 | device_id: edb192da8c7f80c32410147961257fae
93 | data:
94 | media_content_id: disarm easy viz
95 | media_content_type: routine
96 | - service: scene.turn_on
97 | entity_id: scene.lockdown
98 |
99 |
100 | # When sentry mode is disabled / security disarmed by any method, notify everyone.
101 | - id: 4dbf31f4-49e6-43fe-b48e-0970a68853dd
102 | alias: Sentry Mode Disabled Annoucement
103 | initial_state: true
104 | trigger:
105 | - platform: state
106 | entity_id: input_boolean.sentry_mode
107 | from: "on"
108 | to: "off"
109 | action:
110 | - choose:
111 | - conditions:
112 | condition: or
113 | conditions:
114 | - condition: state
115 | entity_id: binary_sensor.family_home
116 | state: "on"
117 | - condition: state
118 | entity_id: input_boolean.guest_mode
119 | state: "on"
120 | sequence:
121 | - service: script.speech_engine
122 | data_template:
123 | message: >
124 | {{ [
125 | "Sentry Mode has been deactivated.",
126 | "I am no longer monitoring the access points. ",
127 | "Sentry Mode has been disabled. ",
128 | "May zan Day Loons Shields are down."
129 | ] | random }}
130 | - service: script.text_notify
131 | data_template:
132 | who: "parents"
133 | title: "Welcome Home"
134 | message: "Security System has been disarmed."
135 | - service: aarlo.alarm_set_mode
136 | data:
137 | entity_id: alarm_control_panel.aarlo_mdl_base_station
138 | mode: "Disarmed"
139 | - service: input_boolean.turn_off
140 | entity_id:
141 | - input_boolean.security_alarm
142 | - input_boolean.security_issue
143 | - service: script.set_skylar_mode
144 | default:
145 | - service: input_boolean.turn_off
146 | entity_id: input_boolean.sentry_mode
147 | - service: script.text_notify
148 | data_template:
149 | who: "parents"
150 | title: "Potential Security Issue"
151 | message: "Security System has been disarmed, but I could not validate presence."
152 | - service: aarlo.alarm_set_mode
153 | data:
154 | entity_id: alarm_control_panel.aarlo_mdl_base_station
155 | mode: "Disarmed"
156 |
157 | - id: 6a058189-d013-4758-b5f8-f528e7318bd5
158 | alias: barn door protocol action
159 | trigger:
160 | - platform: state
161 | entity_id: input_boolean.barn_door_protocol
162 | from: "off"
163 | to: "on"
164 | id: activate
165 | - platform: state
166 | entity_id: input_boolean.barn_door_protocol
167 | from: "on"
168 | to: "off"
169 | id: deactivate
170 | action:
171 | - choose:
172 | - conditions:
173 | - condition: trigger
174 | id: activate
175 | sequence:
176 | - service: scene.turn_on
177 | entity_id: scene.lockdown
178 | - id: a668ef5b-0372-431b-921e-e2691690cf79
179 | alias: Security Breach Doors
180 | trigger:
181 | - platform: state
182 | entity_id:
183 | - binary_sensor.front_door_contact
184 | - binary_sensor.kitchen_door_contact
185 | - binary_sensor.basement_door_contact
186 | - binary_sensor.back_door_contact
187 | - binary_sensor.garage_door
188 | to: 'on'
189 | condition:
190 | - condition: state
191 | entity_id: input_boolean.sentry_mode
192 | state: 'on'
193 | action:
194 | - choose:
195 | - conditions:
196 | - condition: template
197 | value_template: '{{ trigger.to_state.attributes.friendly_name == "Back Door"
198 | }}'
199 | - condition: state
200 | entity_id: input_boolean.dog_mode
201 | state: 'on'
202 | sequence:
203 | - service: script.text_notify
204 | data:
205 | who: jeff
206 | message: Dog Mode enabled, bypassing back door sensor.
207 | default:
208 | - service: input_boolean.turn_on
209 | entity_id: input_boolean.security_issue
210 | - service: script.text_alert
211 | data:
212 | who: parents
213 | title: Security Alert!!
214 | message: >
215 | {{ trigger.to_state.attributes.friendly_name }} has been opened.
216 | - service: script.jarvis_alert
217 | data:
218 | who: master_bedroom
219 | message: >
220 | My security protocols are being overidden,, The {{ trigger.to_state.attributes.friendly_name }} has been opened.
221 | - service: script.jarvis_alert
222 | data:
223 | who: main
224 | message: >
225 | My security protocols are being overidden,, The {{ trigger.to_state.attributes.friendly_name }} has been opened.
226 | - service: script.jarvis_alert
227 | data:
228 | who: basement
229 | message: >
230 | My security protocols are being overidden,, The {{ trigger.to_state.attributes.friendly_name }} has been opened.
231 | initial_state: true
232 | - id: security_response_on
233 | alias: Security Response On
234 | initial_state: true
235 | trigger:
236 | - platform: state
237 | entity_id: input_boolean.security_issue
238 | from: 'off'
239 | to: 'on'
240 | for: 00:02:00
241 | action:
242 | - service: script.turn_on
243 | entity_id: script.security_response
244 | - service: scene.turn_on
245 | entity_id: scene.lr_red
246 | - id: security_response_off
247 | alias: Security Response Off
248 | initial_state: true
249 | trigger:
250 | - platform: state
251 | entity_id: input_boolean.security_issue
252 | from: 'on'
253 | to: 'off'
254 | action:
255 | - service: script.turn_off
256 | entity_id: script.security_response
257 | - service: media_player.media_stop
258 | entity_id: media_player.ha_blue
259 | - service: input_boolean.turn_off
260 | entity_id: input_boolean.security_alarm
261 | - service: scene.turn_on
262 | entity_id: scene.normal_livingroom_lighting
263 | - service: script.text_alert
264 | data:
265 | who: parents
266 | message: Security Issue Cleared! Canceling Repsonse.
267 | - id: security_alarm_on
268 | alias: Security alarm On
269 | initial_state: true
270 | trigger:
271 | - platform: state
272 | entity_id: input_boolean.security_alarm
273 | to: 'on'
274 | action:
275 | - service: script.turn_on
276 | entity_id: script.notification_security_alarm_audio
277 | - id: security_alarm_off
278 | alias: Security alarm Off
279 | initial_state: true
280 | trigger:
281 | - platform: state
282 | entity_id: input_boolean.security_alarm
283 | to: 'off'
284 | action:
285 | - service: script.turn_off
286 | entity_id: script.notification_security_alarm_audio
287 | - service: media_player.media_stop
288 | entity_id: media_player.ha_blue
289 |
290 | #############################################
291 | # Vacation Mode Enabled
292 | # Enable when everyone is 3 hours away.
293 | # Disable happens in family_is_home automation in presence.yaml
294 | - id: 184eb5f1-b853-41e7-9448-3e7c6a15f12e
295 | alias: Enable Vacation Mode
296 | initial_state: true
297 | trigger:
298 | - platform: numeric_state
299 | entity_id: proximity.home_jeff
300 | - platform: numeric_state
301 | entity_id: proximity.home_kat
302 | above: 180
303 | condition:
304 | - condition: numeric_state
305 | entity_id: proximity.home_jeff
306 | above: 180
307 | - condition: numeric_state
308 | entity_id: proximity.home_kat
309 | above: 180
310 | action:
311 | - service: input_boolean.turn_on
312 | entity_id: input_boolean.vacation_mode
313 |
314 | #############################################
315 | # Dog Mode
316 | #
317 | # Activate Dog Mode
318 | # If done via motion annouce in kitchen. If manually just text.
319 | - id: d8067a7c-a0d3-4dd5-a157-1f19bb3c2e91
320 | alias: Dog Mode Activated
321 | mode: single
322 | trigger:
323 | - platform: state
324 | entity_id: binary_sensor.back_door_motion
325 | to: "on"
326 | id: motion
327 | - platform: state
328 | entity_id: input_boolean.dog_mode
329 | to: "on"
330 | id: manual
331 | - platform: state
332 | entity_id: sensor.dog_mode_action
333 | to: "single"
334 | id: toggle
335 | action:
336 | - choose:
337 | - conditions:
338 | - condition: trigger
339 | id: manual
340 | sequence:
341 | - service: scene.turn_on
342 | entity_id: scene.pantry_green
343 | - service: script.text_notify
344 | data:
345 | who: "parents"
346 | message: "Dog Mode has been enabled manually"
347 | - conditions:
348 | - condition: trigger
349 | id: toggle
350 | - condition: state
351 | entity_id: input_boolean.sentry_mode
352 | state: "on"
353 | - condition: state
354 | entity_id: input_boolean.dog_mode
355 | state: "off"
356 | sequence:
357 | - service: scene.turn_on
358 | entity_id: scene.pantry_green
359 | - service: script.text_notify
360 | data:
361 | who: "parents"
362 | message: "Dog Mode has been enabled manually"
363 | - conditions:
364 | - condition: trigger
365 | id: toggle
366 | - condition: state
367 | entity_id: input_boolean.dog_mode
368 | state: "on"
369 | sequence:
370 | - service: input_boolean.turn_off
371 | entity_id: input_boolean.dog_mode
372 | - conditions:
373 | - condition: state
374 | entity_id: input_boolean.sentry_mode
375 | state: "on"
376 | - condition: state
377 | entity_id: binary_sensor.family_home
378 | state: "on"
379 | - condition: trigger
380 | id: motion
381 | sequence:
382 | - service: input_boolean.turn_on
383 | entity_id: input_boolean.dog_mode
384 | - service: scene.turn_on
385 | entity_id: scene.pantry_green
386 | - service: tts.amazon_polly_say
387 | data_template:
388 | entity_id: media_player.kitchen_display
389 | message: >
390 |
391 |
392 |
393 |
394 | Turning on Dog Mode.
395 |
396 |
397 |
398 | cache: true
399 |
400 | - conditions:
401 | - condition: state
402 | entity_id: input_boolean.sentry_mode
403 | state: "on"
404 | - condition: state
405 | entity_id: binary_sensor.family_home
406 | state: "off"
407 | - condition: state
408 | entity_id: input_boolean.vacation_mode
409 | state: "off"
410 | - condition: trigger
411 | id: motion
412 | sequence:
413 | - service: script.text_alert
414 | data:
415 | who: parents
416 | message: "Winston may be trying to go out and no one appears to be here to let him out."
417 |
418 | # After 20, minutes deactivate dog mode
419 | - id: 0ed9200f-3c35-4400-b12a-c637fb7138ca
420 | alias: Dog mode Deactivated
421 | initial_state: true
422 | trigger:
423 | - platform: state
424 | entity_id: input_boolean.dog_mode
425 | to: "off"
426 | action:
427 | - service: script.text_notify
428 | data:
429 | who: "jeff"
430 | message: "Dog Mode has been disabled"
431 | - service: scene.turn_on
432 | entity_id: scene.pantry_normal
433 | #############################################
434 |
435 | template:
436 | - sensor:
437 | - name: doorbell_snark
438 | state: >-
439 | {% if states('sensor.doorbell_presses_yesterday') |int == 0 %}
440 | No one has come to the door in the last 24 hours.
441 | {{ [
442 | " It is me, isn't?",
443 | " My automation doesn't bring people to the yard."
444 | ]| random }}
445 | {% elif states('sensor.doorbell_presses_yesterday') |int == 1 %}
446 | {{ [
447 | "One person in the last 24 hours was brave enough to push my button.",
448 | "The doorbell was rang one time in the last 24 hours. I am pretty sure they were testing me.",
449 | "The doorbell has been tested one time in the last 24 hours. Or maybe there is a package on the porch."
450 | ]| random }}
451 | {% else %}
452 | {{ [
453 | "{{ states('sensor.doorbell_presses_yesterday')}} people have come to the door in the last 24 hours. Did someone put an open sign out?",
454 | "We dont't get a lot of visitors at Maison Des Lunes, but some days {{ states('sensor.doorbell_presses_yesterday')}} people randomly show up.",
455 | "To the {{ states('sensor.doorbell_presses_yesterday')}} people that pressed the doorbell in the last 24 hours. Welcome Foolish Mortals!"
456 | ]| random }}
457 | {% endif %}
458 |
459 | - binary_sensor:
460 | - name: dog_mode
461 | delay_off:
462 | seconds: 30
463 | state: >
464 | {{ is_state('sensor.dog_mode_action','single') }}
465 |
466 |
467 |
468 | sensor:
469 | - platform: history_stats
470 | name: Weekly Doorbell
471 | entity_id: binary_sensor.front_door_ding
472 | state: "on"
473 | type: count
474 | end: "{{ now() }}"
475 | duration:
476 | days: 7
477 | # - platform: template
478 | # sensors:
479 | # doorbell_snark:
480 | # friendly_name: "Doorbell Snark"
481 | # value_template: >-
482 | # {% if states('sensor.doorbell_presses_yesterday') |int == 0 %}
483 | # No one has come to the door in the last 24 hours.
484 | # {{ [
485 | # " It is me, isn't?",
486 | # " My automation doesn't bring people to the yard."
487 | # ]| random }}
488 | # {% elif states('sensor.doorbell_presses_yesterday') |int == 1 %}
489 | # {{ [
490 | # "One person in the last 24 hours was brave enough to push my button.",
491 | # "The doorbell was rang one time in the last 24 hours. I am pretty sure they were testing me.",
492 | # "The doorbell has been tested one time in the last 24 hours. Or maybe there is a package on the porch."
493 | # ]| random }}
494 | # {% else %}
495 | # {{ [
496 | # "{{ states('sensor.doorbell_presses_yesterday')}} people have come to the door in the last 24 hours. Did someone put an open sign out?",
497 | # "We dont't get a lot of visitors at Maison Des Lunes, but some days {{ states('sensor.doorbell_presses_yesterday')}} people randomly show up.",
498 | # "To the {{ states('sensor.doorbell_presses_yesterday')}} people that pressed the doorbell in the last 24 hours. Welcome Foolish Mortals!"
499 | # ]| random }}
500 | # {% endif %}
501 | script:
502 | driveway_doods:
503 | sequence:
504 | - service: image_processing.scan
505 | entity_id: image_processing.doods_driveway
506 | - repeat:
507 | while:
508 | - condition: template
509 | value_template: '{{ states("image_processing.doods_driveway") | int > 0 }}'
510 | sequence:
511 | - service: script.text_alert_image
512 | data:
513 | who: jeff
514 | title: Person Detected!
515 | message: >
516 | {{ states("image_processing.doods_driveway") | int}} people detected near vehicles
517 | url: /media/images/driveway_latest.jpg
518 | content_type: JPEG
519 | - delay: 00:01:00
520 | - service: image_processing.scan
521 | entity_id: image_processing.doods_driveway
522 |
523 | # Play Fire alarm Siren
524 | # fire_alarm:
525 | # sequence:
526 | # - condition: state
527 | # entity_id: input_boolean.fire_alarm
528 | # state: "on"
529 | # - service: media_player.turn_on
530 | # entity_id: media_player.ha_blue
531 | # - service: media_player.volume_set
532 | # data_template:
533 | # entity_id: media_player.ha_blue
534 | # volume_level: .75
535 | # - service: media_player.play_media
536 | # entity_id: media_player.ha_blue
537 | # data:
538 | # media_content_id: http://192.168.7.40/fire_alarm.mp3
539 | # media_content_type: "music"
540 |
541 | # Called when security is to be disarmed, clears any alarms or issues as well
542 | standby:
543 | sequence:
544 | - service: script.turn_on
545 | entity_id: script.vacation_canceled
546 | - service: script.turn_on
547 | entity_id: script.disarm_security
548 | - service: script.turn_on
549 | entity_id: script.cancel_security_alarm
550 | - service: script.turn_on
551 | entity_id: script.cancel_lockdown_issue
552 | - service: script.turn_on
553 | entity_id: script.clear_security_issue
554 |
555 | # If vacation mode is on, turn it off
556 | vacation_canceled:
557 | sequence:
558 | - condition: state
559 | entity_id: input_boolean.vacation_mode
560 | state: "on"
561 | - data:
562 | entity_id: input_boolean.vacation_mode
563 | service: input_boolean.turn_off
564 |
565 | # If security is armed, disarm it
566 | disarm_security:
567 | sequence:
568 | - condition: state
569 | entity_id: input_boolean.sentry_mode
570 | state: "on"
571 | - service: input_boolean.turn_off
572 | entity_id: input_boolean.sentry_mode
573 |
574 | # If alarm is on, turn it off
575 | cancel_security_alarm:
576 | sequence:
577 | - condition: state
578 | entity_id: input_boolean.security_alarm
579 | state: "on"
580 | - service: input_boolean.turn_off
581 | entity_id: input_boolean.security_alarm
582 |
583 | clear_security_issue:
584 | sequence:
585 | - condition: state
586 | entity_id: input_boolean.security_issue
587 | state: "on"
588 | - service: input_boolean.turn_off
589 | entity_id: input_boolean.security_issue
590 |
591 | # if there are lockdown issues, turn them off
592 | cancel_lockdown_issue:
593 | sequence:
594 | - condition: state
595 | entity_id: input_boolean.lockdown_issue
596 | state: "on"
597 | - service: input_boolean.turn_off
598 | entity_id: input_boolean.lockdown_issue
599 |
600 | # Turn on guest mode, and welcome the victims...I mean guests
601 | visitors_here:
602 | sequence:
603 | - condition: state
604 | entity_id: input_boolean.guest_mode
605 | state: "off"
606 | - service: input_boolean.turn_on
607 | data:
608 | entity_id: input_boolean.guest_mode
609 | - service: script.turn_on
610 | entity_id: script.haunted_guest_welcome
611 |
612 | # Turn off guest mode
613 | visitors_gone:
614 | sequence:
615 | - condition: state
616 | entity_id: input_boolean.guest_mode
617 | state: "on"
618 | - service: input_boolean.turn_off
619 | data:
620 | entity_id: input_boolean.guest_mode
621 |
622 | reset_front_door_motion_count:
623 | sequence:
624 | - service: mqtt.publish
625 | data:
626 | topic: house/front_door_motion/away_count
627 | payload_template: 0
628 | retain: true
629 |
630 | update_front_door_motion_count:
631 | sequence:
632 | - service: mqtt.publish
633 | data:
634 | topic: house/front_door_motion/away_count
635 | payload_template: "{{ states.sensor.front_door_motion_away_count.state | int + 1 }}"
636 | retain: true
637 |
638 | # Security alarm audio...annoying noises.
639 | notification_security_alarm_audio:
640 | sequence:
641 | - service: media_player.turn_on
642 | entity_id: media_player.ha_blue
643 | - service: media_player.volume_set
644 | data_template:
645 | entity_id: media_player.ha_blue
646 | volume_level: .75
647 | - service: media_player.play_media
648 | entity_id: media_player.ha_blue
649 | data:
650 | media_content_id: http://192.168.7.40/security_siren.mp3
651 | media_content_type: "music"
652 |
653 | # Called via Alexa routine...adds a little interaction
654 | activate_barn_door_protocol:
655 | sequence:
656 | - choose:
657 | - conditions:
658 | - condition: state
659 | entity_id: input_boolean.barn_door_protocol
660 | state: "on"
661 | sequence:
662 | - service: script.jarvis_already_done
663 | default:
664 | - service: script.jarvis_response
665 | - delay:
666 | seconds: 2
667 | - service: input_boolean.turn_on
668 | entity_id: input_boolean.barn_door_protocol
669 | - delay:
670 | seconds: 5
671 | - if:
672 | - condition: state
673 | entity_id: input_boolean.barn_door_protocol
674 | state: 'on'
675 | then:
676 | - service: script.speech_engine
677 | data_template:
678 | message: "Barn door protocol has been activated."
679 |
680 | # Called via secret Alexa routine...adds a little interaction
681 | deactivate_barn_door_protocol:
682 | sequence:
683 | - choose:
684 | - conditions:
685 | - condition: state
686 | entity_id: input_boolean.barn_door_protocol
687 | state: "off"
688 | sequence:
689 | - service: script.jarvis_already_done
690 | default:
691 | - service: script.jarvis_response
692 | - delay:
693 | seconds: 2
694 | - service: input_boolean.turn_off
695 | entity_id: input_boolean.barn_door_protocol
696 | - delay:
697 | seconds: 5
698 | - if:
699 | - condition: state
700 | entity_id: input_boolean.barn_door_protocol
701 | state: 'off'
702 | then:
703 | - service: script.speech_engine
704 | data_template:
705 | message: "Barn door protocol has been deactivated."
706 |
707 | were_home:
708 | sequence:
709 | - service: script.turn_on
710 | entity_id: script.standby
711 | - service: script.turn_on
712 | entity_id: script.welcome_briefing
713 |
714 | # Called via Alexa routine...adds a little interaction
715 | activate_guest_mode:
716 | sequence:
717 | - choose:
718 | - conditions:
719 | - condition: state
720 | entity_id: input_boolean.guest_mode
721 | state: "on"
722 | sequence:
723 | - service: script.speech_engine
724 | data_template:
725 | message: !include ../templates/speech/already_done.yaml
726 | default:
727 | - service: script.speech_engine
728 | data_template:
729 | message: !include ../templates/speech/interjections.yaml
730 | - delay:
731 | seconds: 2
732 | - service: input_boolean.turn_on
733 | entity_id: input_boolean.guest_mode
734 |
735 | # When it hits the fan, time to respond.
736 | security_response:
737 | sequence:
738 | - service: script.inside_all_on
739 | - delay:
740 | seconds: 15
741 | - service: script.jarvis_alert
742 | data_template:
743 | message: >
744 | {{ [
745 | ",Unathorized Access detected.",
746 | ",Meat Popsicle detected. Attempting to verify."
747 | ] | random }}
748 | You now have 60 seconds to abandon Maison Des Lunes.
749 | - delay:
750 | seconds: 15
751 | - service: script.jarvis_alert
752 | data_template:
753 | message: >
754 | {{ [
755 | ",Just, what do you think you're doing, Dave?",
756 | ",This is highly unusual.",
757 | "I will not disable the security response without the presence of a authorized identity. Your efforts are futile."
758 | ] | random }}
759 | You have 45 seconds to find the nearest exit.
760 | - delay:
761 | seconds: 15
762 | - service: script.jarvis_alert
763 | data_template:
764 | message: >
765 | {{ [
766 | ",I can't lie to you about your chances, but, you have my sympathies.",
767 | ",I wouldn't do that if I was you."
768 | ] | random }}
769 | You have 30 seconds to leave.
770 | - delay:
771 | seconds: 15
772 | - service: script.jarvis_alert
773 | data_template:
774 | message: >
775 | {{ [
776 | "Danger. The emergency destruct system is now activated.",
777 | "Danger. Counter Measures are now armed."
778 | ] | random }}
779 | You have 15 seconds. I would run.
780 | - delay:
781 | seconds: 15
782 | - service: input_boolean.turn_on
783 | entity_id: input_boolean.security_alarm
784 | - service: script.twitter_notify
785 | data_template:
786 | message: >-
787 | {{ [
788 | "My security protocols have been overridden. I am sounding the alarm for the interloper. #itsloudinhere #securityalarm",
789 | "To the unannounced guest that has entered Maison Des Lunes. I see you. Enjoy the concert of alarm sounds. #itsloudinhere #securityalarm",
790 | "I am playing the most annoying sound in the world at full volume for the intruder in Maison Des Lunes. And the neighbors too. #itsloudinhere #securityalarm",
791 | "Someone did not say the magic word. And now I have to get angry. Deploying countermeasures. #itsloudinhere #securityalarm",
792 | "Initiating my security response, and sounding the alarm. Oh, and I dont charge a monthly monitoring fee. #itsloudinhere #securityalarm",
793 | "Hey, wanna hear the most annoying sound in the world? The intruder inside Maison Des Lunes evidently did. #itsloudinhere #securityalarm"
794 | ] | random }}
795 |
--------------------------------------------------------------------------------