mirror of
https://github.com/skalavala/mysmarthome.git
synced 2025-09-13 15:05:00 +00:00
added pill reminder package.
This commit is contained in:
@@ -218,6 +218,8 @@ automation:
|
||||
entity_id: switch.zwave_smart_switch_switch
|
||||
- service: switch.turn_on
|
||||
entity_id: switch.kids_bed_accent
|
||||
- service: switch.turn_on
|
||||
entity_id: switch.front_room
|
||||
|
||||
# ÛÛÛÛÛÛ ÛÛÛÛÛ ÛÛÛ ÛÛÛÛÛ ÛÛÛÛÛ
|
||||
# °°ÛÛÛÛÛÛ °°ÛÛÛ °°° °°ÛÛÛ °°ÛÛÛ
|
||||
|
@@ -227,7 +227,7 @@ automation:
|
||||
- binary_sensor.back_door_sensor_sensor
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{% if trigger.from_state %} True {% else %} False {% endif %}"
|
||||
value_template: "{{ trigger.from_state.state not in ['unavailable', 'unknown'] }}"
|
||||
action:
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
|
97
packages/led_notify.yaml
Normal file
97
packages/led_notify.yaml
Normal file
@@ -0,0 +1,97 @@
|
||||
homeassistant:
|
||||
|
||||
automation:
|
||||
###############################################################################
|
||||
# Display Weather Information on LED Screen
|
||||
###############################################################################
|
||||
- alias: Display Weather Changes on LED Screen
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: sensor.dark_sky_apparent_temperature, sensor.dark_sky_hourly_summary
|
||||
action:
|
||||
- service: script.led_message
|
||||
data_template:
|
||||
message: >
|
||||
{{ states('sensor.dark_sky_apparent_temperature') |int }} degrees, {{ states('sensor.dark_sky_hourly_summary') }}
|
||||
|
||||
###############################################################################
|
||||
# Display Garage Door Status on LED Screen
|
||||
###############################################################################
|
||||
- alias: Notify Garage Door Status on LED Screen
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id:
|
||||
- binary_sensor.two_car_garage_door_tilt_sensor_sensor
|
||||
- binary_sensor.single_car_garage_door_tilt_sensor_sensor
|
||||
condition:
|
||||
- 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' }}"
|
||||
action:
|
||||
- service: script.led_message
|
||||
data_template:
|
||||
message: >
|
||||
{% set doors = "" %}
|
||||
{% if states('binary_sensor.two_car_garage_door_tilt_sensor_sensor') == "on" and
|
||||
states('binary_sensor.single_car_garage_door_tilt_sensor_sensor') == "on" %}
|
||||
{% set doors = "Attention! Both Garage Doors are OPEN" %}
|
||||
{% elif states('binary_sensor.two_car_garage_door_tilt_sensor_sensor') == "off" and
|
||||
states('binary_sensor.single_car_garage_door_tilt_sensor_sensor') == "off" %}
|
||||
{% set doors = "Both Garage Doors are now CLOSED" %}
|
||||
{% else %}
|
||||
{% if trigger.to_state.state | lower == "on" %}
|
||||
Attention! Your {{ trigger.to_state.attributes.friendly_name }} is now OPENED!
|
||||
{% elif trigger.to_state.state | lower == "off" %}
|
||||
Your {{ trigger.to_state.attributes.friendly_name }} is now CLOSED!
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{{ doors }}
|
||||
|
||||
###############################################################################
|
||||
# Display Zone based Messages on LED Screen
|
||||
###############################################################################
|
||||
- alias: Welcome Family on LED Screen
|
||||
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:02:00"
|
||||
action:
|
||||
- service: script.led_message
|
||||
data_template:
|
||||
message: "Welcome home, {{ trigger.entity_id.split('.')[1].split('_')[1] | title }}"
|
||||
|
||||
- alias: Alert When Someone Enters a Zone on LED Screen
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: zone
|
||||
entity_id:
|
||||
- device_tracker.life360_hasika
|
||||
- device_tracker.life360_mallika
|
||||
- device_tracker.life360_srinika
|
||||
- device_tracker.life360_suresh
|
||||
zone: zone.home
|
||||
event: enter
|
||||
- platform: zone
|
||||
entity_id: device_tracker.life360_suresh
|
||||
zone: zone.work
|
||||
event: enter
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.zone_alerts') == 'on' }}"
|
||||
action:
|
||||
- service: script.led_message
|
||||
data_template:
|
||||
message: >
|
||||
{{ trigger.entity_id.split('.')[1].split('_')[1] | title}} just entered {{ trigger.zone.attributes.friendly_name }}!
|
@@ -118,6 +118,9 @@ script:
|
||||
###############################################################################
|
||||
voice_notify:
|
||||
sequence:
|
||||
# - service: script.led_message
|
||||
# data_template:
|
||||
# message: "{{ message }}"
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.voice_notifications') == 'on' }}"
|
||||
- condition: template
|
||||
@@ -218,3 +221,17 @@ script:
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: !include ../templates/home_status.yaml
|
||||
|
||||
###############################################################################
|
||||
# Display message on LED Matrix Screen
|
||||
###############################################################################
|
||||
led_message:
|
||||
sequence:
|
||||
- condition: state
|
||||
entity_id: input_boolean.led_alerts
|
||||
state: "on"
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: messageboard/messages
|
||||
payload: >
|
||||
{ 'message': '{{ message }}','frameDelay': 50 }
|
||||
|
188
packages/pill_reminder.yaml
Normal file
188
packages/pill_reminder.yaml
Normal file
@@ -0,0 +1,188 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 03/05/2020
|
||||
# @package : Pill Reminder Package
|
||||
# @description : A package to help you remind pills you need to take
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
# _____ _ _ _ _____ _ _
|
||||
# | __ (_) | | | __ \ (_) | |
|
||||
# | |__) || | | | |__) |___ _ __ ___ _ _ __ __| | ___ _ __
|
||||
# | ___/ | | | | _ // _ \ '_ ` _ \| | '_ \ / _` |/ _ \ '__|
|
||||
# | | | | | | | | \ \ __/ | | | | | | | | | (_| | __/ |
|
||||
# |_| |_|_|_| |_| \_\___|_| |_| |_|_|_| |_|\__,_|\___|_|
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
homeassistant:
|
||||
|
||||
input_label:
|
||||
pill_taken_at:
|
||||
name: Last Pills Taken At
|
||||
icon: mdi:pill
|
||||
|
||||
input_boolean:
|
||||
pill_taken:
|
||||
name: Pill Taken
|
||||
icon: mdi:pill
|
||||
|
||||
pill_on_vacation:
|
||||
name: On Vacation
|
||||
initial: off
|
||||
icon: mdi:beach
|
||||
|
||||
pill_voice_notification:
|
||||
name: Pill Voice Notification
|
||||
icon: mdi:speaker
|
||||
|
||||
timer:
|
||||
timer_pill_reminder:
|
||||
duration: "00:30:00"
|
||||
|
||||
input_datetime:
|
||||
pill_reminder_time:
|
||||
name: Pill Reminder Time
|
||||
has_date: false
|
||||
has_time: true
|
||||
initial: "09:00"
|
||||
|
||||
#################################################################################
|
||||
# _____ _ _
|
||||
# / ____| (_) | |
|
||||
# | (___ ___ _ __ _ _ __ | |_ ___
|
||||
# \___ \ / __| '__| | '_ \| __/ __|
|
||||
# ____) | (__| | | | |_) | |_\__ \
|
||||
# |_____/ \___|_| |_| .__/ \__|___/
|
||||
# | |
|
||||
# |_|
|
||||
#################################################################################
|
||||
|
||||
script:
|
||||
###############################################################################
|
||||
# Notifies to take pills, starts timer again!
|
||||
# Voice notifications at home - only if the option is selected.
|
||||
###############################################################################
|
||||
remind_pill:
|
||||
sequence:
|
||||
- service: script.notify_me
|
||||
data:
|
||||
message: "ALERT: PLEASE TAKE YOUR TABLETS!"
|
||||
- service: timer.start
|
||||
entity_id: timer.timer_pill_reminder
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.pill_voice_notification') == 'on' }}"
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >
|
||||
Please take the tablets. It looks like you have forgotten to take today's
|
||||
dose of tablets... Once again, this is a reminder for you to take the tablets.
|
||||
|
||||
###############################################################################
|
||||
# Stops timer, Records that the pills are taken, and notifies!
|
||||
###############################################################################
|
||||
pill_taken:
|
||||
sequence:
|
||||
- service: timer.cancel
|
||||
entity_id: timer.timer_pill_reminder
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolean.pill_taken
|
||||
- service: script.notify_me
|
||||
data:
|
||||
message: "Thank you for taking tablets on time!"
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.pill_voice_notification') == 'on' }}"
|
||||
- service: script.voice_notify
|
||||
data:
|
||||
message: "Thank you for taking tablets on time!"
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
|
||||
automation:
|
||||
###############################################################################
|
||||
# Turn On "Pill Taken" Input Boolean when the Pill Box is Opened
|
||||
# Opening the Pills Box signifies that the pills are taken!
|
||||
# Make sure the pill box is not accessible to children and only you use it daily
|
||||
###############################################################################
|
||||
- alias: Pill Box is Opened
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: binary_sensor.door_window_sensor_158d00040ad8ec
|
||||
to: "on"
|
||||
from: "off"
|
||||
action:
|
||||
- service: input_label.set_value
|
||||
data_template:
|
||||
entity_id: input_label.pill_taken_at
|
||||
value: "{{ as_timestamp(now()) | timestamp_custom('%m/%d/%Y %I:%M %p') }}"
|
||||
- delay:
|
||||
seconds: 15
|
||||
- service: script.pill_taken
|
||||
|
||||
###############################################################################
|
||||
# Reset at mid night every day.
|
||||
# When you get up in the morning, you will get a fresh reminder
|
||||
###############################################################################
|
||||
- alias: Reset Pill Taken
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: time
|
||||
at: "00:00:00"
|
||||
action:
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.pill_taken
|
||||
|
||||
###############################################################################
|
||||
# Set the vacation mode automatically based on home security system state
|
||||
# When travelling, make sure you add a reminder on your mobile phone
|
||||
###############################################################################
|
||||
- alias: Set Vacation Mode For Pills
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: alarm_control_panel.home
|
||||
action:
|
||||
- service_template: "input_boolean.turn_{{- 'on' if
|
||||
states('alarm_control_panel.home') == 'armed_away' else 'off' }}"
|
||||
entity_id: input_boolean.pill_on_vacation
|
||||
|
||||
###############################################################################
|
||||
# Checks if the pills were taken - trigger on the pill reminder time
|
||||
# Also, only remind if not on vacation or away from home
|
||||
# Right after the notification, start the timer, and keep reminders going
|
||||
# until acknowledged
|
||||
###############################################################################
|
||||
- alias: Check if pills were taken
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: template
|
||||
value_template: "{{ states('sensor.time') ==
|
||||
states('input_datetime.pill_reminder_time')[:-3] }}"
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.pill_taken') == 'off' }}"
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.pill_on_vacation') == 'off' }}"
|
||||
action:
|
||||
- service: script.remind_pill
|
||||
|
||||
###############################################################################
|
||||
# Timer Elapsed - Time for a reminder if the pill is not taken yet
|
||||
###############################################################################
|
||||
- alias: Pill Reminder Timer Elapsed
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: event
|
||||
event_type: timer.finished
|
||||
event_data:
|
||||
entity_id: timer.timer_pill_reminder
|
||||
action:
|
||||
- service_template: script.remind_pill
|
@@ -143,6 +143,11 @@ input_boolean:
|
||||
initial: off
|
||||
icon: mdi:do-not-disturb
|
||||
|
||||
led_alerts:
|
||||
name: LED Messages
|
||||
initial: on
|
||||
icon: mdi:led-strip
|
||||
|
||||
movie_time:
|
||||
name: "Movie Time"
|
||||
initial: off
|
||||
|
@@ -61,6 +61,14 @@ automation:
|
||||
{%- else -%}
|
||||
Attention: USPS is delivering {{ states('sensor.usps_mail') }} mails today.
|
||||
{%- endif -%}
|
||||
- service: script.led_message
|
||||
data_template:
|
||||
message: >
|
||||
{%- if states('sensor.usps_mail') | int == 1 -%}
|
||||
USPS is delivering {{ states('sensor.usps_mail') }} mail today.
|
||||
{%- else -%}
|
||||
USPS is delivering {{ states('sensor.usps_mail') }} mails today.
|
||||
{%- endif -%}
|
||||
- service: notify.ios_devices
|
||||
data_template:
|
||||
message: "USPS will be delivering {{ states('sensor.usps_mail') }} mail(s) today."
|
||||
|
@@ -6,99 +6,102 @@
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
#
|
||||
###############################################################################
|
||||
automation:
|
||||
|
||||
# Garage:
|
||||
# Working in Garage Mode Watch Dog - Turns off after 2 hours
|
||||
###############################################################################
|
||||
# Garage:
|
||||
# Working in Garage Mode Watch Dog - Turns off after 2 hours
|
||||
###############################################################################
|
||||
- alias: Working In Garage WatchDog
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- input_boolean.working_in_garage
|
||||
to: 'on'
|
||||
for:
|
||||
to: "on"
|
||||
for:
|
||||
hours: 2
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data:
|
||||
data:
|
||||
message: "It has been two hours, are you still working in the garage? Changing the status to 'Not working'!"
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.working_in_garage
|
||||
|
||||
# Garage:
|
||||
# Keeps and eye on the garage door... reminds me to close after 5 min
|
||||
###############################################################################
|
||||
|
||||
# Garage:
|
||||
# Keeps and eye on the garage door... reminds me to close after 5 min
|
||||
###############################################################################
|
||||
- alias: Single Car garage Door WatchDog
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- binary_sensor.single_car_garage_door_tilt_sensor_sensor
|
||||
to: 'on'
|
||||
for:
|
||||
to: "on"
|
||||
for:
|
||||
minutes: 5
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.working_in_garage
|
||||
state: 'off'
|
||||
state: "off"
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.garage_door_notifications') == 'on' }}"
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data:
|
||||
data:
|
||||
message: "Single Car Garage Door is OPEN for more than 5 minutes!"
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: "Attention! Your single car garage door is open for more than 5 minutes."
|
||||
|
||||
# Garage:
|
||||
# Keeps and eye on the garage door... reminds me to close after 5 min
|
||||
###############################################################################
|
||||
# Garage:
|
||||
# Keeps and eye on the garage door... reminds me to close after 5 min
|
||||
###############################################################################
|
||||
- alias: Two Car garage Door WatchDog
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- binary_sensor.two_car_garage_door_tilt_sensor_sensor
|
||||
to: 'on'
|
||||
for:
|
||||
to: "on"
|
||||
for:
|
||||
minutes: 5
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.working_in_garage
|
||||
state: 'off'
|
||||
state: "off"
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.garage_door_notifications') == 'on' }}"
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data:
|
||||
data:
|
||||
message: "Your Two Car Garage Door is OPEN for more than 5 minutes!"
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: "Attention! Your two car garage door is open for more than 5 minutes."
|
||||
|
||||
# Front Yard:
|
||||
# Keeps and eye on the front porch lights...
|
||||
###############################################################################
|
||||
# Front Yard:
|
||||
# Keeps and eye on the front porch lights...
|
||||
###############################################################################
|
||||
- alias: Frontyard Light WatchDog
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- switch.frontyard_light
|
||||
to: 'on'
|
||||
to: "on"
|
||||
for:
|
||||
minutes: 5
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: sun.sun
|
||||
state: 'above_horizon'
|
||||
state: "above_horizon"
|
||||
action:
|
||||
- service: switch.turn_off
|
||||
data_template:
|
||||
@@ -107,23 +110,23 @@ automation:
|
||||
data_template:
|
||||
message: >
|
||||
{{ trigger.to_state.attributes.friendly_name }} is ON during the day time. Saving power by turning it off!
|
||||
|
||||
# Back Yard:
|
||||
# Keeps and eye on the patio lights...
|
||||
###############################################################################
|
||||
|
||||
# Back Yard:
|
||||
# Keeps and eye on the patio lights...
|
||||
###############################################################################
|
||||
- alias: Backyard Light WatchDog
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- switch.wemobackyardlightswitch
|
||||
to: 'on'
|
||||
to: "on"
|
||||
for:
|
||||
minutes: 5
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: sun.sun
|
||||
state: 'above_horizon'
|
||||
state: "above_horizon"
|
||||
action:
|
||||
- service: switch.turn_off
|
||||
data_template:
|
||||
@@ -132,17 +135,17 @@ automation:
|
||||
data_template:
|
||||
message: >
|
||||
{{ trigger.to_state.attributes.friendly_name }} is ON during the day time. Saving power by turning it off!
|
||||
|
||||
# Guest Bedroom:
|
||||
# Keeps and eye on the Guest Bedroom 1 lights...
|
||||
###############################################################################
|
||||
|
||||
# Guest Bedroom:
|
||||
# Keeps and eye on the Guest Bedroom 1 lights...
|
||||
###############################################################################
|
||||
- alias: Guest Bedroom 1 Light WatchDog
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- switch.guest_bedroom
|
||||
to: 'on'
|
||||
to: "on"
|
||||
for:
|
||||
minutes: 15
|
||||
action:
|
||||
@@ -150,36 +153,36 @@ automation:
|
||||
data_template:
|
||||
entity_id: "{{ trigger.entity_id }}"
|
||||
|
||||
# Guest Bedroom 2:
|
||||
# Keeps and eye on the Guest Bedroom 2 lights...
|
||||
###############################################################################
|
||||
# Guest Bedroom 2:
|
||||
# Keeps and eye on the Guest Bedroom 2 lights...
|
||||
###############################################################################
|
||||
- alias: Guest Bedroom 2 Light WatchDog
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- switch.prayer_room
|
||||
to: 'on'
|
||||
to: "on"
|
||||
for:
|
||||
minutes: 10
|
||||
action:
|
||||
- service: switch.turn_off
|
||||
data_template:
|
||||
entity_id: "{{ trigger.entity_id }}"
|
||||
|
||||
# Kids Bedroom:
|
||||
# Keeps and eye on the Kids Bedroom lights...
|
||||
###############################################################################
|
||||
|
||||
# Kids Bedroom:
|
||||
# Keeps and eye on the Kids Bedroom lights...
|
||||
###############################################################################
|
||||
- alias: Kids Bedroom Light WatchDog
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- switch.kids_bedroom
|
||||
to: 'on'
|
||||
to: "on"
|
||||
for:
|
||||
minutes: 10
|
||||
action:
|
||||
- service: switch.turn_off
|
||||
data_template:
|
||||
entity_id: "{{ trigger.entity_id }}"
|
||||
entity_id: "{{ trigger.entity_id }}"
|
||||
|
Reference in New Issue
Block a user