Move lightning alerts to Node-RED

This commit is contained in:
2023-08-05 19:29:16 -04:00
parent c0c66962b2
commit e44dc85eab

View File

@ -1561,26 +1561,26 @@ automation:
entity_id: input_text.weatheralerts_triggered_audible_alert_ids entity_id: input_text.weatheralerts_triggered_audible_alert_ids
value: "{{ state_attr('sensor.weatheralerts_alert_1', 'alert_id') }} {{ state_attr('sensor.weatheralerts_alert_2', 'alert_id') }} {{ state_attr('sensor.weatheralerts_alert_3', 'alert_id') }} {{ state_attr('sensor.weatheralerts_alert_4', 'alert_id') }} {{ state_attr('sensor.weatheralerts_alert_5', 'alert_id') }}" value: "{{ state_attr('sensor.weatheralerts_alert_1', 'alert_id') }} {{ state_attr('sensor.weatheralerts_alert_2', 'alert_id') }} {{ state_attr('sensor.weatheralerts_alert_3', 'alert_id') }} {{ state_attr('sensor.weatheralerts_alert_4', 'alert_id') }} {{ state_attr('sensor.weatheralerts_alert_5', 'alert_id') }}"
- id: 04b1119f-4e30-4ae3-ae50-632ac521c871 # - id: 04b1119f-4e30-4ae3-ae50-632ac521c871
alias: Lightning Detected # alias: Lightning Detected
trigger: # trigger:
- platform: state # - platform: state
entity_id: binary_sensor.lightning_warning # entity_id: binary_sensor.lightning_warning
from: 'off' # from: 'off'
to: 'on' # to: 'on'
action: # action:
- service: script.lightning_warning # - service: script.lightning_warning
- id: df317cd2-b5c6-43a7-a587-844403a4a0ad # - id: df317cd2-b5c6-43a7-a587-844403a4a0ad
alias: Lightning Warning Off # alias: Lightning Warning Off
trigger: # trigger:
- platform: state # - platform: state
entity_id: binary_sensor.lightning_warning # entity_id: binary_sensor.lightning_warning
from: 'on' # from: 'on'
to: 'off' # to: 'off'
action: # action:
- service: script.lightning_clear # - service: script.lightning_clear
- id: 9e34264f-b3c8-4537-ba31-b5915f2fd326 - id: 9e34264f-b3c8-4537-ba31-b5915f2fd326
@ -1667,87 +1667,87 @@ automation:
## script ## ## script ##
script: script:
lightning_warning: # lightning_warning:
alias: 'Lightning Warning' # alias: 'Lightning Warning'
sequence: # sequence:
- service: script.text_notify # - service: script.text_notify
data: # data:
type: alert # type: alert
who: 'all' # who: 'all'
title: "Lightning Detected!" # title: "Lightning Detected!"
message: >- # message: >-
{% set ltgdist = (states('sensor.blitzortung_lightning_distance') | int) / 1.609 | round %} # {% set ltgdist = (states('sensor.blitzortung_lightning_distance') | int) / 1.609 | round %}
"Lightning has been detected within 20 miles of the house. Nearest storm is {{ ltgdist }} miles away." # "Lightning has been detected within 20 miles of the house. Nearest storm is {{ ltgdist }} miles away."
tag: lightning-warning # tag: lightning-warning
- if: # - if:
- condition: state # - condition: state
entity_id: binary_sensor.audible_weather_alerts_allowed # entity_id: binary_sensor.audible_weather_alerts_allowed
state: 'on' # state: 'on'
then: # then:
- service: scene.create # - service: scene.create
data: # data:
scene_id: lightning_alert_restore # scene_id: lightning_alert_restore
snapshot_entities: # snapshot_entities:
- light.tina_lamp_side # - light.tina_lamp_side
- light.tina_lamp_top # - light.tina_lamp_top
- light.tina_desk_strip # - light.tina_desk_strip
- light.dining_room_lamp # - light.dining_room_lamp
- switch.adaptive_lighting_living_room # - switch.adaptive_lighting_living_room
- switch.adaptive_lighting_tina_lamp # - switch.adaptive_lighting_tina_lamp
- service: switch.turn_off # - service: switch.turn_off
target: # target:
entity_id: # entity_id:
- switch.adaptive_lighting_tina_lamp # - switch.adaptive_lighting_tina_lamp
- delay: # - delay:
milliseconds: 500 # milliseconds: 500
- service: light.turn_on # - service: light.turn_on
target: # target:
entity_id: # entity_id:
- light.tina_lamp_side # - light.tina_lamp_side
- light.tina_lamp_top # - light.tina_lamp_top
- light.tina_desk_strip # - light.tina_desk_strip
data: # data:
color_name: red # color_name: red
- service: light.turn_off # - service: light.turn_off
target: # target:
entity_id: light.dining_room_lamp # entity_id: light.dining_room_lamp
- service: script.living_room_lights_alert # - service: script.living_room_lights_alert
data: # data:
type: red # type: red
duration: 10 # duration: 10
- service: script.status_annc # - service: script.status_annc
data: # data:
who: common # who: common
type: weather # type: weather
call_interruption: 1 # call_interruption: 1
call_lightning_alert: 1 # call_lightning_alert: 1
- delay: # - delay:
seconds: 10 # seconds: 10
- service: scene.turn_on # - service: scene.turn_on
target: # target:
entity_id: scene.lightning_alert_restore # entity_id: scene.lightning_alert_restore
lightning_clear: # lightning_clear:
alias: 'Lightning Clear' # alias: 'Lightning Clear'
sequence: # sequence:
- service: script.text_notify # - service: script.text_notify
data: # data:
type: alert # type: alert
who: all # who: all
message: clear_notification # message: clear_notification
tag: lightning-warning # tag: lightning-warning
- service: script.status_annc # - service: script.status_annc
data: # data:
who: common # who: common
type: weather # type: weather
call_interruption: 1 # call_interruption: 1
call_lightning_clear: 1 # call_lightning_clear: 1
- service: script.text_notify # - service: script.text_notify
data: # data:
type: alert # type: alert
who: 'all' # who: 'all'
title: "Lightning Clear" # title: "Lightning Clear"
message: "The lightning threat has passed. It is safe to resume normal activities." # message: "The lightning threat has passed. It is safe to resume normal activities."
## Script creates UI notification and is called via automation defined above ## Script creates UI notification and is called via automation defined above
weatheralerts_popup_on_wx_alert: weatheralerts_popup_on_wx_alert: