230 lines
8.0 KiB
YAML
230 lines
8.0 KiB
YAML
- alias: Notification Android TV - Cellular Incoming
|
||
description: Android TV notification of incoming cellular call
|
||
triggers:
|
||
- entity_id:
|
||
- sensor.sm_g950f_phone_state
|
||
- sensor.sm_n975f_phone_state
|
||
to: ringing
|
||
trigger: state
|
||
conditions:
|
||
- condition: state
|
||
entity_id: media_player.android_tv
|
||
state: 'on'
|
||
actions:
|
||
- repeat:
|
||
sequence:
|
||
action: notify.android_tv
|
||
data:
|
||
data: null
|
||
title: Incoming Phone Call
|
||
message: "The Van Door is {% if is_state('binary_sensor.i_o_linc_1f_0b_58_sensor',\
|
||
\ 'off') %}Closed{% else %}Open{% endif %}! color: gray position: center\
|
||
\ duration: 5 fontsize: max transparency: \"75%\" interrupt: 1 icon:\n\
|
||
\ url: >-\n {% if is_state('binary_sensor.i_o_linc_1f_0b_58_sensor',\
|
||
\ 'off')\n %} http://192.168.1.192/img/gd_closed.png {% else %}\n \
|
||
\ http://192.168.1.192/img/gd_open.png {% endif %}\nimage:\n path:\
|
||
\ /www/images/"
|
||
while:
|
||
- condition: or
|
||
conditions:
|
||
- condition: state
|
||
entity_id: sensor.sm_g950f_phone_state
|
||
state: ringing
|
||
- condition: state
|
||
entity_id: sensor.sm_n975f_phone_state
|
||
state: ringing
|
||
mode: single
|
||
- alias: Notification LG TV - Incoming Cellular
|
||
description: LG TV notification of incoming cellular call
|
||
triggers:
|
||
- entity_id:
|
||
- sensor.sm_a715f_phone_state
|
||
- sensor.new_phone_phone_state
|
||
to: ringing
|
||
trigger: state
|
||
conditions:
|
||
- condition: state
|
||
entity_id: media_player.lg_webos_tv_um7600pta
|
||
state: 'on'
|
||
- condition: template
|
||
value_template: "{% set phones = [\n 'sensor.sm_a715f_last_notification',\n \
|
||
\ 'sensor.new_phone_last_notification'\n] %} {% set ns = namespace(is_whatsapp_call\
|
||
\ = false) %} {% for s in phones %}\n {% if state_attr(s, 'package') == 'com.whatsapp'\n\
|
||
\ and (state_attr(s, 'category') or '') | lower == 'call'\n and 'incoming\
|
||
\ voice call' in ((state_attr(s, 'android.text') or '') | lower) %}\n {%\
|
||
\ set ns.is_whatsapp_call = true %}\n {% endif %}\n{% endfor %} {{ not ns.is_whatsapp_call\
|
||
\ }}"
|
||
actions:
|
||
- repeat:
|
||
sequence:
|
||
- action: notify.lg_webos_tv_um7600pta
|
||
data:
|
||
message: Answer your cell phone — it’s ringing!
|
||
title: Incoming Call
|
||
- delay:
|
||
seconds: 5
|
||
while:
|
||
- condition: or
|
||
conditions:
|
||
- condition: state
|
||
entity_id: sensor.sm_a715f_phone_state
|
||
state: ringing
|
||
mode: single
|
||
- alias: Notification LG TV - Incoming SMS
|
||
description: LG TV notification of incoming cellular SMS
|
||
triggers:
|
||
- entity_id:
|
||
- sensor.sm_a715f_last_notification
|
||
- sensor.new_phone_last_notification
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 0
|
||
trigger: state
|
||
conditions:
|
||
- condition: template
|
||
value_template: "{{ trigger.entity_id in [\n 'sensor.sm_a715f_last_notification',\n\
|
||
\ 'sensor.new_phone_last_notification']\n and state_attr(trigger.entity_id,\
|
||
\ 'package') in [\n 'com.android.mms',\n 'com.google.android.apps.messaging',\n\
|
||
\ 'com.samsung.android.messaging']\n and state_attr(trigger.entity_id,\
|
||
\ 'android.text') != none\n and 'voice call' not in state_attr(trigger.entity_id,\
|
||
\ 'android.text') | lower }}"
|
||
- condition: state
|
||
entity_id: media_player.lg_webos_tv_um7600pta
|
||
state: 'on'
|
||
actions:
|
||
- repeat:
|
||
count: 2
|
||
sequence:
|
||
- action: notify.lg_webos_tv_um7600pta
|
||
data:
|
||
message: You have received a SMS!
|
||
title: Incoming SMS
|
||
- delay:
|
||
seconds: 5
|
||
mode: single
|
||
- alias: Notification LG TV - Incoming WhatsApp
|
||
description: LG TV notification of incoming WhatsApp call
|
||
triggers:
|
||
- entity_id:
|
||
- sensor.sm_a715f_last_notification
|
||
- sensor.new_phone_last_notification
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 0
|
||
trigger: state
|
||
conditions:
|
||
- condition: state
|
||
entity_id: media_player.lg_webos_tv_um7600pta
|
||
state: 'on'
|
||
- condition: template
|
||
value_template: "{{ trigger.entity_id in [\n 'sensor.sm_a715f_last_notification',\n\
|
||
\ 'sensor.new_phone_last_notification']\n and state_attr(trigger.entity_id,\
|
||
\ 'package') == 'com.whatsapp'\n and state_attr(trigger.entity_id, 'category')\
|
||
\ == 'call'\n and 'incoming voice call' in state_attr(trigger.entity_id,\
|
||
\ 'android.text')|lower }}"
|
||
actions:
|
||
- repeat:
|
||
count: 2
|
||
sequence:
|
||
- action: notify.lg_webos_tv_um7600pta
|
||
data:
|
||
message: Answer your WhatsApp — it’s ringing!
|
||
title: Incoming Call
|
||
- delay:
|
||
seconds: 5
|
||
mode: single
|
||
- alias: Notification Light - Incoming Cellular Call Flash
|
||
description: Colour flash lights on incoming calls and return lights to previous
|
||
state
|
||
triggers:
|
||
- entity_id:
|
||
- sensor.sm_a715f_phone_state
|
||
to: ringing
|
||
trigger: state
|
||
conditions:
|
||
- condition: template
|
||
value_template: "{% set phones = [\n 'sensor.sm_a715f_last_notification'\n] %}\
|
||
\ {% set ns = namespace(is_whatsapp_call = false) %} {% for s in phones %}\n\
|
||
\ {% if state_attr(s, 'package') == 'com.whatsapp'\n and (state_attr(s,\
|
||
\ 'category') or '') | lower == 'call'\n and 'incoming voice call' in ((state_attr(s,\
|
||
\ 'android.text') or '') | lower) %}\n {% set ns.is_whatsapp_call = true\
|
||
\ %}\n {% endif %}\n{% endfor %} {{ not ns.is_whatsapp_call }}"
|
||
actions:
|
||
- target:
|
||
entity_id: script.flash_alert_lights
|
||
data:
|
||
variables:
|
||
light_group: light.light_group_incoming_call_flash
|
||
col1: blue
|
||
col2: white
|
||
brightness_high: 80
|
||
brightness_low: 20
|
||
flash_count: 4
|
||
flash_delay: 00:00:02
|
||
action: script.turn_on
|
||
mode: single
|
||
- alias: Notification Light - Incoming SMS Call Flash
|
||
description: Colour flash lights on incoming SMS message and return lights to previous
|
||
state
|
||
triggers:
|
||
- entity_id:
|
||
- sensor.sm_a715f_last_notification
|
||
- sensor.new_phone_last_notification
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 0
|
||
trigger: state
|
||
conditions:
|
||
- condition: template
|
||
value_template: "{{ trigger.entity_id in [\n 'sensor.sm_a715f_last_notification',\n\
|
||
\ 'sensor.new_phone_last_notification']\n and state_attr(trigger.entity_id,\
|
||
\ 'package') in [\n 'com.android.mms',\n 'com.google.android.apps.messaging',\n\
|
||
\ 'com.samsung.android.messaging']\n and state_attr(trigger.entity_id,\
|
||
\ 'android.text') != none\n and 'voice call' not in state_attr(trigger.entity_id,\
|
||
\ 'android.text') | lower }}"
|
||
actions:
|
||
- target:
|
||
entity_id: script.flash_alert_lights
|
||
data:
|
||
variables:
|
||
light_group: light.light_group_incoming_call_flash
|
||
col1: yellow
|
||
col2: white
|
||
brightness_high: 80
|
||
brightness_low: 20
|
||
flash_count: 4
|
||
flash_delay: 00:00:02
|
||
action: script.turn_on
|
||
mode: single
|
||
- alias: Notification Light - Incoming WhatsApp Call Flash
|
||
description: Flash lights on incoming WhatsApp call
|
||
triggers:
|
||
- entity_id:
|
||
- sensor.sm_a715f_last_notification
|
||
- sensor.new_phone_last_notification
|
||
trigger: state
|
||
conditions:
|
||
- condition: template
|
||
value_template: "{{ trigger.entity_id in [\n 'sensor.sm_a715f_last_notification',\n\
|
||
\ 'sensor.new_phone_last_notification']\n and state_attr(trigger.entity_id,\
|
||
\ 'package') == 'com.whatsapp'\n and state_attr(trigger.entity_id, 'category')\
|
||
\ == 'call'\n and 'incoming voice call' in state_attr(trigger.entity_id, 'android.text')|lower\
|
||
\ }}"
|
||
actions:
|
||
- target:
|
||
entity_id: script.flash_alert_lights
|
||
data:
|
||
variables:
|
||
light_group: light.light_group_incoming_call_flash
|
||
col1: green
|
||
col2: white
|
||
brightness_high: 80
|
||
brightness_low: 20
|
||
flash_count: 4
|
||
flash_delay: 00:00:02
|
||
action: script.turn_on
|
||
mode: single
|