added notifications code

This commit is contained in:
Mahasri Kalavala 2022-12-02 21:44:37 -05:00
parent dafef91d88
commit b9cfeeeea2
2 changed files with 39 additions and 8 deletions

View File

@ -14,6 +14,10 @@ automation:
data_template:
message: >
{{ states('sensor.dark_sky_apparent_temperature') |int }} degrees, {{ states('sensor.dark_sky_hourly_summary') }}
- service: script.notify_tv
data_template:
message: >
{{ states('sensor.dark_sky_apparent_temperature') |int }} degrees, {{ states('sensor.dark_sky_hourly_summary') }}
###############################################################################
# Display Garage Door Status on LED Screen
@ -51,6 +55,24 @@ automation:
{% endif %}
{% endif %}
{{ doors }}
- service: script.notify_tv
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 }}
###############################################################################
# Display Zone based Messages on LED Screen
@ -71,6 +93,9 @@ automation:
- service: script.led_message
data_template:
message: "Welcome home, {{ trigger.entity_id.split('.')[1].split('_')[1] | title }}"
- service: script.notify_tv
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

View File

@ -184,6 +184,19 @@ script:
- 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
@ -194,16 +207,9 @@ script:
- service: telegram_bot.send_message
data:
message: "{{ message }}"
- service: notify.android_tv_fire_tv
- service: script.notify_tv
data:
message: "{{ message }}"
title: Mahasri Bot
data:
color: red
duration: 10
transparency: 1%
icon:
path: /config/www/{{- [ "suresh.jpg", "srinika.jpg", "mallika.jpg", "hasika.jpg" ] | random -}}
good_night_tts:
sequence: