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:
- service: script.notify_family
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:
- telegram
- led

View File

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

View File

@ -100,8 +100,8 @@ automation:
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
initial_state: true
trigger:
@ -111,11 +111,9 @@ automation:
- binary_sensor.door_window_sensor_158d0004231f7b # 2 Car Garage
condition:
- condition: template
value_template: "{{ trigger.from_state.state not in ['unavailable', 'unknown'] }}"
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' }}"
value_template: "{{ trigger.from_state.state != trigger.to_state.state }}"
action:
- service: switch.turn_on
entity_id: switch.garage
@ -125,42 +123,47 @@ automation:
filename: "{{ '/config/www/downloads/camera/garage/garage_' ~
((state_attr('automation.notify_garage_door_status', 'last_triggered') |string).replace('-','_')
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg') }}"
- delay: "00:00:05"
################################################################################
# Notify devices
################################################################################
- service: script.notify_family
data_template:
title: "Garage Door Status"
data:
title: "{{ 'Garage Door Open' if trigger.to_state.state | lower == 'on' else 'Garage Door Closed' }}"
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.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 %}
{% 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 %}
{{ doors }}
url: !secret garage_camera_snapshot_url
path: >
"{{ '/config/www/downloads/camera/garage/garage_' ~
((state_attr('automation.notify_garage_door_status', 'last_triggered') |string).replace('-','_')
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg') }}"
notify_options:
- tv
- led
- service: notify.telegram
data_template:
title: "Camera Images"
message: "Check the garage photo below:"
data:
photo:
- url: !secret garage_camera_snapshot_url
caption: "Garage"
- 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 %}
url: !secret garage_camera_snapshot_url
path: >
"{{ '/config/www/downloads/camera/garage/garage_' ~
((state_attr('automation.notify_garage_door_status', 'last_triggered') |string).replace('-','_')
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg') }}"
notify_options:
- telegram
# - email
- delay: "00:00:05"
- service: switch.turn_off
entity_id: switch.garage
@ -185,13 +188,13 @@ automation:
data:
message: >
{% 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
states('alarm_control_panel.home') == 'armed_away' %}
But your home security system is ON.
{% endif %}
{% 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 %}
notify_options:
# - telegram

View File

@ -76,6 +76,24 @@ telegram_bot:
# Notify Related Scripts
###############################################################################
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:
sequence:
- condition: template
@ -96,7 +114,6 @@ script:
- service: script.notify_telegram
data:
file: "{{ url }}"
title: "{{ title }}"
message: "{{ message }}"
notify_options: "{{ notify_options }}"
@ -137,8 +154,8 @@ script:
duration: 7
url:
path: "{{ url }}" #/config/www/downloads/camera/driveway/driveway_20220604_185216.jpg
file:
path: "{{ url }}" #/config/www/downloads/camera/driveway/driveway_20220604_185216.jpg
image:
url: "{{ url }}" #/config/www/downloads/camera/driveway/driveway_20220604_185216.jpg
icon:
path: >
/config/www/{{- [ "suresh.jpg", "srinika.jpg", "mallika.jpg", "hasika.jpg",
@ -169,9 +186,6 @@ script:
data:
title: "{{ title }}"
message: "{{ message }}"
data:
images:
- "{{- path -}}"
notify_voice:
sequence:
@ -196,6 +210,38 @@ script:
topic: messageboard/messages
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
# Conditions: