diff --git a/lovelace/11_scripts_view.yaml b/lovelace/11_scripts_view.yaml index 5837992..62b418a 100644 --- a/lovelace/11_scripts_view.yaml +++ b/lovelace/11_scripts_view.yaml @@ -76,8 +76,6 @@ cards: # - script.home_mode_away # - script.home_status # - script.led_message - # - script.notify_me - # - script.notify_me_with_picture # - script.patio_cam # - script.patio_camera_text_overlay # - script.pill_taken diff --git a/packages/birthday.yaml b/packages/birthday.yaml index f6ea5f1..cae5eac 100644 --- a/packages/birthday.yaml +++ b/packages/birthday.yaml @@ -76,9 +76,13 @@ automation: - condition: template value_template: "{{ trigger.to_state.state | int > 0 and trigger.to_state.state | int < 30 }}" action: - - service: script.notify_me + - service: script.notify_family data_template: message: "{{ trigger.entity_id.split('.')[1].split('_')[0] | title }}'s Birthday is only {{ trigger.to_state.state }} days to go!" + notify_options: + - telegram + - tv + - led ############################################################################### # Celebrate Birthday!!! @@ -95,9 +99,14 @@ automation: - condition: template value_template: "{{ trigger.to_state.state | int == 0 }}" action: - - service: script.notify_me + - service: script.notify_family data_template: message: "Hurray! Today is {{ trigger.entity_id.split('.')[1].split('_')[0] | title }}'s Birthday!" + notify_options: + - telegram + - tv + - led + - voice ############################################################################### # Announce Happy Birthday message every hour starting 7 am until 9 PM @@ -124,15 +133,13 @@ automation: - condition: template value_template: "{{ states('input_label.mallika_birthday_days2go') | int == 0 }}" action: - - service: script.voice_notify + - service: script.notify_family data_template: message: !include ../templates/birthday_wishes.yaml - - delay: - minutes: 1 - - service: script.voice_notify - data_template: - message: "Alexa, Sing Happy Birthday Song." - greeting: "no" + notify_options: + - voice + - tv + - led - alias: Update Birthdays initial_state: true diff --git a/packages/cameras.yaml b/packages/cameras.yaml index 248444f..3446b09 100644 --- a/packages/cameras.yaml +++ b/packages/cameras.yaml @@ -108,7 +108,7 @@ switch: body_on: '{"state": "start"}' body_off: '{"state": "stop"}' is_on_template: '{{ value_json is not none and value_json.state == "running" }}' - + binary_sensor: - platform: hikvision name: Frontdoor Camera @@ -348,7 +348,7 @@ automation: images: - "/config/www/downloads/camera/frontdoor/frontdoor_latest.jpg" - - service: script.notify_me_with_picture + - service: script.notify_family data_template: title: "Front Door Motion" message: > @@ -363,8 +363,10 @@ automation: {% else %} Motion detected at the front door on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below. {%- endif %} - file: "/config/www/downloads/camera/frontdoor/frontdoor_latest.jpg" - caption: "Front Door Motion" + url: "/config/www/downloads/camera/frontdoor/frontdoor_latest.jpg" + notify_options: + - telegram + - tv - condition: template value_template: > @@ -428,7 +430,7 @@ automation: {{ " detected in the driveway" }} {%- endif -%} - - service: script.notify_me_with_picture + - service: script.notify_family data_template: title: "Driveway Motion" message: > @@ -443,8 +445,10 @@ automation: {% else %} Motion detected at the driveway on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below. {%- endif -%} - file: "/config/www/downloads/camera/driveway/driveway_latest.jpg" - caption: "Driveway Motion" + url: "/config/www/downloads/camera/driveway/driveway_latest.jpg" + notify_options: + - telegram + - tv - service: notify.notify_smtp data_template: @@ -537,7 +541,7 @@ automation: {{ " detected in the garage." }} {%- endif -%} - - service: script.notify_me_with_picture + - service: script.notify_family data_template: title: "Garage Motion" message: > @@ -552,8 +556,10 @@ automation: {% else %} Motion detected in the garage on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below. {%- endif -%} - file: "/config/www/downloads/camera/garage/garage_latest.jpg" - caption: "Garage Motion" + url: "/config/www/downloads/camera/garage/garage_latest.jpg" + notify_options: + - telegram + - tv - service: notify.notify_smtp data_template: @@ -623,9 +629,9 @@ automation: {{ " detected in the backyard." }} {%- endif -%} - - service: script.notify_me_with_picture + - service: script.notify_family data_template: - title: "Backyardge Motion" + title: "Backyard Motion" message: > {%- set e_id = "image_processing.doods_patio_camera" -%} {%- if state_attr(e_id, 'summary') -%} @@ -638,8 +644,10 @@ automation: {% else %} Motion detected in the backyard on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below. {%- endif -%} - file: "/config/www/downloads/camera/patio/patio_latest.jpg" - caption: "Backyard Motion" + url: "/config/www/downloads/camera/patio/patio_latest.jpg" + notify_options: + - telegram + - tv - service: notify.notify_smtp data_template: @@ -854,7 +862,7 @@ automation: (states.binary_sensor.motion_sensor_158d00024e57fb.last_updated ~ '').replace('-','_') .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" caption: "Garage" - + - service: notify.notify_smtp data_template: title: 'Driveway motion {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}' @@ -1238,4 +1246,4 @@ script: - service: input_label.set_value data_template: entity_id: input_label.current_stream - value: "{{ name }}" \ No newline at end of file + value: "{{ name }}" diff --git a/packages/daily_routines.yaml b/packages/daily_routines.yaml index 4eadd9b..b12a803 100644 --- a/packages/daily_routines.yaml +++ b/packages/daily_routines.yaml @@ -156,7 +156,7 @@ automation: # Turn outdoor lights on 15 minutes before sunset ############################################################################### - alias: Evening Outdoor Lights ON (At Sunset) -# initial_state: true + # initial_state: true trigger: platform: sun event: sunset @@ -315,9 +315,6 @@ automation: state: "on" action: - service: script.all_indoor_lights_off - # - service: script.notify_me - # data: - # message: "It is bed time, turned lights off!" ############################################################################### # Provide Bed time Report via TTS @@ -333,12 +330,11 @@ automation: action: - service: script.good_night_tts + ############################################################################### + # TOGGLE WORKING IN OFFICE BOOLEAN + ############################################################################### -############################################################################### -# TOGGLE WORKING IN OFFICE BOOLEAN -############################################################################### - - - alias: Suresh Working in Office Start + - alias: Suresh Working in Office Start initial_state: true trigger: platform: time diff --git a/packages/door_sensors.yaml b/packages/door_sensors.yaml index 858d933..fd32ce6 100644 --- a/packages/door_sensors.yaml +++ b/packages/door_sensors.yaml @@ -77,7 +77,6 @@ binary_sensor: payload_off: "off" value_template: "{{ value }}" - ############################################################################### # _ _ _ # /\ | | | | (_) @@ -140,20 +139,10 @@ automation: action: - service: switch.turn_on entity_id: switch.garage - - service: script.notify_me - data_template: - message: > - {% if trigger.to_state.state | lower == "on" %} - {{ trigger.to_state.attributes.friendly_name }} is now OPENED! - {% elif trigger.to_state.state | lower == "off" %} - {{ trigger.to_state.attributes.friendly_name }} is now CLOSED! - {% endif %} - - service: script.led_message - data_template: - <<: *door_notification_script - - service: script.voice_notify + - service: script.notify_family data_template: <<: *door_notification_script + notify_options: ["voice", "led", "tv"] - delay: "00:00:05" - service: camera.snapshot data_template: @@ -163,9 +152,9 @@ automation: ((state_attr('automation.notify_garage_door_status', 'last_triggered') |string).replace('-','_') .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg') }}" - - service: script.notify_me_with_picture + - service: script.notify_family data_template: - title: 'Garage Door Status {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}' + 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 @@ -181,11 +170,12 @@ automation: ('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. - file: > + url: > {{ '/config/www/downloads/camera/garage/garage_' ~ ((state_attr('automation.notify_garage_door_status', 'last_triggered') |string).replace('-','_') .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg') }} - caption: "{{ trigger.to_state.attributes.friendly_name }}: {{ 'OPEN' if trigger.to_state.state == 'on' else 'CLOSED' }}" + notify_options: + - telegram - service: notify.notify_smtp data_template: @@ -230,7 +220,7 @@ automation: - condition: template value_template: "{{ trigger.from_state.state != trigger.to_state.state }}" action: - - service: script.voice_notify + - service: script.notify_family data_template: message: > {% if trigger.to_state.state | lower == "on" %} @@ -242,21 +232,11 @@ automation: {% elif trigger.to_state.state | lower == "off" %} Your {{ trigger.to_state.attributes.friendly_name.replace('Sensor', '') }} is CLOSED! {% endif %} - greeting: "no" - only_at_night: > - {% if states('alarm_control_panel.home') == 'armed_home' %} - no - {% else %} - yes - {% endif %} - - service: script.led_message - data_template: - message: > - {% if trigger.to_state.state | lower == "on" %} - Your {{ trigger.to_state.attributes.friendly_name.replace('Sensor', '') |lower -}} is open. - {% else %} - Your {{ trigger.to_state.attributes.friendly_name.replace('Sensor', '') |lower -}} is closed. - {% endif %} + notify_options: + - telegram + - tv + - led + - voice - alias: When Front Door Opens Turn Front Room Lights ON initial_state: true @@ -415,4 +395,4 @@ automation: state: "on" action: - service: switch.turn_on - entity_id: switch.guest_bathroom_lights \ No newline at end of file + entity_id: switch.guest_bathroom_lights diff --git a/packages/holidays.yaml b/packages/holidays.yaml index 6c6a575..753a2ec 100644 --- a/packages/holidays.yaml +++ b/packages/holidays.yaml @@ -59,9 +59,13 @@ automation: data: message: "Today is {{ states('sensor.holiday') }}." title: "{{ states('sensor.holiday') }}" - - service: script.notify_me + - service: script.notify_family data_template: message: "Today is: {{states('sensor.holiday') }}" + notify_options: + - telegram + - tv + - led - alias: Notify Indian Holidays initial_state: true @@ -91,7 +95,7 @@ automation: false {%- endif -%} action: - - service: script.notify_me + - service: script.notify_family data_template: message: >- {%- set days2NextEvent = 0 -%} @@ -109,3 +113,7 @@ automation: {{ states.calendar.holidays_in_india.attributes.message | replace(".", "") | title }}. is day after tomorrow. {%- endif -%} {%- endif -%} + notify_options: + - telegram + - tv + - led diff --git a/packages/homesecurity.yaml b/packages/homesecurity.yaml index dd2fed1..9a2f373 100644 --- a/packages/homesecurity.yaml +++ b/packages/homesecurity.yaml @@ -68,7 +68,7 @@ automation: entity_id: alarm_control_panel.home to: "triggered" action: - - service: script.notify_me + - service: script.notify_family data_template: message: > {% set ns = namespace(openDoorCount=0, doorNames="") %} @@ -81,15 +81,21 @@ automation: 'binary_sensor.motion_sensor_158d000272bf48','binary_sensor.motion_sensor_158d000272bfd7','binary_sensor.motion_sensor_158d000464c25a', 'binary_sensor.motion_sensor_158d00047b6f69' ] -%} - + {%- for item in sensors if states(item) == "on" %} {% set ns.doorNames = ns.doorNames + state_attr(item, "friendly_name") + (", " if not loop.last else " ") %} {% set ns.openDoorCount = ns.openDoorCount + 1 %} {%- endfor %} - + Your Home Security System is triggered. {{ "But ALL Doors are CLOSED! Must be a spider on one of the sensor(s) triggered it!" if ns.openDoorCount == 0 else 'Following sensors are ON currently:' }} {{ ns.doorNames }} - + notify_options: + - telegram + - tv + - led + - voice + + - service: camera.snapshot data_template: entity_id: "camera.frontdoor_camera" @@ -164,27 +170,15 @@ automation: condition: - condition: template value_template: "{{ states('input_boolean.security_system_alerts') == 'on' }}" - # - condition: template - # value_template: > - # {%- if state_attr('automation.notify_home_security_status_change', 'last_triggered') -%} - # {{ (as_timestamp(now()) - as_timestamp(state_attr('automation.notify_home_security_status_change', 'last_triggered'))) > 90 }} - # {%- else -%} - # true - # {%- endif -%} + - condition: template + value_template: > + {%- if state_attr('automation.notify_home_security_status_change', 'last_triggered') -%} + {{ (as_timestamp(now()) - as_timestamp(state_attr('automation.notify_home_security_status_change', 'last_triggered'))) > 90 }} + {%- else -%} + true + {%- endif -%} action: - - service: script.notify_me - data_template: - message: > - {% if states('alarm_control_panel.home') == "armed_home" %} - Your home is now secured! - {% elif states('alarm_control_panel.home') == "armed_away" %} - Your Home Security System is now set to Away mode! - {% elif states('alarm_control_panel.home') == "triggered" %} - Attention!: Your Home Security System is triggered! It has been notified to the authorities. - {% elif states('alarm_control_panel.home') == "disarmed" %} - Attention!: Your Home Security System is turned OFF. - {% endif %} - - service: script.voice_notify + - service: script.notify_family data_template: message: > {% if states('alarm_control_panel.home') == "armed_home" %} @@ -196,6 +190,12 @@ automation: {% elif states('alarm_control_panel.home') == "disarmed" %} Attention!: Your Home Security System is turned OFF. {% endif %} + notify_options: + - telegram + - tv + - led + - voice + - condition: template value_template: "{{ states('alarm_control_panel.home') != 'disarmed' }}" - service: input_boolean.turn_on @@ -213,9 +213,12 @@ automation: for: minutes: 10 action: - - service: script.notify_me + - service: script.notify_family data: message: "Home Security System is OFF for more than 10 minutes!" + notify_options: + - tv + - led ############################################################################### # A gentle reminder that the home security is OFF for more than 30 minutes @@ -232,34 +235,12 @@ automation: - condition: template value_template: "{{ states('input_boolean.security_system_alerts') == 'on' }}" action: - - service: script.notify_me + - service: script.notify_family data: message: "Home Security System is OFF for more than 30 minutes!" - - ############################################################################### - # When home security system is turned OFF or turned to Home mode from "away" - # means, someone reached home from outside - ############################################################################### - # - alias: Turn ON Thermostat upon reaching home - # initial_state: true - # trigger: - # platform: state - # entity_id: alarm_control_panel.home - # condition: - # - condition: template - # value_template: > - # {% if trigger.from_state.state == 'armed_away' and - # (trigger.to_state.state == 'armed_home' or trigger.to_state.state == 'disarmed') %} - # true - # {% else %} - # false - # {% endif %} - # action: - # - service: climate.set_preset_mode - # target: - # entity_id: climate.dining_room - # data: - # preset_mode: "eco" + notify_options: + - tv + - led ############################################################################### # TURN HOME SECURITY SYSTEM ON AT BED TIME @@ -285,9 +266,13 @@ automation: - service: alarm_control_panel.alarm_arm_home data: entity_id: alarm_control_panel.home - - service: script.notify_me + - service: script.notify_family data: message: "It's bedtime, you forgot to turn ON Home Security System. Turned it ON for you." + notify_options: + - telegram + - tv + - led ############################################################################### # Check for Garage Door Status when Home Security System State changes @@ -312,139 +297,20 @@ automation: action: - service: switch.turn_on entity_id: switch.garage - - - service: script.notify_me - data_template: - 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! - - service: camera.snapshot data_template: entity_id: "camera.garage" filename: "{{ '/config/www/downloads/camera/garage/garage_' ~ (state_attr('automation.home_security_system_and_garage_door_check','last_updated') ~ '').replace('-','_').replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" - - - service: notify.telegram - data_template: - title: "Garage" - message: "Home Security System is ON, but Garage Doors are OPEN!" - data: - photo: - - file: "{{ '/config/www/downloads/camera/garage/garage_' ~ - (states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_') - .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" - caption: "Garage" - - - condition: template - value_template: "{{ states('alarm_control_panel.home') == 'armed_home' }}" - - - service: script.voice_notify + - 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 = "Both garage doors" %} - {%- elif states('binary_sensor.door_window_sensor_158d0004248d5b') == "on"%} - {%- set doors = state_attr('binary_sensor.door_window_sensor_158d0004248d5b', 'friendly_name') %} - {%- elif states('binary_sensor.door_window_sensor_158d0004248d5b') == "on" %} - {%- set doors = state_attr('binary_sensor.door_window_sensor_158d0004231f7b', 'friendly_name') %} - {%- endif %} - Attention! Your home Security system is set to {{ states('alarm_control_panel.home').split('_')[1] | upper }} mode. - BUT the {{ doors }} {{ 'are' if doors.endswith('s') else 'is' }} open. + 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' }}" + notify_options: + - telegram + - tv + - led + - voice -############################################################################### -# Turn Home Security System ON at sunset time -############################################################################### -# - alias: Turn On Home Security System At Sunset -# initial_state: true -# trigger: -# platform: sun -# event: sunset -# offset: '+00:00:00' -# condition: -# - condition: state -# entity_id: alarm_control_panel.home -# state: 'disarmed' -# action: -# - service_template: >- -# {% if states('binary_sensor.back_door_sensor_sensor') == "off" and -# states('binary_sensor.aeotec_zw120_door_window_sensor_gen5_sensor') == "off" and -# states('binary_sensor.door_window_sensor_158d0004231f7b') == "off" and -# states('binary_sensor.door_window_sensor_158d0004248d5b') == "off" %} -# alarm_control_panel.alarm_arm_home -# {% else %} -# alarm_control_panel.disarm -# {% endif %} -# data: -# entity_id: alarm_control_panel.home -# - service: script.voice_notify -# data_template: -# message: > -# {% if states('binary_sensor.back_door_sensor_sensor') == "off" and -# states('binary_sensor.aeotec_zw120_door_window_sensor_gen5_sensor') == "off" and -# states('binary_sensor.door_window_sensor_158d0004231f7b') == "off" and -# states('binary_sensor.door_window_sensor_158d0004248d5b') == "off" %} -# It's getting dark outside, and your home security system is now set to HOME mode. -# {% else %} -# It is getting dark outside. -# {%- if states('binary_sensor.back_door_sensor_sensor') == "on" -%} -# {%- set doors = doors ~ " Back Door" -%} -# {%- endif -%} -# {%- if states('binary_sensor.aeotec_zw120_door_window_sensor_gen5_sensor') == "on" -%} -# {% if doors | trim != "" %} -# {%- set doors = doors ~ " and Front Door" -%} -# {% else %} -# {%- set doors = doors ~ " Front Door" -%} -# {% endif %} -# {%- endif -%} -# {%- if states('binary_sensor.door_window_sensor_158d0004231f7b') == "on" -%} -# {% if doors | trim != "" %} -# {%- set doors = doors ~ " and Two Car Garage Door" -%} -# {% else %} -# {%- set doors = doors ~ " Two Car Garage Door" -%} -# {% endif %} -# {%- endif -%} -# {%- if states('binary_sensor.door_window_sensor_158d0004248d5b') == "on" -%} -# {% if doors | trim != "" %} -# {%- set doors = doors ~ " and Single Car Garage Door" -%} -# {% else %} -# {%- set doors = doors ~ " Single Car Garage Door" -%} -# {% endif %} -# {%- endif -%} -# Your{{ doors }} {%- if 'and' in doors -%}s are {%- else %} is {%- endif %} open. Home Security System could not be turned on. -# {% endif %} -# - service: script.notify_me -# data_template: -# message: > -# {% if states('binary_sensor.back_door_sensor_sensor') == "off" and -# states('binary_sensor.aeotec_zw120_door_window_sensor_gen5_sensor') == "off" and -# states('binary_sensor.door_window_sensor_158d0004231f7b') == "off" and -# states('binary_sensor.door_window_sensor_158d0004248d5b') == "off" %} -# It's getting dark outside, and your home security system is now set to HOME mode. -# {% else %} -# It is getting dark outside. -# {%- if states('binary_sensor.back_door_sensor_sensor') == "on" -%} -# {%- set doors = doors ~ " Back Door" -%} -# {%- endif -%} -# {%- if states('binary_sensor.aeotec_zw120_door_window_sensor_gen5_sensor') == "on" -%} -# {% if doors | trim != "" %} -# {%- set doors = doors ~ " and Front Door" -%} -# {% else %} -# {%- set doors = doors ~ " Front Door" -%} -# {% endif %} -# {%- endif -%} -# {%- if states('binary_sensor.door_window_sensor_158d0004231f7b') == "on" -%} -# {% if doors | trim != "" %} -# {%- set doors = doors ~ " and Two Car Garage Door" -%} -# {% else %} -# {%- set doors = doors ~ " Two Car Garage Door" -%} -# {% endif %} -# {%- endif -%} -# {%- if states('binary_sensor.door_window_sensor_158d0004248d5b') == "on" -%} -# {% if doors | trim != "" %} -# {%- set doors = doors ~ " and Single Car Garage Door" -%} -# {% else %} -# {%- set doors = doors ~ " Single Car Garage Door" -%} -# {% endif %} -# {%- endif -%} -# Your {{ doors}} {%- if 'and' in doors -%}s are {%- else %} is {%- endif %} open. Home Security System could not be turned on. -# {% endif %} diff --git a/packages/led_notify.yaml b/packages/led_notify.yaml index 2d21ae6..a584889 100644 --- a/packages/led_notify.yaml +++ b/packages/led_notify.yaml @@ -4,20 +4,19 @@ automation: ############################################################################### # Display Weather Information on LED Screen ############################################################################### - - alias: Display Weather Changes on LED Screen + - alias: Notify Weather Changes 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') }} - - service: script.notify_tv + - service: script.notify_family data_template: message: > {{ states('sensor.dark_sky_apparent_temperature') |int }} degrees, {{ states('sensor.dark_sky_hourly_summary') }} + notify_options: + - tv + - led ############################################################################### # Display Garage Door Status on LED Screen @@ -37,25 +36,7 @@ automation: - 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.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.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 }} - - service: script.notify_tv + - service: script.notify_family data_template: message: > {% set doors = "" %} @@ -73,6 +54,10 @@ automation: {% endif %} {% endif %} {{ doors }} + notify_options: + - telegram + - tv + - led ############################################################################### # Display Zone based Messages on LED Screen @@ -90,12 +75,12 @@ automation: to: "home" for: "00:02:00" action: - - service: script.led_message - data_template: - message: "Welcome home, {{ trigger.entity_id.split('.')[1].split('_')[1] | title }}" - - service: script.notify_tv + - service: script.notify_family data_template: message: "Welcome home, {{ trigger.entity_id.split('.')[1].split('_')[1] | title }}" + notify_options: + - tv + - led - alias: Alert When Someone Enters a Zone on LED Screen initial_state: true diff --git a/packages/motion_counts.yaml b/packages/motion_counts.yaml index f4067da..1300eea 100644 --- a/packages/motion_counts.yaml +++ b/packages/motion_counts.yaml @@ -1,7 +1,5 @@ homeassistant: customize: - input_label.aeotec_zw120_door_window_sensor_gen5_sensor: - unit_of_measurement: "count" input_label.back_door_sensor_sensor: unit_of_measurement: "count" input_label.basement_door_sensor_sensor: diff --git a/packages/nest_thermostat.yaml b/packages/nest_thermostat.yaml index 210c7ee..1c6191a 100644 --- a/packages/nest_thermostat.yaml +++ b/packages/nest_thermostat.yaml @@ -37,27 +37,6 @@ nest: ############################################################################### automation: - ############################################################################### - # Turn OFF AC after 3 hours of cooling - # Where we live, 3 hours is plenty to cool the house down! - ############################################################################### - - alias: Turn Off AC After 3 Hours of Cooling - initial_state: true - trigger: - - platform: state - entity_id: climate.dining_room - to: "cool" - for: "03:00:00" - action: - - service: climate.set_away_mode - data: - entity_id: climate.dining_room - away_mode: "true" - - service: script.notify_me - data_template: - message: "Air Condition has been ON for 3 hours. - Turning it Off to save power." - ############################################################################### # Nest Thermostat automatically changes based on activity at home. # This automation is to keep an eye on what's going on with Nest @@ -68,23 +47,11 @@ automation: - platform: state entity_id: sensor.dining_room_thermostat_operation_mode action: - - service: script.notify_me + - service: script.notify_family data_template: message: "Nest Thermostat changed from '{{ trigger.from_state.state }}' to '{{ trigger.to_state.state }}'." - - service: script.voice_notify - data_template: - message: > - {% set state = trigger.to_state.state %} - {% if state == "off" %} - Your home's thermostat is switched off. - {% elif state == "eco" %} - Your home's thermostat is set to eco or away mode. - {% elif state == "heat" %} - Your central heating is ON. - {% elif state == "cool" %} - Your central air condition is switched ON - {% elif state == "heat-cool" %} - Your home's thermostat is set to automatic mode. - {% else %} - Your home's thermostat is set to {{ state }} mode. - {% endif %} + notify_options: + - telegram + - tv + - led + - voice diff --git a/packages/notify.yaml b/packages/notify.yaml index 81c538d..cfce916 100644 --- a/packages/notify.yaml +++ b/packages/notify.yaml @@ -53,15 +53,128 @@ tts: # Telegram Configuration # telegram_bot: - # Setup Broadcast for sending messages - platform: broadcast api_key: !secret telegram_apikey allowed_chat_ids: - !secret telegram_chatid - # Add Polling - platform: polling api_key: !secret telegram_apikey parse_mode: html allowed_chat_ids: - !secret telegram_chatid + +script: + notify_family: + sequence: + - condition: template + value_template: '{{ message | trim != "" }}' + + - service: script.notify_on_led_screen + data_template: + message: "{{ message }}" + notify_options: "{{ notify_options }}" + + - service: script.notify_firestick + data_template: + url: "{{ url }}" + title: "{{ title }}" + message: "{{ message }}" + notify_options: "{{ notify_options }}" + + - service: script.notify_telegram + data_template: + file: "{{ url }}" + title: "{{ title }}" + message: "{{ message }}" + notify_options: "{{ notify_options }}" + + - service: script.notify_email + data_template: + title: "{{ title }}" + message: "{{ message }}" + notify_options: "{{ notify_options }}" + + - service: script.notify_voice + data_template: + message: "{{ message }}" + notify_options: "{{ notify_options }}" + + ############################################################################### + # NOTIFY OPTIONS + # 1. tv + # 2. telegram + # 3. led + # 4. email + # 5. voice + ############################################################################### + + notify_firestick: + sequence: + # - condition: state + # entity_id: input_boolean.firetv_alerts + # state: "on" + - condition: template + value_template: "{{ 'tv' in notify_options }}" + - service: notify.android_tv_fire_tv + data: + message: "{{ message }}" + title: Mahasri Bot + data: + color: red + duration: 7 + 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 -}} + + notify_telegram: + sequence: + # - condition: state + # entity_id: input_boolean.text_alerts + # state: "on" + - condition: template + value_template: "{{ 'telegram' in notify_options }}" + - service: telegram_bot.send_message + data: + title: "{{- title -}}" + message: "{{- message -}}" + data: + photo: + - file: "{{- file -}}" + caption: "{{- title -}}" + + notify_email: + sequence: + # - condition: state + # entity_id: input_boolean.email_alerts + # state: "on" + - condition: template + value_template: "{{ 'email' in notify_options }}" + - service: script.notify_smtp + data_template: + title: "{{ title }}" + message: "{{ message }}" + + notify_voice: + sequence: + # - condition: state + # entity_id: input_boolean.voice_alerts + # state: "on" + - condition: template + value_template: "{{ 'voice' in notify_options }}" + - service: script.voice_notify + data_template: + message: "{{ message }}" + + notify_on_led_screen: + sequence: + # - condition: state + # entity_id: input_boolean.led_alerts + # state: "on" + - condition: template + value_template: "{{ 'led' in notify_options }}" + - service: mqtt.publish + data_template: + topic: messageboard/messages + payload: "{{ message }}" diff --git a/packages/pill_reminder.yaml b/packages/pill_reminder.yaml index 437876e..e20bdb6 100644 --- a/packages/pill_reminder.yaml +++ b/packages/pill_reminder.yaml @@ -117,3 +117,39 @@ automation: entity_id: timer.timer_pill_reminder action: - service_template: script.remind_pill + +script: + ############################################################################### + # Notifies to take pills, starts timer again! + # Voice notifications at home - only if the option is selected. + ############################################################################### + remind_pill: + sequence: + - service: script.notify_family + data: + message: "ALERT: PLEASE TAKE YOUR TABLETS!" + notify_options: + - telegram + - service: timer.start + entity_id: timer.timer_pill_reminder + + ############################################################################### + # 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_family + data_template: + message: > + Thank you for taking tablets. + {%- if state_attr('sensor.allergy_index_today', 'rating') != None %} + {{- " Today's pollen level is : " ~ state_attr('sensor.allergy_index_today', 'rating') }}. + {%- endif -%} + notify_options: + - telegram + - tv + - led diff --git a/packages/qnap.yaml b/packages/qnap.yaml index 9bb130d..8976321 100644 --- a/packages/qnap.yaml +++ b/packages/qnap.yaml @@ -37,7 +37,7 @@ homeassistant: friendly_name: Drive 3 Status sensor.kalavala_nas_smart_status_drive_0_4: friendly_name: Drive 4 Status - + sensor.kalavala_nas_temperature_drive_0_1: friendly_name: Drive 1 Temperature sensor.kalavala_nas_temperature_drive_0_2: @@ -78,16 +78,15 @@ sensor: - drive_smart_status - drive_temp - -# The following sensors are required, as the automations with trigger platform `numeric_state`, -# above a certain value using `above: x` AND `for: 00:05:00` combination is not supported. -# -# Apparently `for:` is ONLY supportd for trigger platform 'state' -# -# By creating the folowing sensor, we can now have an automation with trigger platform as 'state' -# with a combination of `to:` and `for:` -# -# See the automations 'Notify NAS Memory Usage' and 'Notify NAS CPU Usage' that uses these sensor values + # The following sensors are required, as the automations with trigger platform `numeric_state`, + # above a certain value using `above: x` AND `for: 00:05:00` combination is not supported. + # + # Apparently `for:` is ONLY supportd for trigger platform 'state' + # + # By creating the folowing sensor, we can now have an automation with trigger platform as 'state' + # with a combination of `to:` and `for:` + # + # See the automations 'Notify NAS Memory Usage' and 'Notify NAS CPU Usage' that uses these sensor values - platform: template sensors: @@ -100,92 +99,106 @@ sensor: value_template: "{{ states('sensor.kalavala_nas_cpu_usage') | int > 80 }}" ############################################################################### -# _ _ _ -# /\ | | | | (_) -# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___ +# _ _ _ +# /\ | | | | (_) +# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___ # / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __| # / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \ # /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/ -# +# ############################################################################### automation: - - alias: Notify NAS Status Change initial_state: true trigger: platform: state - entity_id: - - sensor.kalavala_nas_status + entity_id: + - sensor.kalavala_nas_status condition: - condition: template value_template: "{{ trigger.from_state.state != trigger.to_state.state }}" action: - - service: script.notify_me + - service: script.notify_family data_template: message: "NAS Status changed to: {{ trigger.to_state.state| upper }}" + notify_options: + - telegram + - tv - alias: Notify NAS Drive Status Change initial_state: true trigger: platform: state - entity_id: - - sensor.kalavala_nas_smart_status_drive_01 - - sensor.kalavala_nas_smart_status_drive_02 - - sensor.kalavala_nas_smart_status_drive_03 - - sensor.kalavala_nas_smart_status_drive_04 + entity_id: + - sensor.kalavala_nas_smart_status_drive_01 + - sensor.kalavala_nas_smart_status_drive_02 + - sensor.kalavala_nas_smart_status_drive_03 + - sensor.kalavala_nas_smart_status_drive_04 condition: - condition: template - value_template: "{{ trigger.from_state.state != trigger.to_state.state }}" + value_template: "{{ trigger.from_state.state != trigger.to_state.state }}" action: - - service: script.notify_me + - service: script.notify_family data_template: - message: "NAS Drive state changed to: - {{ trigger.to_state.state| upper }} from - '{{ trigger.from_state.state| upper }}'" + message: "NAS Drive state changed to: {{ trigger.to_state.state| upper }} from '{{ trigger.from_state.state| upper }}'" + notify_options: + - telegram + - tv - alias: Notify NAS CPU Temperature initial_state: true trigger: platform: numeric_state - entity_id: sensor.kalavala_nas_cpu_temperature + entity_id: sensor.kalavala_nas_cpu_temperature above: 125 action: - - service: script.notify_me + - service: script.notify_family data_template: - message: "NAS CPU temperature is going crazy hot, needs your attention!!! - The current cpu temp is: {{ trigger.to_state.state }}" + message: "NAS CPU temperature is going crazy hot, needs your attention!!! Current cpu temp is: {{ trigger.to_state.state }}" + notify_options: + - telegram + - tv - alias: Notify NAS Disk Usage initial_state: true trigger: platform: numeric_state - entity_id: sensor.kalavala_nas_volume_used_datavol1 + entity_id: sensor.kalavala_nas_volume_used_datavol1 above: 80 action: - - service: script.notify_me + - service: script.notify_family data_template: message: "Attention! NAS disk usage is above 80 percent. Time to clean up?" + notify_options: + - telegram + - tv - alias: Notify NAS Memory Usage initial_state: true trigger: platform: state entity_id: sensor.nas_memory_usage_above_80 - to: 'True' - for: '00:05:00' + to: "True" + for: "00:05:00" action: - - service: script.notify_me + - service: script.notify_family data_template: message: "FYI - NAS Memory is above 80 percent for more than 5 minutes." + notify_options: + - telegram + - tv - alias: Notify NAS CPU Usage initial_state: true trigger: platform: state - entity_id: sensor.nas_cpu_usage_above_80 - to: 'True' - for: '00:05:00' + entity_id: sensor.nas_cpu_usage_above_80 + to: "True" + for: "00:05:00" action: - - service: script.notify_me + - service: script.notify_family data_template: message: "FYI - NAS CPU is above 80 percent for more than 5 minutes." + notify_options: + - telegram + - tv diff --git a/packages/recycle_trash.yaml b/packages/recycle_trash.yaml index 43f9fa3..70326dd 100644 --- a/packages/recycle_trash.yaml +++ b/packages/recycle_trash.yaml @@ -127,7 +127,7 @@ sensor: {% set month = states.sensor.date_time.state.split(',')[0].split('-')[1] %} {% set date = states.sensor.date_time.state.split(',')[0].split('-')[2] %} {% set today = strptime(year ~ '-' ~ month ~ '-' ~ date , '%Y-%m-%d') %} - {%- set pickupDay = states.sensor.trash_pickup_day.state | lower -%} + {%- set pickupDay = states.sensor.trash_pickup_day.state | lower -%} {%- if as_timestamp(today)| timestamp_custom('%A', true) | lower == pickupDay -%} yes {%- else -%} @@ -145,7 +145,7 @@ sensor: {% set year = states.sensor.date_time.state.split(',')[0].split('-')[0] %} {% set month = states.sensor.date_time.state.split(',')[0].split('-')[1] %} {% set date = states.sensor.date_time.state.split(',')[0].split('-')[2] %} - {% set today = strptime(year ~ '-' ~ month ~ '-' ~ date , '%Y-%m-%d') %} + {% set today = strptime(year ~ '-' ~ month ~ '-' ~ date , '%Y-%m-%d') %} {%- set pickupDay = states.sensor.recycle_pickup_day.state | lower -%} {% if states.input_select.recycle_pickup_week.state | lower == "even weeks" %} {%- set evenWeekPickup = "true" %} @@ -154,7 +154,7 @@ sensor: {% endif %} {%- macro day_of_week(timestamp) -%} {{ as_timestamp(timestamp)| timestamp_custom('%A', true) | lower }} - {%- endmacro %} + {%- endmacro %} {%- macro week_number_of_year() -%} {{ as_timestamp(today) | timestamp_custom('%U', true) | int }} {%- endmacro %} @@ -284,7 +284,7 @@ automation: - condition: template value_template: "{{ states('input_boolean.trash_reminders') == 'on' }}" - condition: template - value_template: "{{ states('input_boolean.home_mode_away') == 'off' }}" + value_template: "{{ states('input_boolean.home_mode_away') == 'off' }}" - condition: or conditions: - condition: state @@ -294,7 +294,7 @@ automation: entity_id: sensor.recycle_day state: "yes" action: - - service: script.notify_me + - service: script.notify_family data_template: message: > {% if states.sensor.trash_day.state == "yes" and states.sensor.recycle_day.state == "yes" %} @@ -304,18 +304,10 @@ automation: {% elif states.sensor.recycle_day.state == "yes" %} Attention!: Tomorrow is the Recycle Pickup day. Please don't forget to put the recycle bin outside tonight! {% endif %} - - - service: script.voice_notify - data_template: - message: > - {% if states.sensor.trash_day.state == "yes" and states.sensor.recycle_day.state == "yes" %} - Attention!: Tomorrow is the Trash and Recycle Pickup day. - Please don't forget to leave Trash bin and recycle bin outside tonight! - {% elif states.sensor.trash_day.state == "yes" %} - Attention!: Tomorrow is the Trash Pickup day. Please don't forget to put the Trash bin outside tonight! - {% elif states.sensor.recycle_day.state == "yes" %} - Attention!: Tomorrow is the Recycle Pickup day. Please don't forget to put the recycle bin outside tonight! - {% endif %} + notify_options: + - telegram + - tv + - led - alias: Reset Trash Reminders initial_state: true diff --git a/packages/scripts.yaml b/packages/scripts.yaml index bc41d1e..d1d3cc6 100644 --- a/packages/scripts.yaml +++ b/packages/scripts.yaml @@ -2,7 +2,7 @@ # @author : Mahasri Kalavala # @date : 09/20/2018 # @package : scripts -# @description : All my scripts are here in one place! +# @description : All my scripts are here in one place. Well, not ALL! ################################################################################ # _____ _ _ # / ____| (_) | | @@ -83,10 +83,12 @@ script: - service: alarm_control_panel.alarm_arm_away data: entity_id: alarm_control_panel.home - - service: script.notify_me + - service: script.notify_family data: message: > No one is at home. Cameras rolling, Indoor lights are OFF. Your home security system is turned ON! + notify_options: + - telegram ############################################################################### # The following script runs when no one is home. It excludes some lights @@ -168,48 +170,6 @@ script: # |___/ # Notify Related Scripts ############################################################################### - notify_me_with_picture: - sequence: - - condition: state - entity_id: input_boolean.text_alerts - state: "on" - - condition: template - value_template: '{{- message | trim != "" -}}' - - service: telegram_bot.send_message - data: - title: "{{- title -}}" - message: "{{- message -}}" - data: - photo: - - file: "{{- file -}}" - caption: "{{- caption -}}" - - notify_tv: - sequence: - - service: notify.android_tv_fire_tv - data: - message: "{{ message }}" - title: Mahasri Bot - data: - color: red - duration: 7 - transparency: 1% - icon: - path: /config/www/{{- [ "suresh.jpg", "srinika.jpg", "mallika.jpg", "hasika.jpg" ] | random -}} - - notify_me: - sequence: - - condition: state - entity_id: input_boolean.text_alerts - state: "on" - - condition: template - value_template: '{{ message | trim != "" }}' - - service: telegram_bot.send_message - data: - message: "{{ message }}" - - service: script.notify_tv - data: - message: "{{ message }}" good_night_tts: sequence: @@ -338,44 +298,3 @@ script: data_template: topic: messageboard/messages payload: "{{ message }}" - - ############################################################################### - # 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_template: - message: > - Thank you for taking tablets. - {%- if state_attr('sensor.allergy_index_today', 'rating') != None %} - {{- " Today's pollen level is : " ~ state_attr('sensor.allergy_index_today', 'rating') }}. - {%- endif -%} - - condition: template - value_template: "{{ states('input_boolean.pill_voice_notification') == 'on' }}" - - service: script.voice_notify - data: - message: "Thank you for taking tablets on time!" diff --git a/packages/season.yaml b/packages/season.yaml index 846dcc2..0924c74 100644 --- a/packages/season.yaml +++ b/packages/season.yaml @@ -1,7 +1,7 @@ ######################################################################################### # @Author: Suresh Kalavala # @Date: 09/13/2017 -# @Description: This Season sensor is used in the voice notifications to notify of Pollen +# @Description: This Season sensor is used in the voice notifications to notify of Pollen # levels ONLY during Spring - because I am allergic to spring pollen ;) # There you have it!!! # @@ -11,16 +11,15 @@ homeassistant: ############################################################################### -# _ _ _ -# /\ | | | | (_) -# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___ +# _ _ _ +# /\ | | | | (_) +# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___ # / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __| # / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \ # /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/ -# +# ############################################################################### automation: - - alias: Season Change Notification initial_state: true trigger: @@ -30,7 +29,10 @@ automation: - condition: template value_template: '{{ trigger.from_state.state | lower != "unknown" }}' action: - - service: script.notify_me + - service: script.notify_family data_template: - message: > - Good bye {{ trigger.from_state.state }}, and Say Hello to {{ trigger.to_state.state }}! + message: > + Good bye {{ trigger.from_state.state }}, and Say Hello to {{ trigger.to_state.state }}! + notify_options: + - telegram + - tv diff --git a/packages/settings.yaml b/packages/settings.yaml index 5a8f389..6058fda 100644 --- a/packages/settings.yaml +++ b/packages/settings.yaml @@ -116,7 +116,7 @@ input_number: step: 5 mode: box -######################### CLOSET LIGHTS + ######################### CLOSET LIGHTS hasika_bedroom_closet_lights: name: Hasika Closet Lights Duration min: 5 @@ -128,7 +128,7 @@ input_number: min: 5 max: 120 step: 5 - mode: box + mode: box sensor: - platform: template @@ -331,9 +331,11 @@ automation: - platform: state entity_id: input_boolean.do_not_disturb action: - - service: script.notify_me + - service: script.notify_family data_template: message: "The Do Not Disturb Mode is {{ trigger.to_state.state |upper }}." + notify_options: + - led # Hourly Reports ###################################################### diff --git a/packages/watchdog.yaml b/packages/watchdog.yaml index 9f61734..4b81e5a 100644 --- a/packages/watchdog.yaml +++ b/packages/watchdog.yaml @@ -32,9 +32,12 @@ automation: entity_id: input_boolean.light_automations state: "on" action: - - service: script.notify_me + - service: script.notify_family data: - message: "It has been two hours, are you still working in the garage? Changing the status to 'Not working'!" + message: "It has been two hours, are you still working in the garage?" + notify_options: + - telegram + - tv - service: input_boolean.turn_off entity_id: input_boolean.working_in_garage @@ -61,18 +64,15 @@ automation: entity_id: input_boolean.light_automations state: "on" action: - - service: script.notify_me - data_template: - message: > - Your {{ trigger.to_state.attributes.friendly_name }} is OPEN for more than 5 minutes! - - service: script.voice_notify - data_template: - message: > - Attention! Your {{ trigger.to_state.attributes.friendly_name }} is open for more than 5 minutes. - - service: script.led_message + - service: script.notify_family data_template: message: > Your {{ trigger.to_state.attributes.friendly_name }} is OPEN for more than 5 minutes! + notify_options: + - telegram + - voice + - tv + - led # Outdoor Lights: # Keeps and eye on the patio and backyard lights... @@ -98,10 +98,14 @@ automation: - service: switch.turn_off data_template: entity_id: "{{ trigger.entity_id }}" - - service: script.notify_me + - service: script.notify_family data_template: message: > {{ trigger.to_state.attributes.friendly_name }} is ON during the day time. Saving power by turning it off! + notify_options: + - telegram + - tv + - led # General Watch Dog automation: # Keeps and eye on the lights & switches, turns off after 10 PM if they are on. @@ -265,10 +269,9 @@ automation: data_template: entity_id: "{{ trigger.entity_id }}" - -############################################################################# -# CLOSET LIGHTS WATCH DOG -############################################################################# + ############################################################################# + # CLOSET LIGHTS WATCH DOG + ############################################################################# - alias: Srinika Bedroom Closet WatchDog initial_state: true @@ -305,114 +308,3 @@ automation: - service: homeassistant.turn_off data_template: entity_id: "{{ trigger.entity_id }}" - - - alias: Notify Plex User Status - initial_state: true - trigger: - # - platform: numeric_state - # entity_id: sensor.plex_mahasri_nas - # above: 0 - # for: - # minutes: 2 - - platform: state - entity_id: - - media_player.plex_adi_bh_plex_for_roku_roku3 - - media_player.plex_adi_bh_plex_for_roku_rokuultra - - media_player.plex_prade5_plex_for_roku_roku_express - to: 'playing' - for: - minutes: 2 - action: - - service: script.notify_me - data_template: - message: >- - {%- set tag_map = {'adi.bh':'Adi', 'prade5':'Pradeep'} -%} - {% for item in states.media_player if item.state == 'playing' and state_attr(item.entity_id, 'media_title') != None - and state_attr(item.entity_id, 'username') != 'kalavala' - and tag_map[state_attr(item.entity_id, 'username')] |trim != '' %} - - {{ tag_map[state_attr(item.entity_id, 'username')] }} is watching {% if state_attr(item.entity_id, 'media_content_type') == "movie" -%} - {{ "a movie, " + state_attr(item.entity_id, 'media_title') |title }} - {% endif %} - {%- if state_attr(item.entity_id, 'media_content_type') == "tvshow" %} - TV Show - {{ state_attr(item.entity_id, 'media_series_title') }} - Season: {{ state_attr(item.entity_id, 'media_season') }}, Episode: {{ state_attr(item.entity_id, 'media_episode') }} ({{ state_attr(item.entity_id, 'media_title') }}) - {% endif %} - {% endfor %} - - # - alias: Lights And Switches WatchDog 10 Min - # initial_state: true - # trigger: - # - platform: state - # entity_id: - # - switch.guest_bathroom_exhaust - # - switch.master_bathroom_toilet_exhaust - # to: "on" - # for: - # minutes: 10 - # condition: - # - condition: state - # entity_id: input_boolean.light_automations - # state: "on" - # action: - # - service: homeassistant.turn_off - # data_template: - # entity_id: "{{ trigger.entity_id }}" - -# -# Main master Bathoom has more CFM to vent out... keep it for 20 minutes -# - # - alias: Lights And Switches WatchDog 20 Min - # initial_state: true - # trigger: - # - platform: state - # entity_id: - # - switch.master_bathroom_shower_exhaust - # to: "on" - # for: - # minutes: 20 - # condition: - # - condition: state - # entity_id: input_boolean.light_automations - # state: "on" - # action: - # - service: homeassistant.turn_off - # data_template: - # entity_id: "{{ trigger.entity_id }}" - - # - alias: Lights And Switches WatchDog 30 Min - # initial_state: true - # trigger: - # - platform: state - # entity_id: - # - switch.guest_bathroom_lights - # - switch.master_bathroom_toilet_light - # to: "on" - # for: - # minutes: 30 - # condition: - # - condition: state - # entity_id: input_boolean.light_automations - # state: "on" - # action: - # - service: homeassistant.turn_off - # data_template: - # entity_id: "{{ trigger.entity_id }}" - - # - alias: Lights And Switches WatchDog 45 Min - # initial_state: true - # trigger: - # - platform: state - # entity_id: - # - switch.garage_shop_lights - # to: "on" - # for: - # minutes: 45 - # condition: - # - condition: state - # entity_id: input_boolean.light_automations - # state: "on" - # action: - # - service: homeassistant.turn_off - # data_template: - # entity_id: "{{ trigger.entity_id }}" \ No newline at end of file diff --git a/packages/weather.yaml b/packages/weather.yaml index cb40ac3..645bea5 100644 --- a/packages/weather.yaml +++ b/packages/weather.yaml @@ -101,11 +101,11 @@ binary_sensor: good_weather_to_fly_drones: friendly_name: Good Weather To Fly Drone? value_template: >- - {% if states.sensor.dark_sky_wind_speed.state | round(0) | int > 12 or - states.sensor.dark_sky_precip.state |lower == "rain" or + {% if states.sensor.dark_sky_wind_speed.state | round(0) | int > 12 or + states.sensor.dark_sky_precip.state |lower == "rain" or states.sensor.dark_sky_precip.state |lower == "snow" or - states.sensor.dark_sky_visibility.state | round(0) | int < 2 or - states.sensor.dark_sky_temperature.state | round(0) | int < 32 or + states.sensor.dark_sky_visibility.state | round(0) | int < 2 or + states.sensor.dark_sky_temperature.state | round(0) | int < 32 or states.sensor.dark_sky_cloud_coverage.state | round(0) | int > 30 %} false {% else %} @@ -192,7 +192,7 @@ automation: - condition: template value_template: "{% if states.sensor.dark_sky_wind_speed.state | round < 8 %} false {% else %} true {% endif %}" action: - - service: script.notify_me + - service: script.notify_family data_template: message: > {% set windspeed = states.sensor.dark_sky_wind_speed.state | round %} @@ -207,6 +207,10 @@ automation: {% elif ( windspeed > 60 ) and (states.input_boolean.hurricane_wind_alert.state == 'off') %} HURRICANE WINDS. FIND SHELTER, AND STAY INDOORS! {% endif %} + notify_options: + - telegram + - tv + - led - service: input_boolean.turn_on data_template: entity_id: >- @@ -283,15 +287,19 @@ automation: true {%- endif -%} action: - - service: script.notify_me + - service: script.notify_family data_template: message: > {% set windspeed = states.sensor.dark_sky_wind_speed.state | round %} {% if ( windspeed > 40 ) and ( windspeed <= 60 ) and (states.input_boolean.super_heavy_wind_alert.state == 'off') %} - Warning! Wind speed is {{windspeed}} MPH. FIND SHELTER IMMEDIATELY! + Warning! Wind speed is {{windspeed}} MPH. FIND SHELTER IMMEDIATELY! {% elif ( windspeed > 60 ) and ( windspeed <= 100 ) and (states.input_boolean.hurricane_wind_alert.state == 'off') %} HURRICANE WINDS. FIND SHELTER, AND STAY INDOORS! DO NOT GO OUT AND RISK YOUR LIFE! {% endif %} + notify_options: + - telegram + - tv + - led - alias: Rain Alerts initial_state: true @@ -309,12 +317,13 @@ automation: - condition: template value_template: "{{ states.sensor.dark_sky_precip_probability.state | int == 1 }}" action: - - service: script.notify_me + - service: script.notify_family data_template: message: "{{ trigger.to_state.state | title }} with intensity {{ states.sensor.dark_sky_precip_intensity.state | float }} inches per hour" - - service: script.voice_notify - data_template: - message: "{{ trigger.to_state.state }} with intensity {{ states.sensor.dark_sky_precip_intensity.state | float}} inches per hour" + notify_options: + - telegram + - tv + - led - service: input_boolean.turn_on data_template: entity_id: > @@ -339,12 +348,14 @@ automation: - condition: template value_template: "{{ states.sensor.dark_sky_precip_probability.state | int == 1 }}" action: - - service: script.notify_me + - service: script.notify_family data_template: message: "{{ trigger.to_state.state | title }} with intensity {{ states.sensor.dark_sky_precip_intensity.state | float }} inches per hour" - - service: script.voice_notify - data_template: - message: "{{ trigger.to_state.state }} with intensity {{ states.sensor.dark_sky_precip_intensity.state | float}} inches per hour" + notify_options: + - telegram + - voice + - tv + - led - service: input_boolean.turn_on data_template: entity_id: > diff --git a/packages/xiaomi_magic_cubes.yaml b/packages/xiaomi_magic_cubes.yaml index beef560..de753ff 100644 --- a/packages/xiaomi_magic_cubes.yaml +++ b/packages/xiaomi_magic_cubes.yaml @@ -473,9 +473,14 @@ script: doorbell_camera_pics: sequence: - - service: script.notify_me + - service: script.notify_family data: message: "ALERT! Someone is at the front door!" + notify_options: + - telegram + - voice + - tv + - led - service: camera.snapshot data_template: entity_id: "camera.frontdoor_camera" @@ -489,7 +494,7 @@ script: filename: "{{ '/config/www/downloads/camera/driveway/driveway_' ~ (state_attr('script.doorbell_camera_pics', 'last_triggered') ~ '').replace('-','_') - .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" + .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" - service: notify.telegram data_template: title: "Door Bell" @@ -503,4 +508,13 @@ script: - file: "{{ '/config/www/downloads/camera/driveway/driveway_' ~ (state_attr('script.doorbell_camera_pics', 'last_triggered') ~ '').replace('-','_') .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" - caption: "Someone rang door bell!" \ No newline at end of file + caption: "Someone rang door bell!" + - service: script.notify_family + data_template: + message: Someone rang door bell! + url: "{{ '/config/www/downloads/camera/frontdoor/frontdoor_' ~ + (state_attr('script.doorbell_camera_pics', 'last_triggered') ~ '').replace('-','_') + .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}" + notify_options: + - tv + - led diff --git a/packages/zones.yaml b/packages/zones.yaml index 458bc79..1104667 100644 --- a/packages/zones.yaml +++ b/packages/zones.yaml @@ -53,15 +53,15 @@ automation: - condition: template value_template: "{{ states('input_boolean.zone_alerts') == 'on' }}" action: - - service: script.notify_me + - service: script.notify_family data_template: message: > {{ trigger.entity_id.split('.')[1].split('_')[1] | title}} just entered {{ trigger.zone.attributes.friendly_name }}! - - service: script.voice_notify - data_template: - message: > - {{ trigger.entity_id.split('.')[1].split('_')[1] | title}} just entered {{ trigger.zone.attributes.friendly_name }}! - greeting: "no" + notify_options: + - telegram + - voice + - tv + - led - alias: Alert When Someone Leaves a Zone initial_state: true @@ -78,17 +78,14 @@ automation: - condition: template value_template: "{{ states('input_boolean.zone_alerts') == 'on' }}" action: - - service: script.notify_me + - service: script.notify_family data_template: message: "{{ trigger.entity_id.split('.')[1].split('_')[1] | title}} just left {{ trigger.zone.attributes.friendly_name }}." - - service: script.voice_notify - data_template: - message: >- - {{ trigger.entity_id.split('.')[1].split('_')[1] | title }} just left {{ trigger.zone.attributes.friendly_name }}. - {% if trigger.entity_id.split('.')[1].split('_')[1] == "suresh" and trigger.zone.attributes.friendly_name | lower == "office" %} - and will be home in {{ (states('sensor.suresh2home') | int) + 5 }} minutes. - {% endif %} - greeting: "no" + notify_options: + - telegram + - voice + - tv + - led ############################################################################### # Welcome family members when they come home @@ -110,15 +107,14 @@ automation: entity_id: input_boolean.zone_alerts state: "on" action: - - service: script.notify_me + - service: script.notify_family data_template: message: > Welcome home, {{ trigger.entity_id.split('.')[1].split('_')[1] | title }}! - - service: script.voice_notify - data_template: - message: > - "Welcome home, {{ trigger.entity_id.split('.')[1].split('_')[1] | lower }}!" - greeting: "no" + notify_options: + - voice + - tv + - led - service: input_boolean.turn_off entity_id: input_boolean.home_mode_away - service: switch.turn_on @@ -165,11 +161,16 @@ automation: - condition: template value_template: '{{ states.proximity.home.attributes.dir_of_travel == "towards" }}' action: - - service: script.notify_me + - service: script.notify_family data_template: message: "Suresh is on his way home, he is within the 5 miles range. Should be home soon!" + notify_options: + - telegram + - voice + - tv + - led -#################################################################################### + #################################################################################### - alias: Srinika Left Home initial_state: true trigger: @@ -188,7 +189,7 @@ automation: - switch.srinika_bedroom_closet - switch.srinika_bedroom_accent_lights -#################################################################################### + #################################################################################### - alias: Hasika Left Home initial_state: true trigger: