From ecdd16d0c68389a709f172dee244c55854d58b1f Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Thu, 19 Jan 2023 20:03:29 -0500 Subject: [PATCH] Reorganized lightning warnings --- packages/weatheralerts.yaml | 47 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/packages/weatheralerts.yaml b/packages/weatheralerts.yaml index 55273ba..6ccc9f0 100644 --- a/packages/weatheralerts.yaml +++ b/packages/weatheralerts.yaml @@ -1502,17 +1502,7 @@ automation: entity_id: input_boolean.lightning_warning state: 'off' action: - - service: script.text_alert - data: - who: 'all' - title: "Lightning Detected!" - message: >- - {% 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." - - service: input_boolean.turn_on - target: - entity_id: input_boolean.lightning_warning - - service: script.lightning_warning_audible + - service: script.lightning_warning - id: df317cd2-b5c6-43a7-a587-844403a4a0ad @@ -1526,14 +1516,7 @@ automation: entity_id: input_boolean.lightning_warning state: 'on' action: - - service: script.text_alert - data: - who: 'all' - title: "Lightning Clear" - message: "The lightning threat has passed. It is safe to resume normal activities." - - service: input_boolean.turn_off - entity_id: input_boolean.lightning_warning - - service: script.lightning_clear_audible + - service: script.lightning_clear - id: 9e34264f-b3c8-4537-ba31-b5915f2fd326 @@ -1574,7 +1557,8 @@ automation: ## script ## script: - lightning_warning_audible: + lightning_warning: + alias: 'Lightning Warning' sequence: - condition: state entity_id: input_boolean.audible_notifications @@ -1614,22 +1598,37 @@ script: who: 'common' call_interuption: 1 call_lightning_alert: 1 + - service: script.text_alert + data: + who: 'all' + title: "Lightning Detected!" + message: >- + {% 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." + - service: input_boolean.turn_on + target: + entity_id: input_boolean.lightning_warning - delay: seconds: 10 - service: scene.turn_on target: entity_id: scene.lightning_alert_restore - lightning_clear_audible: + lightning_clear: + alias: 'Lightning Clear' sequence: - - condition: state - entity_id: input_boolean.audible_notifications - state: 'on' - service: script.status_annc data_template: who: 'common' call_interuption: 1 call_lightning_clear: 1 + - service: script.text_alert + data: + who: 'all' + title: "Lightning Clear" + message: "The lightning threat has passed. It is safe to resume normal activities." + - service: input_boolean.turn_off + entity_id: input_boolean.lightning_warning ## Script creates UI notification and is called via automation defined above weatheralerts_popup_on_wx_alert: