diff --git a/.gitignore b/.gitignore index 112d0b9..1ca6c47 100644 --- a/.gitignore +++ b/.gitignore @@ -48,7 +48,6 @@ usps_cookies.pickle packages/zones_private.yaml packages/device_tracker.yaml packages/bitcoins.yaml -packages/pill_reminder.yaml custom_components/*/__pycache__/* custom_components/__pycache__/* docs/_site diff --git a/lovelace/00_myhome_view.yaml b/lovelace/00_myhome_view.yaml index 6712aa5..515769d 100644 --- a/lovelace/00_myhome_view.yaml +++ b/lovelace/00_myhome_view.yaml @@ -69,6 +69,13 @@ cards: - input_boolean.pill_taken - input_boolean.pill_voice_notification - binary_sensor.door_window_sensor_158d00040ad8ec + - input_label.pill_taken_at + # - entity: timer.timer_pill_reminder + # name: Pill Reminder Timer + # - entity: script.remind_pill + # name: Remind Pill Script + # - entity: script.pill_taken + # name: Pill Taken Script - type: entities title: Tile Devices diff --git a/lovelace/09_settings_view.yaml b/lovelace/09_settings_view.yaml index 39b9fd1..9058993 100644 --- a/lovelace/09_settings_view.yaml +++ b/lovelace/09_settings_view.yaml @@ -201,6 +201,7 @@ cards: - input_boolean.garage_door_notifications - input_boolean.battery_notifications - input_boolean.text_alerts + - input_boolean.led_alerts - input_boolean.security_system_alerts - input_boolean.notify_camera_alerts - input_boolean.alarm_clock diff --git a/packages/daily_routines.yaml b/packages/daily_routines.yaml index 65f0159..2ec8794 100644 --- a/packages/daily_routines.yaml +++ b/packages/daily_routines.yaml @@ -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 # ÛÛÛÛÛÛ ÛÛÛÛÛ ÛÛÛ ÛÛÛÛÛ ÛÛÛÛÛ # °°ÛÛÛÛÛÛ °°ÛÛÛ °°° °°ÛÛÛ °°ÛÛÛ diff --git a/packages/door_sensors.yaml b/packages/door_sensors.yaml index 0e73761..69cdf6b 100644 --- a/packages/door_sensors.yaml +++ b/packages/door_sensors.yaml @@ -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: diff --git a/packages/led_notify.yaml b/packages/led_notify.yaml new file mode 100644 index 0000000..2d3a4e9 --- /dev/null +++ b/packages/led_notify.yaml @@ -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 }}! diff --git a/packages/notify.yaml b/packages/notify.yaml index ad828ba..5f233fe 100644 --- a/packages/notify.yaml +++ b/packages/notify.yaml @@ -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 } diff --git a/packages/pill_reminder.yaml b/packages/pill_reminder.yaml new file mode 100644 index 0000000..a328e16 --- /dev/null +++ b/packages/pill_reminder.yaml @@ -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 diff --git a/packages/settings.yaml b/packages/settings.yaml index 5b612a0..ec86752 100644 --- a/packages/settings.yaml +++ b/packages/settings.yaml @@ -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 diff --git a/packages/usps.yaml b/packages/usps.yaml index 471e20b..335c388 100644 --- a/packages/usps.yaml +++ b/packages/usps.yaml @@ -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." diff --git a/packages/watchdog.yaml b/packages/watchdog.yaml index db3a0ba..580ab6b 100644 --- a/packages/watchdog.yaml +++ b/packages/watchdog.yaml @@ -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 }}" \ No newline at end of file + entity_id: "{{ trigger.entity_id }}" diff --git a/zwcfg_0xd89c4f0c.xml b/zwcfg_0xd89c4f0c.xml index a0b2afc..4cf7ec0 100644 --- a/zwcfg_0xd89c4f0c.xml +++ b/zwcfg_0xd89c4f0c.xml @@ -22,7 +22,7 @@ - + @@ -34,10 +34,10 @@ - + - + @@ -168,7 +168,7 @@ - + @@ -216,9 +216,9 @@ - + - + @@ -350,7 +350,7 @@ - + @@ -379,7 +379,7 @@ - + @@ -490,7 +490,7 @@ - + @@ -601,7 +601,7 @@ - + @@ -710,7 +710,7 @@ - + @@ -720,7 +720,7 @@ - + @@ -728,9 +728,9 @@ - - - + + + @@ -902,7 +902,7 @@ - + @@ -974,7 +974,7 @@ - + @@ -1006,12 +1006,12 @@ - - - + + + - - + + @@ -1190,8 +1190,8 @@ - - + + @@ -1328,7 +1328,7 @@ - + @@ -1339,7 +1339,7 @@ - + @@ -1369,7 +1369,7 @@ - + @@ -1703,7 +1703,7 @@ - + @@ -2023,7 +2023,7 @@ - + @@ -2038,7 +2038,7 @@ - + @@ -2132,7 +2132,7 @@ - + @@ -2262,9 +2262,9 @@ - + - + @@ -2437,7 +2437,7 @@ - +