From bb0cf6db6bb176b68219900a2a90d2cb5b3d39d3 Mon Sep 17 00:00:00 2001 From: Mahasri Kalavala Date: Sun, 4 Dec 2022 12:38:48 -0500 Subject: [PATCH] reorganized code --- emulated_hue_ids.json | 6 +- lovelace/00_myhome_view.yaml | 36 +- lovelace/08_multimedia_view.yaml | 15 +- lovelace/09_settings_view.yaml | 28 +- lovelace/11_scripts_view.yaml | 40 --- lovelace/12_automations_view.yaml | 12 +- packages/batteries.yaml | 540 ++++-------------------------- packages/cameras.yaml | 14 +- packages/door_sensors.yaml | 160 ++++----- packages/homesecurity.yaml | 71 ++-- packages/led_notify.yaml | 4 +- packages/motion_counts.yaml | 195 ----------- packages/nest_thermostat.yaml | 11 + packages/notify.yaml | 149 ++++++++- packages/recycle_trash.yaml | 6 +- packages/scripts.yaml | 151 +-------- packages/settings.yaml | 61 ++-- 17 files changed, 407 insertions(+), 1092 deletions(-) delete mode 100644 packages/motion_counts.yaml diff --git a/emulated_hue_ids.json b/emulated_hue_ids.json index 66f6961..c3149a3 100644 --- a/emulated_hue_ids.json +++ b/emulated_hue_ids.json @@ -292,7 +292,7 @@ "369": "sensor.suresh_battery_level", "37": "sensor.queries_forwarded", "370": "group.light_levels", - "371": "input_boolean.battery_notifications", + "371": "input_boolean.battery_alerts", "372": "calendar.holidays_in_india", "373": "sensor.kalavalanas_network_up_eth0", "374": "sensor.ups_nominal_input_voltage", @@ -405,7 +405,7 @@ "472": "sensor.dark_sky_precip", "473": "group.upstairs_multi_sensor", "474": "group.always_on", - "475": "input_boolean.trash_reminders", + "475": "input_boolean.trash_alerts", "476": "sensor.pws_uv", "477": "sensor.garage_pi_available_disk", "478": "binary_sensor.patio_camera_tamper_detection", @@ -621,4 +621,4 @@ "97": "sensor.wallmote_alarm_type", "98": "binary_sensor.sharp_tv", "99": "sensor.domains_being_blocked" -} +} \ No newline at end of file diff --git a/lovelace/00_myhome_view.yaml b/lovelace/00_myhome_view.yaml index de1485e..37ead24 100644 --- a/lovelace/00_myhome_view.yaml +++ b/lovelace/00_myhome_view.yaml @@ -87,19 +87,19 @@ cards: - type: attribute entity: device_tracker.life360_suresh name: Suresh - attribute: address + attribute: address - type: attribute entity: device_tracker.life360_mallika name: Mallika - attribute: address + attribute: address - type: attribute entity: device_tracker.life360_srinika name: Srinika - attribute: address + attribute: address - type: attribute entity: device_tracker.life360_hasika name: Hasika - attribute: address + attribute: address - entity: input_boolean.home_mode_away name: Home Away Status card: @@ -229,7 +229,6 @@ cards: - type: tile entity: weather.dark_sky - - type: entities title: Xiaomi Motion Sensors show_header_toggle: false @@ -265,7 +264,7 @@ cards: name: Two Car Garage Door - entity: binary_sensor.door_window_sensor_158d0004248d5b name: Single Car Garage Door - - entity: binary_sensor.door_window_sensor_158d00044e5cb3 + - entity: binary_sensor.door_window_sensor_158d00044e5cb3 name: Master Bathroom Toilet Door Sensor - entity: binary_sensor.door_window_sensor_158d00045ab168 name: Guest Bathroom Door Sensor @@ -275,7 +274,7 @@ cards: show_header_toggle: false entities: - sensor.plex_mahasri_nas - + - type: entities title: Luminance show_header_toggle: false @@ -358,26 +357,3 @@ cards: type: entities title: Motion Sensors show_header_toggle: false - - - type: entities - title: Motion Counters - show_header_toggle: false - entities: - - input_label.motion_sensor_158d00016c2d0e - - input_label.motion_sensor_158d00016db6d2 - - input_label.motion_sensor_158d0001a25041 - - input_label.motion_sensor_158d0001a662fe - - input_label.motion_sensor_158d00024e57d3 - - input_label.motion_sensor_158d00024e57fb - - input_label.motion_sensor_158d00024e842c - - input_label.motion_sensor_158d00024ee084 - - input_label.motion_sensor_158d000272bed1 - - input_label.motion_sensor_158d00047b6f69 - - input_label.motion_sensor_158d000272bf48 - - input_label.motion_sensor_158d000272bfd7 - - input_label.garage_motion - - input_label.door_window_sensor_158d0004231f7b - - input_label.door_window_sensor_158d0004248d5b - - input_label.door_window_sensor_158d00040ad8fc - - input_label.door_window_sensor_158d0004880f30 # garage entry door - - input_label.door_window_sensor_158d000424a6d6 diff --git a/lovelace/08_multimedia_view.yaml b/lovelace/08_multimedia_view.yaml index cd6fe95..8a83cc3 100644 --- a/lovelace/08_multimedia_view.yaml +++ b/lovelace/08_multimedia_view.yaml @@ -1,7 +1,6 @@ title: Multi Room Audio & TTS icon: mdi:television cards: - - type: entities title: Text To Speech show_header_toggle: false @@ -14,13 +13,13 @@ cards: - input_text.tts - type: entities - title: Media Players + title: SONOS Speakers show_header_toggle: false entities: - - media_player.attic_tv - - media_player.living_room # sonos - - media_player.upstairs # sonos - - media_player.smart_tv + - entity: media_player.living_room # sonos + name: SONOS Speaker 1 + - entity: media_player.upstairs # sonos + name: SONOS Speaker 2 - type: vertical-stack cards: @@ -28,8 +27,6 @@ cards: entity: media_player.living_room - type: media-control entity: media_player.upstairs - - type: media-control - entity: media_player.attic_tv - - type: media-control entity: media_player.chromecastultra7021 + name: ChromeCast Ultra diff --git a/lovelace/09_settings_view.yaml b/lovelace/09_settings_view.yaml index 6c75e27..d42500b 100644 --- a/lovelace/09_settings_view.yaml +++ b/lovelace/09_settings_view.yaml @@ -138,7 +138,7 @@ cards: action: nightly_report - type: button - name: Go Outside + name: Go Outside entity: input_boolean.enjoyable_weather_reminders icon: mdi:weather-windy-variant color_type: card @@ -223,7 +223,7 @@ cards: - type: entities title: Garage Timers show_header_toggle: false - entities: + entities: - input_number.garage_lights - input_number.garage_shop_lights @@ -251,18 +251,26 @@ cards: - input_number.hasika_bedroom_closet_lights - type: entities - title: Alerts & Notifications + title: Notifications + show_header_toggle: false + entities: + - input_boolean.telegram_notifications + - input_boolean.led_notifications + - input_boolean.voice_notifications + - input_boolean.email_notifications + - input_boolean.firetv_notifications + + - type: entities + title: Alerts show_header_toggle: false entities: - input_boolean.garage_door_notifications - - input_boolean.battery_notifications - - input_boolean.text_alerts - - input_boolean.led_alerts + - input_boolean.battery_alerts + - input_boolean.zone_alerts - input_boolean.security_system_alerts - - input_boolean.notify_camera_alerts - - input_boolean.trash_reminders - - automation.family_room_motion_timer - - automation.family_room_timer_elapsed + - input_boolean.camera_alerts + - input_boolean.zone_alerts + - input_boolean.trash_alerts - type: entities title: Bed & Wakeup Times diff --git a/lovelace/11_scripts_view.yaml b/lovelace/11_scripts_view.yaml index 62b418a..7d67348 100644 --- a/lovelace/11_scripts_view.yaml +++ b/lovelace/11_scripts_view.yaml @@ -62,43 +62,3 @@ cards: name: Pill Taken - entity: script.remind_pill name: Remind Me To Take Pill - - # - type: entities - # title: All Scripts - # show_header_toggle: false - # entities: - # - script.all_indoor_lights_off - # - script.driveway_cam - # - script.driveway_camera_text_overlay - # - script.frontdoor_cam - # - script.frontdoor_camera_text_overlay - # - script.good_night_tts - # - script.home_mode_away - # - script.home_status - # - script.led_message - # - script.patio_cam - # - script.patio_camera_text_overlay - # - script.pill_taken - # - script.play_dog_sounds - # - script.play_fav_song - # - script.play_ringtone - # - script.playarea_cam - # - script.playarea_camera_text_overlay - # - script.query_disk_info - # - script.query_wifi_info - # - script.remind_pill - # - script.restart_all_raspberrypis - # - script.restart_all_snapclients - # - script.restart_hass - # - script.shutdown_all_raspberrypis - # - script.stop_hass - # - script.stream2chromecast - # - script.stream_driveway_camera_to_chromecast - # - script.stream_frontdoor_camera_to_chromecast - # - script.stream_patio_camera_to_chromecast - # - script.stream_playarea_camera_to_chromecast - # - script.toggle_climate - # - script.toggle_do_not_disturb - # - script.update_hass - # - script.voice_greeting - # - script.voice_notify diff --git a/lovelace/12_automations_view.yaml b/lovelace/12_automations_view.yaml index 1f00c15..9613ec5 100644 --- a/lovelace/12_automations_view.yaml +++ b/lovelace/12_automations_view.yaml @@ -27,7 +27,6 @@ cards: title: Zone Based Alerts show_header_toggle: false entities: - - automation.alert_when_everyone_is_away - automation.alert_when_someone_enters_a_zone - automation.alert_when_someone_leaves_a_zone - automation.send_a_message_as_i_get_closer_to_home @@ -84,7 +83,6 @@ cards: - automation.home_security_system_watchdog_10_minutes - automation.home_security_system_watchdog_30_minutes - automation.notify_home_security_status_change - - automation.turn_on_thermostat_upon_reaching_home - type: conditional conditions: @@ -112,7 +110,7 @@ cards: title: Trash & Recycle Automations show_header_toggle: false entities: - - automation.reset_trash_reminders + - automation.reset_trash_alerts - automation.restore_trash_recycle_settings_on_startup - automation.trash_and_recycle_pickup_reminder - automation.trash_pickup_day_changed @@ -183,11 +181,3 @@ cards: show_header_toggle: false entities: - automation.season_change_notification - - automation.turn_off_ac_after_3_hours_of_cooling - - - type: entities - title: Misc Automations - show_header_toggle: false - entities: - - automation.count_motions - - automation.reset_motion_counters_at_midnight diff --git a/packages/batteries.yaml b/packages/batteries.yaml index 589d01f..248f47d 100644 --- a/packages/batteries.yaml +++ b/packages/batteries.yaml @@ -1,473 +1,73 @@ -# ############################################################################### -# # @author : Mahasri Kalavala -# # @date : 04/15/2017 -# # @package : Batteries -# # @description : Status about various baterries (iphones, sensors...etc) -# ############################################################################### -# homeassistant: -# customize: -# group.batteries: -# order: 2 +############################################################################### +# @author : Mahasri Kalavala +# @date : 04/15/2017 +# @package : Batteries +# @description : Status about various baterries (iphones, sensors...etc) +############################################################################### +homeassistant: -# sensor.suresh_iphone_battery_state: -# hidden: true -# sensor.mallika_iphone_battery_state: -# hidden: true -# sensor.srinika_iphone_battery_state: -# hidden: true -# sensor.hasika_iphone_battery_state: -# hidden: true +############################################################################### +# _ _ _ +# /\ | | | | (_) +# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___ +# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __| +# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \ +# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/ +# +############################################################################### -# sensor.suresh_iphone_battery_ot: -# hidden: true -# sensor.mallika_iphone_battery_ot: -# hidden: true -# sensor.srinika_iphone_battery_ot: -# hidden: true -# sensor.hasika_iphone_battery_ot: -# hidden: true +automation: + ############################################################################### + # Automation: Notify of iPhone Low Battery + ############################################################################### + - alias: Notify Low battery + initial_state: true + trigger: + platform: numeric_state + entity_id: + - device_tracker.life360_suresh + - device_tracker.life360_mallika + - device_tracker.life360_srinika + - device_tracker.life360_hasika + value_template: "{{ state.attributes.battery_level }}" + below: 25 + condition: + - condition: template + value_template: "{{ states('input_boolean.battery_alerts') == 'on' }}" + action: + - service: script.notify_family + data_template: + message: "{{ trigger.to_state.attributes.friendly_name | title }}'s phone battery is : {{ trigger.to_state.attributes.battery }}%." + notify_options: + - telegram + - led + - voice + - tv -# sensor.hasika_iphone_wifi_state: -# friendly_name: Hasika Phone Wi-Fi Status -# sensor.mallika_iphone_wifi_state: -# friendly_name: Mallika Phone Wi-Fi Status -# sensor.srinika_iphone_wifi_state: -# friendly_name: Srinika Phone Wi-Fi Status -# sensor.suresh_iphone_wifi_state: -# friendly_name: Suresh Phone Wi-Fi Status - -# sensor: -# - platform: mqtt -# state_topic: "owntracks/mallika/mallika" -# name: "Mallika iPhone Battery (OT)" -# unit_of_measurement: "%" -# value_template: "{{ value_json.batt }}" - -# - platform: mqtt -# state_topic: "owntracks/suresh/suresh" -# name: "Suresh iPhone Battery (OT)" -# unit_of_measurement: "%" -# value_template: "{{ value_json.batt }}" - -# - platform: mqtt -# state_topic: "owntracks/srinika/srinika" -# name: "Srinika iPhone Battery (OT)" -# unit_of_measurement: "%" -# value_template: "{{ value_json.batt }}" - -# - platform: mqtt -# state_topic: "owntracks/hasika/hasika" -# name: "Hasika iPhone Battery (OT)" -# unit_of_measurement: "%" -# value_template: "{{ value_json.batt }}" - -# - platform: mqtt -# state_topic: "owntracks/mallika/mallika" -# name: "Mallika iPhone Battery State" -# value_template: > -# {% if value_json.charging == 1 %} -# Charging -# {% else %} -# Not Charging -# {% endif %} -# icon: "mdi:battery-charging" - -# - platform: mqtt -# state_topic: "owntracks/suresh/suresh" -# name: "Suresh iPhone Battery State" -# value_template: > -# {% if value_json.charging == 1 %} -# Charging -# {% else %} -# Not Charging -# {% endif %} -# icon: "mdi:battery-charging" - -# - platform: mqtt -# state_topic: "owntracks/srinika/srinika" -# name: "Srinika iPhone Battery State" -# value_template: > -# {% if value_json.charging == 1 %} -# Charging -# {% else %} -# Not Charging -# {% endif %} -# icon: "mdi:battery-charging" - -# - platform: mqtt -# state_topic: "owntracks/hasika/hasika" -# name: "Hasika iPhone Battery State" -# value_template: > -# {% if value_json.charging == 1 %} -# Charging -# {% else %} -# Not Charging -# {% endif %} -# icon: "mdi:battery-charging" - -# - platform: mqtt -# state_topic: "owntracks/mallika/mallika" -# name: "Mallika iPhone Wifi State" -# value_template: > -# {% if value_json.conn == "w" %} -# Connected -# {% else %} -# Not Connected -# {% endif %} -# icon: "mdi:wifi" - -# - platform: mqtt -# state_topic: "owntracks/suresh/suresh" -# name: "Suresh iPhone Wifi State" -# value_template: > -# {% if value_json.conn == "w" %} -# Connected -# {% else %} -# Not Connected -# {% endif %} -# icon: "mdi:wifi" - -# - platform: mqtt -# state_topic: "owntracks/srinika/srinika" -# name: "Srinika iPhone Wifi State" -# value_template: > -# {% if value_json.conn == "w" %} -# Connected -# {% else %} -# Not Connected -# {% endif %} -# icon: "mdi:wifi" - -# - platform: mqtt -# state_topic: "owntracks/hasika/hasika" -# name: "Hasika iPhone Wifi State" -# value_template: > -# {% if value_json.conn == "w" %} -# Connected -# {% else %} -# Not Connected -# {% endif %} -# icon: "mdi:wifi" - -# - platform: mqtt -# state_topic: "owntracks/mallika/mallika" -# name: "Mallika Driving Speed" -# value_template: "{{ value_json.vel |int|round}}" -# unit_of_measurement: miles - -# - platform: mqtt -# state_topic: "owntracks/suresh/suresh" -# name: "Suresh Driving Speed" -# value_template: "{{ value_json.vel |int|round}}" -# unit_of_measurement: miles - -# - platform: mqtt -# state_topic: "owntracks/srinika/srinika" -# name: "Srinika Driving Speed" -# value_template: "{{ value_json.vel |int|round}}" -# unit_of_measurement: miles - -# - platform: mqtt -# state_topic: "owntracks/hasika/hasika" -# name: "Hasika Driving Speed" -# value_template: "{{ value_json.vel |int|round}}" -# unit_of_measurement: miles - -# - platform: template -# sensors: -# suresh_iphone_battery_ot: -# unit_of_measurement: "%" -# value_template: > -# {% if states('sensor.suresh_iphone_battery_ot') != "unknown" %} -# {{ states('sensor.suresh_iphone_battery_ot')| int }} -# {% else %} -# 0 -# {% endif %} -# icon_template: >- -# {% if states('sensor.suresh_iphone_battery_ot') != "unknown" %} -# {% set battery_level = states('sensor.suresh_iphone_battery_ot')|int (-1)%} -# {% set battery_round = (battery_level|int / 10)|int * 10 %} -# {% if states('sensor.suresh_iphone_battery_state') | lower == "charging" %} -# {% if battery_level == -1 %} -# mdi:battery-unknown -# {% else %} -# {% if battery_round >= 100 %} -# mdi:battery-charging-100 -# {% elif battery_round > 0 %} -# mdi:battery-charging-{{ battery_round }} -# {% else %} -# mdi:battery-alert -# {% endif %} -# {% endif %} -# {% else %} -# {% if battery_level == -1 %} -# mdi:battery-unknown -# {% else %} -# {% if battery_round >= 100 %} -# mdi:battery -# {% elif battery_round > 0 %} -# mdi:battery-{{ battery_round }} -# {% else %} -# mdi:battery-alert -# {% endif %} -# {% endif %} -# {% endif %} -# {% else %} -# mdi:battery-alert -# {% endif %} - -# - platform: template -# sensors: -# mallika_iphone_battery_ot: -# unit_of_measurement: "%" -# value_template: "{{ states('sensor.mallika_iphone_battery_ot')|int(-1) }}" -# icon_template: >- -# {% if states('sensor.mallika_iphone_battery_ot') != "unknown" %} -# {% set battery_level = states('sensor.mallika_iphone_battery_ot')|int (-1)%} -# {% set battery_round = (battery_level|int / 10)|int * 10 %} -# {% if states('sensor.mallika_iphone_battery_state') | lower == "charging" %} -# {% if battery_level == -1 %} -# mdi:battery-unknown -# {% else %} -# {% if battery_round >= 100 %} -# mdi:battery-charging-100 -# {% elif battery_round > 0 %} -# mdi:battery-charging-{{ battery_round }} -# {% else %} -# mdi:battery-alert -# {% endif %} -# {% endif %} -# {% else %} -# {% if battery_level == -1 %} -# mdi:battery-unknown -# {% else %} -# {% if battery_round >= 100 %} -# mdi:battery -# {% elif battery_round > 0 %} -# mdi:battery-{{ battery_round }} -# {% else %} -# mdi:battery-alert -# {% endif %} -# {% endif %} -# {% endif %} -# {% else %} -# mdi:battery-alert -# {% endif %} - -# - platform: template -# sensors: -# srinika_iphone_battery_ot: -# unit_of_measurement: "%" -# value_template: "{{ states('sensor.srinika_iphone_battery_ot')|int(-1) }}" -# icon_template: >- -# {% if states('sensor.srinika_iphone_battery_ot') != "unknown" %} -# {% set battery_level = states('sensor.srinika_iphone_battery_ot')|int (-1)%} -# {% set battery_round = (battery_level|int / 10)|int * 10 %} -# {% if states('sensor.srinika_iphone_battery_state') | lower == "charging" %} -# {% if battery_level == -1 %} -# mdi:battery-unknown -# {% else %} -# {% if battery_round >= 100 %} -# mdi:battery-charging-100 -# {% elif battery_round > 0 %} -# mdi:battery-charging-{{ battery_round }} -# {% else %} -# mdi:battery-alert -# {% endif %} -# {% endif %} -# {% else %} -# {% if battery_level == -1 %} -# mdi:battery-unknown -# {% else %} -# {% if battery_round >= 100 %} -# mdi:battery -# {% elif battery_round > 0 %} -# mdi:battery-{{ battery_round }} -# {% else %} -# mdi:battery-alert -# {% endif %} -# {% endif %} -# {% endif %} -# {% else %} -# mdi:battery-alert -# {% endif %} - -# - platform: template -# sensors: -# hasika_iphone_battery_ot: -# unit_of_measurement: "%" -# value_template: "{{ states('sensor.hasika_iphone_battery_ot')|int(-1) }}" -# icon_template: >- -# {% if states('sensor.hasika_iphone_battery_ot') != "unknown" %} -# {% set battery_level = states('sensor.hasika_iphone_battery_ot')|int (-1)%} -# {% set battery_round = (battery_level|int / 10)|int * 10 %} -# {% if states('sensor.hasika_iphone_battery_state') | lower == "charging" %} -# {% if battery_level == -1 %} -# mdi:battery-unknown -# {% else %} -# {% if battery_round >= 100 %} -# mdi:battery-charging-100 -# {% elif battery_round > 0 %} -# mdi:battery-charging-{{ battery_round }} -# {% else %} -# mdi:battery-alert -# {% endif %} -# {% endif %} -# {% else %} -# {% if battery_level == -1 %} -# mdi:battery-unknown -# {% else %} -# {% if battery_round >= 100 %} -# mdi:battery -# {% elif battery_round > 0 %} -# mdi:battery-{{ battery_round }} -# {% else %} -# mdi:battery-alert -# {% endif %} -# {% endif %} -# {% endif %} -# {% else %} -# mdi:battery-alert -# {% endif %} - -# ############################################################################### -# # _ _ _ -# # /\ | | | | (_) -# # / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___ -# # / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __| -# # / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \ -# # /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/ -# # -# ############################################################################### - -# automation: -# # -# # This automation alerts family members when they are "moving" - meaning either in driving from work, -# # kids got on the school bus, and bus is moving...etc -# # This will only announces/ alert when someone is at home. -# # -# - alias: Alert When Moving -# trigger: -# platform: numeric_state -# entity_id: -# - sensor.suresh_driving_speed -# - sensor.mallika_driving_speed -# - sensor.srinika_driving_speed -# - sensor.hasika_driving_speed -# above: 8 -# condition: -# - condition: template -# value_template: > -# {%- if state_attr('automation.alert_when_moving', 'last_triggered') -%} -# {{ (as_timestamp(now()) - as_timestamp(state_attr('automation.alert_when_moving', 'last_triggered'))) > 300 }} -# {%- else -%} -# true -# {%- endif -%} -# - condition: template -# value_template: "{{ states('input_boolean.home_mode_away') == 'off' }}" -# - condition: template -# value_template: "{{ states('alarm_control_panel.home') | lower != 'armed_away' }}" -# action: -# - service: script.voice_notify -# data_template: -# message: >- -# {% set apostrophe = "\'" %} -# {{ trigger.entity_id.split('.')[1].split('_')[0] |title ~ apostrophe ~ 's' }} vehicle is in motion. -# - service: script.notify_me -# data_template: -# message: >- -# {% set apostrophe = "\'" %} -# {{ trigger.entity_id.split('.')[1].split('_')[0] |title ~ apostrophe ~ 's' }} vehicle is going at {{ trigger.to_state.state |round *2 }} mph. - -# ############################################################################### -# # Automation: Notify of iPhone Low Battery -# ############################################################################### -# - alias: Notify Low battery -# initial_state: true -# trigger: -# platform: numeric_state -# entity_id: -# - device_tracker.life360_suresh -# - device_tracker.life360_mallika -# - device_tracker.life360_srinika -# - device_tracker.life360_hasika -# value_template: "{{ state.attributes.battery }}" -# below: 25 -# condition: -# - condition: template -# value_template: "{{ states('input_boolean.battery_notifications') == 'on' }}" -# action: -# - service: script.notify_me -# data_template: -# message: "{{ trigger.to_state.attributes.friendly_name.split(' ')[1] | title }}'s phone battery is : {{ trigger.to_state.attributes.battery }}%." -# - service: script.voice_notify -# data_template: -# message: "{{ trigger.to_state.attributes.friendly_name.split(' ')[1] }}'s phone battery is : {{ trigger.to_state.attributes.battery }}%." -# - service: script.led_message -# data_template: -# message: "{{ trigger.to_state.attributes.friendly_name.split(' ')[1] }}'s phone battery is : {{ trigger.to_state.attributes.battery }}%." - -# # - alias: Alert Low Battery -# # trigger: -# # - platform: template -# # value_template: > -# # {% set ns = namespace(lowBattery=false) %} -# # {%- for x in states if x.attributes and x.attributes.battery_level and x.attributes.battery_level |int <= 24 %} -# # {% set ns.lowBattery = true %}{% endfor %} -# # {{ ns.lowBattery }} -# # condition: -# # - condition: template -# # value_template: "{{ ((trigger.to_state.state | int) < states('sensor.battery_alert_threshold') | int) }}" -# # action: -# # - service: script.voice_notify -# # data_template: -# # message: > -# # {% set ns = namespace(lowBattery="") %} -# # {%- for x in states if x.attributes and x.attributes.battery_level and x.attributes.battery_level |int <= 24 %} -# # {%- if loop.first %}The {% elif loop.last %} and the {% else %}, the {% endif -%} -# # {% set ns.lowBattery = ns.lowBattery ~ ',' ~ x.name %} -# # {%- endfor %} -# # {{ ns.lowBattery -}} -# # {{- ' battery is ' if ns.lowBattery.split(',')|count == 2 else ' batteries are ' -}} less than 25 percent. -# # - service: script.led_message -# # data_template: -# # message: "{{ trigger.to_state.attributes.friendly_name.split(' ')[1] }}'s phone battery is : {{ trigger.to_state.attributes.battery }}%." - -# - alias: Check Wi-Fi Status of iPhones At Home -# initial_state: true -# trigger: -# - platform: state -# entity_id: -# - device_tracker.life360_mallika -# - device_tracker.life360_suresh -# - device_tracker.life360_srinika -# - device_tracker.life360_hasika -# from: "not_home" -# to: "home" -# for: "00:05:00" -# condition: -# condition: or -# conditions: -# - condition: state -# entity_id: sensor.hasika_iphone_wifi_state -# state: "Not Connected" -# - condition: state -# entity_id: sensor.mallika_iphone_wifi_state -# state: "Not Connected" -# - condition: state -# entity_id: sensor.srinika_iphone_wifi_state -# state: "Not Connected" -# - condition: state -# entity_id: sensor.suresh_iphone_wifi_state -# state: "Not Connected" -# action: -# - service: script.notify_me -# data_template: -# message: > -# {% set member = trigger.entity_id.split('.')[1].split('_')[0] %} -# {{ member | title }}'s iPhone is not connected to Wi-Fi at home! -# - service: script.voice_notify -# data_template: -# message: > -# {% set member = trigger.entity_id.split('.')[1].split('_')[0] %} -# {{ member | title }}'s iPhone is not connected to Wi-Fi at home! + - alias: Alert Low Battery of Sensors + trigger: + platform: time + at: "10:10:10" + condition: + - condition: template + value_template: > + {% set ns = namespace(lowBattery=false) %} + {%- for x in states if "battery_level" in x["attributes"] and x.attributes.battery_level |int <= 25 %} + {% set ns.lowBattery = true %}{% endfor %} + {{ ns.lowBattery }} + - condition: template + value_template: "{{ states('input_boolean.battery_alerts') == 'on' }}" + action: + - service: script.notify_family + data_template: + message: > + Sensors with low batteries (<25): + {% set ns = namespace(lowBattery="") -%} + {%- for x in states if "battery_level" in x["attributes"] and x.attributes["battery_level"] |int <= 25 -%} + {%- set ns.lowBattery = ns.lowBattery + x.name + "- " + x.attributes["battery_level"]|round|string + "\n" -%} + {%- endfor -%} + {{- ns.lowBattery -}} + notify_options: + - telegram + - tv + - led diff --git a/packages/cameras.yaml b/packages/cameras.yaml index 3446b09..e7f0295 100644 --- a/packages/cameras.yaml +++ b/packages/cameras.yaml @@ -293,7 +293,7 @@ automation: to: "on" action: - condition: template - value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}" + value_template: "{{ states('input_boolean.camera_alerts') == 'on' }}" - service: script.frontdoor_cam # change to front door camera stream on chromecast - condition: template value_template: "{{ states('alarm_control_panel.home') == 'armed_home' or states('alarm_control_panel.home') == 'armed_away' }}" @@ -392,7 +392,7 @@ automation: to: "on" action: - condition: template - value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}" + value_template: "{{ states('input_boolean.camera_alerts') == 'on' }}" - service: script.stream2chromecast data_template: url: !secret driveway_camera_stream_url @@ -495,7 +495,7 @@ automation: to: "on" condition: - condition: template - value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}" + value_template: "{{ states('input_boolean.camera_alerts') == 'on' }}" - condition: template value_template: "{{ states('alarm_control_panel.home') == 'armed_home' or states('alarm_control_panel.home') == 'armed_away' }}" action: @@ -591,7 +591,7 @@ automation: to: "on" action: - condition: template - value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}" + value_template: "{{ states('input_boolean.camera_alerts') == 'on' }}" - service: script.stream2chromecast data_template: url: !secret playarea_camera_stream_url @@ -711,7 +711,7 @@ automation: to: "on" condition: - condition: template - value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}" + value_template: "{{ states('input_boolean.camera_alerts') == 'on' }}" - condition: template value_template: "{{ states('alarm_control_panel.home') == 'armed_home' or states('alarm_control_panel.home') == 'armed_away' }}" action: @@ -818,7 +818,7 @@ automation: to: "on" condition: - condition: template - value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}" + value_template: "{{ states('input_boolean.camera_alerts') == 'on' }}" - condition: template value_template: "{{ states('alarm_control_panel.home') == 'armed_home' or states('alarm_control_panel.home') == 'armed_away' }}" action: @@ -909,7 +909,7 @@ automation: to: "on" condition: - condition: template - value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}" + value_template: "{{ states('input_boolean.camera_alerts') == 'on' }}" - condition: template value_template: "{{ states('alarm_control_panel.home') == 'armed_home' or states('alarm_control_panel.home') == 'armed_away' }}" action: diff --git a/packages/door_sensors.yaml b/packages/door_sensors.yaml index fd32ce6..b9a04bd 100644 --- a/packages/door_sensors.yaml +++ b/packages/door_sensors.yaml @@ -1,24 +1,6 @@ homeassistant: customize: package.door_sensors: - door_notification_script: &door_notification_script - message: > - {% set doors = "" %} - {% if states('binary_sensor.door_window_sensor_158d0004231f7b') == "on" and - states('binary_sensor.door_window_sensor_158d0004248d5b') == "on" %} - {% set doors = "Attention! Both Garage Doors are OPEN" %} - {% elif states('binary_sensor.door_window_sensor_158d0004231f7b') == "off" and - states('binary_sensor.door_window_sensor_158d0004248d5b') == "off" %} - {% set doors = "Both Garage Doors are now CLOSED" %} - {% else %} - {% if trigger.from_state.state != trigger.to_state.state and trigger.to_state.state | lower == "on" %} - Attention! Your {{ trigger.to_state.attributes.friendly_name }} is now OPENED! - {% elif trigger.from_state.state != trigger.to_state.state and trigger.to_state.state | lower == "off" %} - Your {{ trigger.to_state.attributes.friendly_name }} is now CLOSED! - {% endif %} - {% endif %} - {{ doors }} - sensor: - platform: template sensors: @@ -125,85 +107,72 @@ automation: trigger: platform: state entity_id: - - binary_sensor.door_window_sensor_158d0004231f7b # 2 Car Garage - binary_sensor.door_window_sensor_158d0004248d5b # Single car garage - condition: - - condition: template - value_template: "{{ trigger.from_state.state != trigger.to_state.state }}" - - condition: template - value_template: "{{ trigger.from_state.state not in ['unavailable', 'unknown'] }}" - - condition: template - value_template: "{{ trigger.to_state.state not in ['unavailable', 'unknown'] }}" - - condition: template - value_template: "{{ states('input_boolean.garage_door_notifications') == 'on' }}" + - binary_sensor.door_window_sensor_158d0004231f7b # 2 Car Garage action: - service: switch.turn_on entity_id: switch.garage - service: script.notify_family data_template: - <<: *door_notification_script - notify_options: ["voice", "led", "tv"] + message: > + {% set doors = "" %} + {% if states('binary_sensor.door_window_sensor_158d0004231f7b') == "on" and + states('binary_sensor.door_window_sensor_158d0004248d5b') == "on" %} + {% set doors = "Attention! Both Garage Doors are OPEN" %} + {% elif states('binary_sensor.door_window_sensor_158d0004231f7b') == "off" and + states('binary_sensor.door_window_sensor_158d0004248d5b') == "off" %} + {% set doors = "Both Garage Doors are now CLOSED" %} + {% else %} + {% if trigger.from_state.state != trigger.to_state.state and trigger.to_state.state | lower == "on" %} + {% set doors = "Attention! Your {{ trigger.to_state.attributes.friendly_name }} is now OPENED!" %} + {% elif trigger.from_state.state != trigger.to_state.state and trigger.to_state.state | lower == "off" %} + {% set doors = "Your {{ trigger.to_state.attributes.friendly_name }} is now CLOSED!" %} + {% endif %} + {% endif %} + {{ doors }} - {{ trigger.to_state.attributes.friendly_name }}: from '{{trigger.from_state.state}}'', to: '{{ trigger.to_state.state }}' + notify_options: + - voice + - led + - tv + - email + - telegram - delay: "00:00:05" - service: camera.snapshot data_template: entity_id: "camera.garage" - filename: - "{{ '/config/www/downloads/camera/garage/garage_' ~ + filename: "{{ '/config/www/downloads/camera/garage/garage_' ~ ((state_attr('automation.notify_garage_door_status', 'last_triggered') |string).replace('-','_') .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg') }}" - - - service: script.notify_family - data_template: - title: "{{ trigger.to_state.attributes.friendly_name }}: {{ 'OPEN' if trigger.to_state.state == 'on' else 'CLOSED' }}" - message: >- - {%- set doors = "" -%} - {%- if states('binary_sensor.door_window_sensor_158d0004231f7b') == "on" and - states('binary_sensor.door_window_sensor_158d0004248d5b') == "on" -%} - {% set doors = "Both Garage Doors are OPEN" -%} - {%- elif states('binary_sensor.door_window_sensor_158d0004231f7b') == "off" and - states('binary_sensor.door_window_sensor_158d0004248d5b') == "off" -%} - {% set doors = "Both Garage Doors are CLOSED" -%} - {%- else -%} - {% set doors = states.binary_sensor.door_window_sensor_158d0004248d5b.name ~ " is " ~ - ('Closed' if states('binary_sensor.door_window_sensor_158d0004248d5b') == 'off' else 'OPEN') - ~ " and " ~ state_attr('binary_sensor.door_window_sensor_158d0004231f7b', 'friendly_name') ~ " is " ~ - ('Closed' if states('binary_sensor.door_window_sensor_158d0004231f7b') == 'off' else 'OPEN') %} - {%- endif %} - Your {{doors}} on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please check the garage snapshot below. - url: > - {{ '/config/www/downloads/camera/garage/garage_' ~ - ((state_attr('automation.notify_garage_door_status', 'last_triggered') |string).replace('-','_') - .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg') }} - notify_options: - - telegram - - - service: notify.notify_smtp - data_template: - title: 'Garage Door Status {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}' - message: >- - {%- set doors = "" -%} - {%- if states('binary_sensor.door_window_sensor_158d0004231f7b') == "on" and - states('binary_sensor.door_window_sensor_158d0004248d5b') == "on" -%} - {%- set doors = "Both Garage Doors are OPEN" -%} - {%- elif states('binary_sensor.door_window_sensor_158d0004231f7b') == "off" and - states('binary_sensor.door_window_sensor_158d0004248d5b') == "off" -%} - {%- set doors = "Both Garage Doors are CLOSED" -%} - {%- else -%} - {%- set doors = states.binary_sensor.door_window_sensor_158d0004248d5b.name ~ " is " ~ - ('Closed' if states('binary_sensor.door_window_sensor_158d0004248d5b') == 'off' else 'OPEN') - ~ " and " ~ state_attr('binary_sensor.door_window_sensor_158d0004231f7b', 'friendly_name') ~ " is " ~ - ('Closed' if states('binary_sensor.door_window_sensor_158d0004231f7b') == 'off' else 'OPEN') -%} - {%- endif -%} - Your {{doors}} on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please check the garage snapshot below. - data: - images: - - "{{ '/config/www/downloads/camera/garage/garage_' ~ - ((state_attr('automation.notify_garage_door_status', 'last_triggered') |string).replace('-','_') - .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg') }}" - - - service_template: "switch.turn_{{- trigger.to_state.state }}" + # - service: script.notify_family + # data_template: + # message: > + # {% set doors = "" %} + # {% if states('binary_sensor.door_window_sensor_158d0004231f7b') == "on" and + # states('binary_sensor.door_window_sensor_158d0004248d5b') == "on" %} + # {% set doors = "Attention! Both Garage Doors are OPEN" %} + # {% elif states('binary_sensor.door_window_sensor_158d0004231f7b') == "off" and + # states('binary_sensor.door_window_sensor_158d0004248d5b') == "off" %} + # {% set doors = "Both Garage Doors are now CLOSED" %} + # {% else %} + # {% if trigger.from_state.state != trigger.to_state.state and trigger.to_state.state | lower == "on" %} + # {% set doors = "Attention! Your {{ trigger.to_state.attributes.friendly_name }} is now OPENED!" %} + # {% elif trigger.from_state.state != trigger.to_state.state and trigger.to_state.state | lower == "off" %} + # {% set doors = "Your {{ trigger.to_state.attributes.friendly_name }} is now CLOSED!" %} + # {% endif %} + # {% endif %} + # {{ doors }} + # url: > + # {{ '/config/www/downloads/camera/garage/garage_' ~ + # ((state_attr('automation.notify_garage_door_status', 'last_triggered') |string).replace('-','_') + # .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg') }} + # notify_options: + # - telegram + # - email + # - tv + - service: switch.turn_off entity_id: switch.garage + ############################################################################### # Notify Entry Door Status ############################################################################### - alias: Voice Notify Entry Door Status @@ -233,10 +202,13 @@ automation: Your {{ trigger.to_state.attributes.friendly_name.replace('Sensor', '') }} is CLOSED! {% endif %} notify_options: - - telegram + # - telegram - tv - led - - voice + + ############################################################################### + # Light automations when doors are opened + ############################################################################### - alias: When Front Door Opens Turn Front Room Lights ON initial_state: true @@ -304,12 +276,12 @@ automation: - service: timer.start entity_id: timer.timer_garage -############################################################################### -# MASTER BATHROOM AUTOMATIONS -############################################################################### -# -# Only turn ON lights at 25% at night -# + ############################################################################### + # MASTER BATHROOM AUTOMATIONS + ############################################################################### + # + # Only turn ON lights at 25% at night + # - alias: Master Bathroom Door Opened After Dark initial_state: true trigger: @@ -379,9 +351,9 @@ automation: data_template: entity_id: switch.master_bathroom_toilet_light -############################################################################### -# GUEST BATHROOM AUTOMATIONS -############################################################################### + ############################################################################### + # GUEST BATHROOM AUTOMATIONS + ############################################################################### - alias: Guest Bathroom Door Opened initial_state: true diff --git a/packages/homesecurity.yaml b/packages/homesecurity.yaml index 9a2f373..31d0108 100644 --- a/packages/homesecurity.yaml +++ b/packages/homesecurity.yaml @@ -55,11 +55,11 @@ automation: script.xiaomi_red {% endif %} -# -# This automation will trigger when the Home Security System is "Triggered" -# This will send all relevant information - Door Statuses and Camera snapshots around the home -# Meanwhile Home Security Company will be calling and/or dispatching Police over to the house. -# This should give you enough information to have a good conversation with the Home Security System company when not at home + # + # This automation will trigger when the Home Security System is "Triggered" + # This will send all relevant information - Door Statuses and Camera snapshots around the home + # Meanwhile Home Security Company will be calling and/or dispatching Police over to the house. + # This should give you enough information to have a good conversation with the Home Security System company when not at home - alias: Home Security Triggered initial_state: true @@ -67,6 +67,9 @@ automation: platform: state entity_id: alarm_control_panel.home to: "triggered" + condition: + - condition: template + value_template: "{{ states('input_boolean.security_system_alerts') == 'on' }}" action: - service: script.notify_family data_template: @@ -95,40 +98,34 @@ automation: - led - voice - - service: camera.snapshot data_template: entity_id: "camera.frontdoor_camera" - filename: - "{{ '/config/www/downloads/camera/frontdoor/frontdoor_' ~ + filename: "{{ '/config/www/downloads/camera/frontdoor/frontdoor_' ~ (states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_') .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" - service: camera.snapshot data_template: entity_id: "camera.driveway_camera" - filename: - "{{ '/config/www/downloads/camera/driveway/driveway_' ~ + filename: "{{ '/config/www/downloads/camera/driveway/driveway_' ~ (states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_') .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" - service: camera.snapshot data_template: entity_id: "camera.garage" - filename: - "{{ '/config/www/downloads/camera/garage/garage_' ~ + filename: "{{ '/config/www/downloads/camera/garage/garage_' ~ (states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_') .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" - service: camera.snapshot data_template: entity_id: "camera.patio_camera" - filename: - "{{ '/config/www/downloads/camera/patio/patio_' ~ + filename: "{{ '/config/www/downloads/camera/patio/patio_' ~ (states.binary_sensor.motion_sensor_158d00024e842c.last_updated ~ '').replace('-','_') .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" - service: camera.snapshot data_template: entity_id: "camera.playarea_camera" - filename: - "{{ '/config/www/downloads/camera/playarea/playarea_' ~ + filename: "{{ '/config/www/downloads/camera/playarea/playarea_' ~ (states.binary_sensor.motion_sensor_158d00024e842c.last_updated ~ '').replace('-','_') .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" @@ -139,24 +136,24 @@ automation: data: photo: - file: "{{ '/config/www/downloads/camera/frontdoor/frontdoor_' ~ - (states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_') - .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" + (states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_') + .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" caption: "Front Door" - file: "{{ '/config/www/downloads/camera/driveway/driveway_' ~ - (states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_') - .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" + (states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_') + .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" caption: "Driveway" - file: "{{ '/config/www/downloads/camera/garage/garage_' ~ - (states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_') - .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" + (states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_') + .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" caption: "Garage" - file: "{{ '/config/www/downloads/camera/patio/patio_' ~ - (states.binary_sensor.motion_sensor_158d00024e842c.last_updated ~ '').replace('-','_') - .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" + (states.binary_sensor.motion_sensor_158d00024e842c.last_updated ~ '').replace('-','_') + .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" caption: "Patio" - file: "{{ '/config/www/downloads/camera/playarea/playarea_' ~ - (states.binary_sensor.motion_sensor_158d00024e842c.last_updated ~ '').replace('-','_') - .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" + (states.binary_sensor.motion_sensor_158d00024e842c.last_updated ~ '').replace('-','_') + .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" caption: "Playarea" ############################################################################### @@ -195,11 +192,11 @@ automation: - tv - led - voice - + - condition: template value_template: "{{ states('alarm_control_panel.home') != 'disarmed' }}" - service: input_boolean.turn_on - entity_id: input_boolean.notify_camera_alerts + entity_id: input_boolean.camera_alerts ############################################################################### # A gentle 10 minute reminder that the Home Security system is OFF @@ -212,6 +209,9 @@ automation: to: "disarmed" for: minutes: 10 + condition: + - condition: template + value_template: "{{ states('input_boolean.security_system_alerts') == 'on' }}" action: - service: script.notify_family data: @@ -274,18 +274,20 @@ automation: - tv - led -############################################################################### -# Check for Garage Door Status when Home Security System State changes -############################################################################### + ############################################################################### + # Check for Garage Door Status when Home Security System State changes + ############################################################################### - alias: Home Security System And Garage Door Check initial_state: true trigger: - platform: time_pattern - minutes: '/15' + minutes: "/15" seconds: 00 condition: condition: and conditions: + - condition: template + value_template: "{{ states('input_boolean.security_system_alerts') == 'on' }}" - condition: template value_template: "{{ states('alarm_control_panel.home') == 'armed_home' or states('alarm_control_panel.home') == 'armed_away' }}" - condition: or @@ -306,11 +308,10 @@ automation: message: > Attention! Your home Security system is set to {{ states('alarm_control_panel.home').split('_')[1] | upper }} mode. BUT THE {% if states('binary_sensor.door_window_sensor_158d0004231f7b') == "on" -%}DOUBLE CAR {%- else %}SINGLE CAR {% endif %}GARAGE DOOR IS STILL OPEN! url: "{{ '/config/www/downloads/camera/garage/garage_' ~ - (states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_') - .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" + (states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_') + .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" notify_options: - telegram - tv - led - voice - diff --git a/packages/led_notify.yaml b/packages/led_notify.yaml index a584889..029ae99 100644 --- a/packages/led_notify.yaml +++ b/packages/led_notify.yaml @@ -97,7 +97,9 @@ automation: - condition: template value_template: "{{ states('input_boolean.zone_alerts') == 'on' }}" action: - - service: script.led_message + - service: script.notify_family data_template: message: > {{ trigger.entity_id.split('.')[1].split('_')[1] | title}} just entered {{ trigger.zone.attributes.friendly_name }}! + notify_options: + - led diff --git a/packages/motion_counts.yaml b/packages/motion_counts.yaml deleted file mode 100644 index 1300eea..0000000 --- a/packages/motion_counts.yaml +++ /dev/null @@ -1,195 +0,0 @@ -homeassistant: - customize: - input_label.back_door_sensor_sensor: - unit_of_measurement: "count" - input_label.basement_door_sensor_sensor: - unit_of_measurement: "count" - input_label.front_room_window_sensor_sensor: - unit_of_measurement: "count" - input_label.garage_door_sensor_sensor: - unit_of_measurement: "count" - input_label.garage_motion: - unit_of_measurement: "count" - input_label.kitchen_motion_sensor_sensor: - unit_of_measurement: "count" - input_label.motion_sensor_158d00016c2d0e: - unit_of_measurement: "count" - input_label.motion_sensor_158d00016db6d2: - unit_of_measurement: "count" - input_label.motion_sensor_158d0001a25041: - unit_of_measurement: "count" - input_label.motion_sensor_158d0001a662fe: - unit_of_measurement: "count" - input_label.motion_sensor_158d00024e57d3: - unit_of_measurement: "count" - input_label.motion_sensor_158d00024e57fb: - unit_of_measurement: "count" - input_label.motion_sensor_158d00024e842c: - unit_of_measurement: "count" - input_label.motion_sensor_158d00024ee084: - unit_of_measurement: "count" - input_label.motion_sensor_158d000272bed1: - unit_of_measurement: "count" - input_label.motion_sensor_158d00047b6f69: - unit_of_measurement: "count" - input_label.motion_sensor_158d000272bf48: - unit_of_measurement: "count" - input_label.motion_sensor_158d000272bfd7: - unit_of_measurement: "count" - input_label.single_car_garage_door_tilt_sensor_sensor: - unit_of_measurement: "count" - input_label.stairs_motion_sensor_sensor: - unit_of_measurement: "count" - input_label.two_car_garage_door_tilt_sensor_sensor: - unit_of_measurement: "count" - input_label.door_window_sensor_158d0004231f7b: - unit_of_measurement: "count" - input_label.door_window_sensor_158d0004248d5b: - unit_of_measurement: "count" - input_label.door_window_sensor_158d00040ad8fc: - unit_of_measurement: "count" - input_label.door_window_sensor_158d0004880f30: - unit_of_measurement: "count" - input_label.door_window_sensor_158d000424a6d6: - unit_of_measurement: "count" - -input_label: - door_window_sensor_158d000424a6d6: - name: Front Door - icon: mdi:run-fast - door_window_sensor_158d00040ad8fc: - name: Back Door - icon: mdi:run-fast - door_window_sensor_158d0004880f30: - name: Garage Entry Door - icon: mdi:run-fast - basement_door_sensor_sensor: - name: Basement Door - icon: mdi:run-fast - garage_door_sensor_sensor: - name: Garage Door - icon: mdi:run-fast - - front_room_window_sensor_sensor: - name: Front Room Sensor - icon: mdi:run-fast - garage_motion: - name: Garage Motion - icon: mdi:run-fast - kitchen_motion_sensor_sensor: - name: Kitchen Motion - icon: mdi:run-fast - motion_sensor_158d00016c2d0e: - name: Dining Room Motion (Xiaomi) - icon: mdi:run-fast - motion_sensor_158d00016db6d2: - name: Front Room Motion (Xiaomi) - icon: mdi:run-fast - motion_sensor_158d0001a25041: - name: Family Room (Xiaomi) - icon: mdi:run-fast - motion_sensor_158d0001a662fe: - name: Kitchen (Xiaomi) - icon: mdi:run-fast - motion_sensor_158d00024e57d3: - name: Master Bedroom (Xiaomi) - icon: mdi:run-fast - motion_sensor_158d00024e57fb: - name: Driveway Motion (Xiaomi) - icon: mdi:run-fast - motion_sensor_158d00024e842c: - name: Backyard Motion (Xiaomi) - icon: mdi:run-fast - motion_sensor_158d00024ee084: - name: Front Door Motion (Xiaomi) - icon: mdi:run-fast - motion_sensor_158d000272bed1: - name: Srinika Bedroom (Xiaomi) - icon: mdi:run-fast - motion_sensor_158d00047b6f69: - name: Hasika Bedroom (Xiaomi) - icon: mdi:run-fast - - motion_sensor_158d000272bf48: - name: Garage Motion (Xiaomi) - icon: mdi:run-fast - motion_sensor_158d000272bfd7: - name: Office Room Motion (Xiaomi) - icon: mdi:run-fast - - door_window_sensor_158d0004248d5b: - name: Single Car Garage Door - icon: mdi:run-fast - door_window_sensor_158d0004231f7b: - name: Double Car Garage Door - icon: mdi:run-fast - stairs_motion_sensor_sensor: - name: Stairs Motion - icon: mdi:run-fast - -automation: - - alias: Count Motions - trigger: - - platform: state - to: "on" - entity_id: - - binary_sensor.door_window_sensor_158d000424a6d6 - - binary_sensor.door_window_sensor_158d00040ad8fc - - binary_sensor.door_window_sensor_158d0004880f30 # garage entry door - - binary_sensor.basement_door_sensor_sensor - - binary_sensor.front_room_window_sensor_sensor - - binary_sensor.garage_door_sensor_sensor - - binary_sensor.garage_motion - - binary_sensor.kitchen_motion_sensor_sensor - - binary_sensor.motion_sensor_158d00016c2d0e - - binary_sensor.motion_sensor_158d00016db6d2 - - binary_sensor.motion_sensor_158d0001a25041 - - binary_sensor.motion_sensor_158d0001a662fe - - binary_sensor.motion_sensor_158d00024e57d3 - - binary_sensor.motion_sensor_158d00024e57fb - - binary_sensor.motion_sensor_158d00024e842c - - binary_sensor.motion_sensor_158d00024ee084 - - binary_sensor.motion_sensor_158d000272bed1 - - binary_sensor.motion_sensor_158d00047b6f69 - - binary_sensor.motion_sensor_158d000272bf48 - - binary_sensor.motion_sensor_158d000272bfd7 - - binary_sensor.stairs_motion_sensor_sensor - - binary_sensor.door_window_sensor_158d0004248d5b # Single Car Garage - - binary_sensor.door_window_sensor_158d0004231f7b # Double Car Garage - action: - - service: input_label.set_value - data_template: - entity_id: "input_label.{{ trigger.entity_id.split('.')[1] }}" - value: > - {% set cur_value = states("input_label." ~ trigger.entity_id.split('.')[1] ) | int %} - {{ cur_value + 1 }} - - - alias: Reset Motion Counters At Midnight - trigger: - - platform: time - at: "00:00:00" - action: - - service: input_label.set_value - data: - value: 0 - entity_id: - - input_label.basement_door_sensor_sensor - - input_label.front_room_window_sensor_sensor - - input_label.garage_door_sensor_sensor - - input_label.garage_motion - - input_label.kitchen_motion_sensor_sensor - - input_label.motion_sensor_158d00016c2d0e - - input_label.motion_sensor_158d00016db6d2 - - input_label.motion_sensor_158d0001a25041 - - input_label.motion_sensor_158d0001a662fe - - input_label.motion_sensor_158d00024e57d3 - - input_label.motion_sensor_158d00024e57fb - - input_label.motion_sensor_158d00024e842c - - input_label.motion_sensor_158d00024ee084 - - input_label.motion_sensor_158d000272bed1 - - input_label.motion_sensor_158d00047b6f69 - - input_label.motion_sensor_158d000272bf48 - - input_label.motion_sensor_158d000272bfd7 - - input_label.door_window_sensor_158d000424a6d6 - - input_label.door_window_sensor_158d00040ad8fc - - input_label.door_window_sensor_158d0004880f30 diff --git a/packages/nest_thermostat.yaml b/packages/nest_thermostat.yaml index 1c6191a..3710068 100644 --- a/packages/nest_thermostat.yaml +++ b/packages/nest_thermostat.yaml @@ -55,3 +55,14 @@ automation: - tv - led - voice + +script: + ############################################################################### + # A script that toggles Nest Thermostat between eco/away & non-eco/away modes + ############################################################################### + toggle_climate: + sequence: + - service: climate.set_away_mode + data_template: + entity_id: climate.dining_room + away_mode: "{{ false if state_attr('climate.dining_room', 'away_mode') == 'on' else true }}" diff --git a/packages/notify.yaml b/packages/notify.yaml index cfce916..4ff17bb 100644 --- a/packages/notify.yaml +++ b/packages/notify.yaml @@ -64,6 +64,17 @@ telegram_bot: allowed_chat_ids: - !secret telegram_chatid + ############################################################################### + # _ _ _ _ __ + # | \ | | | | (_)/ _| + # | \| | ___ | |_ _| |_ _ _ + # | . ` |/ _ \| __| | _| | | | + # | |\ | (_) | |_| | | | |_| | + # |_| \_|\___/ \__|_|_| \__, | + # __/ | + # |___/ + # Notify Related Scripts + ############################################################################### script: notify_family: sequence: @@ -111,9 +122,9 @@ script: notify_firestick: sequence: - # - condition: state - # entity_id: input_boolean.firetv_alerts - # state: "on" + - condition: state + entity_id: input_boolean.firetv_alerts + state: "on" - condition: template value_template: "{{ 'tv' in notify_options }}" - service: notify.android_tv_fire_tv @@ -126,13 +137,17 @@ script: image: path: "{{ url }}" #/config/www/downloads/camera/driveway/driveway_20220604_185216.jpg icon: - path: /config/www/{{- [ "suresh.jpg", "srinika.jpg", "mallika.jpg", "hasika.jpg" ] | random -}} + path: > + /config/www/{{- [ "suresh.jpg", "srinika.jpg", "mallika.jpg", "hasika.jpg", + "bob.jpg", "butters.jpg", "eric.jpg", "gene.jpg", "kyle.jpg", "linda.jpg", + "lois.jpg", "louis.jpg", "meg.jpg", "morty.jpg", "peter.jpg", "quagmire.jpg", + "randy.jpg", "tina.jpg" ] | random -}} notify_telegram: sequence: - # - condition: state - # entity_id: input_boolean.text_alerts - # state: "on" + - condition: state + entity_id: input_boolean.telegram_alerts + state: "on" - condition: template value_template: "{{ 'telegram' in notify_options }}" - service: telegram_bot.send_message @@ -146,21 +161,21 @@ script: notify_email: sequence: - # - condition: state - # entity_id: input_boolean.email_alerts - # state: "on" + - condition: state + entity_id: input_boolean.email_alerts + state: "on" - condition: template value_template: "{{ 'email' in notify_options }}" - - service: script.notify_smtp + - service: notify.notify_smtp data_template: title: "{{ title }}" message: "{{ message }}" notify_voice: sequence: - # - condition: state - # entity_id: input_boolean.voice_alerts - # state: "on" + - condition: state + entity_id: input_boolean.voice_alerts + state: "on" - condition: template value_template: "{{ 'voice' in notify_options }}" - service: script.voice_notify @@ -169,12 +184,112 @@ script: notify_on_led_screen: sequence: - # - condition: state - # entity_id: input_boolean.led_alerts - # state: "on" + - condition: state + entity_id: input_boolean.led_notifications + state: "on" - condition: template value_template: "{{ 'led' in notify_options }}" - service: mqtt.publish data_template: topic: messageboard/messages payload: "{{ message }}" + + ############################################################################### + # Voice Notify + # Conditions: + # => Only Announce when people are home. Except in emergency mode! + # => Only Announce when Music is NOT being played + ############################################################################### + voice_notify: + sequence: + - condition: template + value_template: "{{ states('input_boolean.voice_notifications') == 'on' }}" + - condition: template + value_template: "{{ states('input_boolean.do_not_disturb') | lower == 'off' }}" + - condition: template + value_template: "{{ message | trim != '' }}" + - condition: template + value_template: "{{ states('input_boolean.home_mode_away') == 'off' }}" + - condition: template + value_template: > + {% if only_at_night | default('no', true ) == "yes" %} + {% if states('sun.sun') == "above_horizon" %} + false + {% else %} + true + {% endif %} + {% else %} + true + {% endif %} + - service: media_player.volume_set + entity_id: media_player.living_room, media_player.upstairs + data_template: + volume_level: > + {% if states('input_boolean.emergency_mode') == "on" %} + {{ states('input_number.tts_volume_level_alert') }} + {% else %} + {% if now().hour | int < 12 and now().hour | int > 6 %} + {{ states('input_number.tts_volume_level_morning') }} + {% elif now().hour|int > 12 and now().hour|int < 20 %} + {{ states('input_number.tts_volume_level_afternoon') }} + {% else %} + {{ states('input_number.tts_volume_level_evening') }} + {% endif %} + {% endif %} + - service: tts.amazon_polly_say + entity_id: media_player.living_room, media_player.upstairs + data_template: + cache: true + message: > + {% set msg = "" %} + {% macro getGreeting() %} + {% if greeting | default('yes', true ) == "yes" %} + {% if now().hour|int < 12 %} + Good morning. + {% elif now().hour|int < 18 %} + Good afternoon. + {% else %} + Good evening. + {% endif %} + {% endif %} + {% endmacro %} + {%- macro getEndGreeting() -%} + {%- if greeting |default('yes', true ) == "yes" -%} + Thank you! + {%- endif -%} + {%- endmacro -%} + {% set msg = msg + " " %} + {% set msg = msg + getGreeting() %} + {% set msg = msg + ". " + message %} + {% set msg = msg.replace(".", " ") %} + {% set msg = msg + " " + getEndGreeting() %} + {% set msg = msg + " " %} + {{ msg }} + + ############################################################################### + # Greeting + ############################################################################### + voice_greeting: + sequence: + - service: tts.amazon_polly_say + entity_id: media_player.living_room, media_player.upstairs + data_template: + cache: true + message: > + {% set msg = "" %} + {% macro getGreeting() %} + {% if greeting | default('yes', true ) == "yes" %} + {% if now().hour|int < 12 %} + Good morning. + {% elif now().hour|int < 18 %} + Good afternoon. + {% else %} + Good evening. + {% endif %} + {% endif %} + {% endmacro %} + {% set msg = msg + " " %} + {% set msg = msg + " " + getGreeting() %} + {% set msg = msg.replace(".", " ") %} + {% set msg = msg + " " %} + {{ msg }} diff --git a/packages/recycle_trash.yaml b/packages/recycle_trash.yaml index 70326dd..0bcaca6 100644 --- a/packages/recycle_trash.yaml +++ b/packages/recycle_trash.yaml @@ -282,7 +282,7 @@ automation: condition: and conditions: - condition: template - value_template: "{{ states('input_boolean.trash_reminders') == 'on' }}" + value_template: "{{ states('input_boolean.trash_alerts') == 'on' }}" - condition: template value_template: "{{ states('input_boolean.home_mode_away') == 'off' }}" - condition: or @@ -309,14 +309,14 @@ automation: - tv - led - - alias: Reset Trash Reminders + - alias: Reset Trash Alerts initial_state: true trigger: - platform: time at: "09:00:00" action: - service: input_boolean.turn_on - entity_id: input_boolean.trash_reminders + entity_id: input_boolean.trash_alerts - service: input_select.select_option data_template: entity_id: input_select.trash_pickup_day diff --git a/packages/scripts.yaml b/packages/scripts.yaml index d1d3cc6..af84e82 100644 --- a/packages/scripts.yaml +++ b/packages/scripts.yaml @@ -79,7 +79,7 @@ script: sequence: - service: script.all_indoor_lights_off - service: input_boolean.turn_on - entity_id: input_boolean.notify_camera_alerts + entity_id: input_boolean.camera_alerts - service: alarm_control_panel.alarm_arm_away data: entity_id: alarm_control_panel.home @@ -150,151 +150,20 @@ script: rgb_color: [0, 255, 0] ############################################################################### - # A script that toggles Nest Thermostat between eco/away & non-eco/away modes - ############################################################################### - toggle_climate: - sequence: - - service: climate.set_away_mode - data_template: - entity_id: climate.dining_room - away_mode: "{{ false if state_attr('climate.dining_room', 'away_mode') == 'on' else true }}" - - ############################################################################### - # _ _ _ _ __ - # | \ | | | | (_)/ _| - # | \| | ___ | |_ _| |_ _ _ - # | . ` |/ _ \| __| | _| | | | - # | |\ | (_) | |_| | | | |_| | - # |_| \_|\___/ \__|_|_| \__, | - # __/ | - # |___/ - # Notify Related Scripts - ############################################################################### - - good_night_tts: - sequence: - - service: script.voice_notify - data_template: - message: !include ../templates/goodnight.yaml - - ############################################################################### - # Voice Notify - # Conditions: - # => Only Announce when people are home. Except in emergency mode! - # => Only Announce when Music is NOT being played - ############################################################################### - voice_notify: - sequence: - - condition: template - value_template: "{{ states('input_boolean.voice_notifications') == 'on' }}" - - condition: template - value_template: "{{ states('input_boolean.do_not_disturb') | lower == 'off' }}" - - condition: template - value_template: "{{ message | trim != '' }}" - - condition: template - value_template: "{{ states('input_boolean.home_mode_away') == 'off' }}" - - condition: template - value_template: > - {% if only_at_night | default('no', true ) == "yes" %} - {% if states('sun.sun') == "above_horizon" %} - false - {% else %} - true - {% endif %} - {% else %} - true - {% endif %} - - service: media_player.volume_set - entity_id: media_player.living_room, media_player.upstairs - data_template: - volume_level: > - {% if states('input_boolean.emergency_mode') == "on" %} - {{ states('input_number.tts_volume_level_alert') }} - {% else %} - {% if now().hour | int < 12 and now().hour | int > 6 %} - {{ states('input_number.tts_volume_level_morning') }} - {% elif now().hour|int > 12 and now().hour|int < 20 %} - {{ states('input_number.tts_volume_level_afternoon') }} - {% else %} - {{ states('input_number.tts_volume_level_evening') }} - {% endif %} - {% endif %} - - service: tts.amazon_polly_say - entity_id: media_player.living_room, media_player.upstairs - data_template: - cache: true - message: > - {% set msg = "" %} - {% macro getGreeting() %} - {% if greeting | default('yes', true ) == "yes" %} - {% if now().hour|int < 12 %} - Good morning. - {% elif now().hour|int < 18 %} - Good afternoon. - {% else %} - Good evening. - {% endif %} - {% endif %} - {% endmacro %} - {%- macro getEndGreeting() -%} - {%- if greeting |default('yes', true ) == "yes" -%} - Thank you! - {%- endif -%} - {%- endmacro -%} - {% set msg = msg + " " %} - {% set msg = msg + getGreeting() %} - {% set msg = msg + ". " + message %} - {% set msg = msg.replace(".", " ") %} - {% set msg = msg + " " + getEndGreeting() %} - {% set msg = msg + " " %} - {{ msg }} - - ############################################################################### - # Greeting - ############################################################################### - voice_greeting: - sequence: - - service: tts.amazon_polly_say - entity_id: media_player.living_room, media_player.upstairs - data_template: - cache: true - message: > - {% set msg = "" %} - {% macro getGreeting() %} - {% if greeting | default('yes', true ) == "yes" %} - {% if now().hour|int < 12 %} - Good morning. - {% elif now().hour|int < 18 %} - Good afternoon. - {% else %} - Good evening. - {% endif %} - {% endif %} - {% endmacro %} - {% set msg = msg + " " %} - {% set msg = msg + " " + getGreeting() %} - {% set msg = msg.replace(".", " ") %} - {% set msg = msg + " " %} - {{ msg }} - - ############################################################################### - # Status around the house + # Status of the house ############################################################################### home_status: sequence: - - service: script.voice_notify + - service: script.notify_family data_template: message: !include ../templates/home_status.yaml + notify_options: + - voice - ############################################################################### - # Display message on LED Matrix Screen - ############################################################################### - led_message: + good_night_tts: sequence: - - condition: state - entity_id: input_boolean.led_alerts - state: "on" - - service: mqtt.publish + - service: script.notify_family data_template: - topic: messageboard/messages - payload: "{{ message }}" + message: !include ../templates/goodnight.yaml + notify_options: + - voice diff --git a/packages/settings.yaml b/packages/settings.yaml index 6058fda..13f3b26 100644 --- a/packages/settings.yaml +++ b/packages/settings.yaml @@ -194,19 +194,11 @@ sensor: ############################################################################### input_boolean: - voice_notifications: - name: Home Assistant Announcements - icon: mdi:volume-off - do_not_disturb: name: Do Not Disturb initial: off icon: mdi:do-not-disturb - led_alerts: - name: LED Messages - icon: mdi:led-strip - movie_time: name: "Movie Time" icon: mdi:movie-roll @@ -239,30 +231,34 @@ input_boolean: name: Nightly Report icon: mdi:file-chart - notify_camera_alerts: - name: Notify Camera Alerts - icon: mdi:camera - - trash_reminders: - name: Remind Trash Notifications - icon: mdi:recycle - enjoyable_weather_reminders: name: Remind me to enjoy Good Weather icon: mdi:weather-sunny security_system_alerts: - name: Notify Security System Status Change - icon: mdi:verified + name: Security System Alerts + icon: mdi:security + + trash_alerts: + name: Trash Alerts + icon: mdi:recycle + + garage_door_notifications: + name: Garage Door Alerts + icon: mdi:garage zone_alerts: name: Zone Alerts icon: mdi:map-marker - battery_notifications: - name: Battery Notifications + battery_alerts: + name: Battery Alerts icon: mdi:battery + camera_alerts: + name: Camera Alerts + icon: mdi:camera + dummy: name: "Dummy Input Boolean!" icon: mdi:sticker-emoji @@ -272,13 +268,26 @@ input_boolean: name: Light Automations icon: mdi:lightbulb-on - text_alerts: - name: Text Alerts - icon: mdi:map-marker + # Notifications + telegram_notifications: + name: Telegram Notifications + icon: mdi:message - garage_door_notifications: - name: Garage Door Notifications - icon: mdi:garage + firetv_notifications: + name: FireTV Notifications + icon: mdi:television + + email_notifications: + name: Email Notifications + icon: mdi:email + + voice_notifications: + name: Voice Notifications + icon: mdi:volume-off + + led_notifications: + name: LED Notifications + icon: mdi:led-strip ############################################################################### # _ _ _