minor updates and fixes

This commit is contained in:
Mahasri Kalavala 2022-12-06 17:52:48 -05:00
parent 97c8ced097
commit 1da8b4c837
4 changed files with 98 additions and 49 deletions

View File

@ -37,7 +37,7 @@ automation:
action: action:
- service: script.notify_family - service: script.notify_family
data: data:
message: "{{ trigger.to_state.attributes.friendly_name | title }}'s phone battery is : {{ trigger.to_state.attributes.battery }}%." message: "{{ trigger.to_state.attributes.friendly_name | title }}'s phone battery is : {{ trigger.to_state.attributes.battery_level }}%."
notify_options: notify_options:
- telegram - telegram
- led - led

View File

@ -1055,21 +1055,21 @@ automation:
- alias: Keep Chromecast On - alias: Keep Chromecast On
trigger: trigger:
- platform: state - platform: state
entity_id: media_player.attic_tv entity_id: media_player.chromecast_monitor
to: "off" to: "off"
for: for:
seconds: 30 seconds: 30
- platform: state - platform: state
entity_id: media_player.attic_tv entity_id: media_player.chromecast_monitor
to: "idle" to: "idle"
for: for:
seconds: 30 seconds: 30
action: action:
- service: media_player.turn_on - service: media_player.turn_on
entity_id: media_player.attic_tv entity_id: media_player.chromecast_monitor
- service: media_player.play_media - service: media_player.play_media
data: data:
entity_id: media_player.attic_tv entity_id: media_player.chromecast_monitor
media_content_id: !secret frontdoor_camera_stream_url media_content_id: !secret frontdoor_camera_stream_url
media_content_type: video media_content_type: video
- service: input_label.set_value - service: input_label.set_value
@ -1240,7 +1240,7 @@ script:
value_template: "{{ states('input_label.current_stream') != name }}" value_template: "{{ states('input_label.current_stream') != name }}"
- service: media_player.play_media - service: media_player.play_media
data: data:
entity_id: media_player.attic_tv entity_id: media_player.chromecast_monitor
media_content_id: "{{ url }}" media_content_id: "{{ url }}"
media_content_type: "video" media_content_type: "video"
- service: input_label.set_value - service: input_label.set_value

View File

@ -100,8 +100,8 @@ automation:
entity_id: switch.garage entity_id: switch.garage
################################################################################ ################################################################################
# Notifies when either of the garage door is opened or closed # Notifies when either of the garage doors is opened or closed
############################################################################### ################################################################################
- alias: Notify Garage Door Status - alias: Notify Garage Door Status
initial_state: true initial_state: true
trigger: trigger:
@ -113,9 +113,7 @@ automation:
- condition: template - condition: template
value_template: "{{ trigger.from_state.state not in ['unavailable', 'unknown'] }}" value_template: "{{ trigger.from_state.state not in ['unavailable', 'unknown'] }}"
- condition: template - condition: template
value_template: "{{ trigger.to_state.state not in ['unavailable', 'unknown'] }}" value_template: "{{ trigger.from_state.state != trigger.to_state.state }}"
- condition: template
value_template: "{{ states('input_boolean.garage_door_notifications') == 'on' }}"
action: action:
- service: switch.turn_on - service: switch.turn_on
entity_id: switch.garage entity_id: switch.garage
@ -125,42 +123,47 @@ automation:
filename: "{{ '/config/www/downloads/camera/garage/garage_' ~ filename: "{{ '/config/www/downloads/camera/garage/garage_' ~
((state_attr('automation.notify_garage_door_status', 'last_triggered') |string).replace('-','_') ((state_attr('automation.notify_garage_door_status', 'last_triggered') |string).replace('-','_')
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg') }}" .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg') }}"
- delay: "00:00:05"
################################################################################
# Notify devices
################################################################################
- service: script.notify_family - service: script.notify_family
data_template: data:
title: "Garage Door Status" title: "{{ 'Garage Door Open' if trigger.to_state.state | lower == 'on' else 'Garage Door Closed' }}"
message: > message: >
{% set doors = "" %} {% if trigger.to_state.state | lower == "on" %}
{% if states('binary_sensor.door_window_sensor_158d0004231f7b') == "on" and {{ trigger.to_state.attributes.friendly_name.replace('Sensor', '') -}} is OPEN
states('binary_sensor.door_window_sensor_158d0004248d5b') == "on" %} {% elif trigger.to_state.state | lower == "off" %}
{% set doors = "Attention! Both Garage Doors are OPEN" %} {{ trigger.to_state.attributes.friendly_name.replace('Sensor', '') -}} is CLOSED
{% elif states('binary_sensor.door_window_sensor_158d0004231f7b') == "off" and
states('binary_sensor.door_window_sensor_158d0004248d5b') == "off" %}
{% set doors = "Both Garage Doors are now CLOSED" %}
{% else %}
{% if trigger.from_state.state != trigger.to_state.state and trigger.to_state.state | lower == "on" %}
{% set doors = "Attention! Your {{ trigger.to_state.attributes.friendly_name }} is now OPENED!" %}
{% elif trigger.from_state.state != trigger.to_state.state and trigger.to_state.state | lower == "off" %}
{% set doors = "Your {{ trigger.to_state.attributes.friendly_name }} is now CLOSED!" %}
{% endif %} {% endif %}
url: !secret garage_camera_snapshot_url
notify_options:
- tv
- led
- voice
################################################################################
# SEND PICTURES AS ATTACHMENTS TO EMAIL AND TELEGRAM
################################################################################
- service: script.notify_family_with_picture
data:
title: "{{ 'Garage Door Open' if trigger.to_state.state | lower == 'on' else 'Garage Door Closed' }}"
message: >
{% if trigger.to_state.state | lower == "on" %}
{{ trigger.to_state.attributes.friendly_name.replace('Sensor', '') }} is OPEN
{% elif trigger.to_state.state | lower == "off" %}
{{ trigger.to_state.attributes.friendly_name.replace('Sensor', '') }} is CLOSED
{% endif %} {% endif %}
{{ doors }}
url: !secret garage_camera_snapshot_url url: !secret garage_camera_snapshot_url
path: > path: >
"{{ '/config/www/downloads/camera/garage/garage_' ~ "{{ '/config/www/downloads/camera/garage/garage_' ~
((state_attr('automation.notify_garage_door_status', 'last_triggered') |string).replace('-','_') ((state_attr('automation.notify_garage_door_status', 'last_triggered') |string).replace('-','_')
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg') }}" .replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg') }}"
notify_options: notify_options:
- tv - telegram
- led # - email
- service: notify.telegram
data_template: - delay: "00:00:05"
title: "Camera Images"
message: "Check the garage photo below:"
data:
photo:
- url: !secret garage_camera_snapshot_url
caption: "Garage"
- service: switch.turn_off - service: switch.turn_off
entity_id: switch.garage entity_id: switch.garage
@ -185,13 +188,13 @@ automation:
data: data:
message: > message: >
{% if trigger.to_state.state | lower == "on" %} {% if trigger.to_state.state | lower == "on" %}
Your {{ trigger.to_state.attributes.friendly_name.replace('Sensor', '') }} is OPEN, Your {{ trigger.to_state.attributes.friendly_name.replace(' Sensor', '') }} is OPEN
{% if states('alarm_control_panel.home') == 'armed_home' or {% if states('alarm_control_panel.home') == 'armed_home' or
states('alarm_control_panel.home') == 'armed_away' %} states('alarm_control_panel.home') == 'armed_away' %}
But your home security system is ON. But your home security system is ON.
{% endif %} {% endif %}
{% elif trigger.to_state.state | lower == "off" %} {% elif trigger.to_state.state | lower == "off" %}
Your {{ trigger.to_state.attributes.friendly_name.replace('Sensor', '') }} is CLOSED! Your {{ trigger.to_state.attributes.friendly_name.replace(' Sensor', '') }} is CLOSED
{% endif %} {% endif %}
notify_options: notify_options:
# - telegram # - telegram

View File

@ -76,6 +76,24 @@ telegram_bot:
# Notify Related Scripts # Notify Related Scripts
############################################################################### ###############################################################################
script: script:
notify_family_with_picture:
sequence:
- condition: template
value_template: '{{ message | trim != "" }}'
- service: script.notify_telegram_with_picture
data:
url: "{{ url }}"
path: "{{ path }}" # local path
title: "{{ title }}"
message: "{{ message }}"
notify_options: "{{ notify_options }}"
- service: script.notify_email_with_picture
data:
title: "{{ title }}"
message: "{{ message }}"
path: "{{ path }}" # local path
notify_options: "{{ notify_options }}"
notify_family: notify_family:
sequence: sequence:
- condition: template - condition: template
@ -96,7 +114,6 @@ script:
- service: script.notify_telegram - service: script.notify_telegram
data: data:
file: "{{ url }}"
title: "{{ title }}" title: "{{ title }}"
message: "{{ message }}" message: "{{ message }}"
notify_options: "{{ notify_options }}" notify_options: "{{ notify_options }}"
@ -137,8 +154,8 @@ script:
duration: 7 duration: 7
url: url:
path: "{{ url }}" #/config/www/downloads/camera/driveway/driveway_20220604_185216.jpg path: "{{ url }}" #/config/www/downloads/camera/driveway/driveway_20220604_185216.jpg
file: image:
path: "{{ url }}" #/config/www/downloads/camera/driveway/driveway_20220604_185216.jpg url: "{{ url }}" #/config/www/downloads/camera/driveway/driveway_20220604_185216.jpg
icon: icon:
path: > path: >
/config/www/{{- [ "suresh.jpg", "srinika.jpg", "mallika.jpg", "hasika.jpg", /config/www/{{- [ "suresh.jpg", "srinika.jpg", "mallika.jpg", "hasika.jpg",
@ -169,9 +186,6 @@ script:
data: data:
title: "{{ title }}" title: "{{ title }}"
message: "{{ message }}" message: "{{ message }}"
data:
images:
- "{{- path -}}"
notify_voice: notify_voice:
sequence: sequence:
@ -196,6 +210,38 @@ script:
topic: messageboard/messages topic: messageboard/messages
payload: "{{ message }}" payload: "{{ message }}"
notify_telegram_with_picture:
sequence:
- condition: state
entity_id: input_boolean.telegram_notifications
state: "on"
- condition: template
value_template: "{{ 'telegram' in notify_options }}"
- service: notify.telegram
data:
message: "{{ message }}"
title: "{{ title }}"
data:
photo:
- url: "{{ url }}"
caption: "{{ title }}"
notify_email_with_picture:
sequence:
- condition: state
entity_id: input_boolean.email_notifications
state: "on"
- condition: template
value_template: "{{ 'email' in notify_options }}"
- delay: "00:00:20"
- service: notify.notify_smtp
data:
title: "{{ title }}"
message: "{{ message }}"
data:
images:
- "{{- path -}}"
############################################################################### ###############################################################################
# Voice Notify # Voice Notify
# Conditions: # Conditions: