diff --git a/config/packages/weather_alerts_nws.yaml b/config/packages/weather_alerts_nws.yaml index 34d070a..fbbb7e3 100755 --- a/config/packages/weather_alerts_nws.yaml +++ b/config/packages/weather_alerts_nws.yaml @@ -28,6 +28,9 @@ input_boolean: weather_alert_texts: name: Weather Alert Texts icon: mdi:telegram + lightning_warning: + name: Lightning Warning + icon: mdi:flash-alert ### You first need to find either your NWS Zone ID or County ID. I’m not sure which is better but I used my Zone ID here. ### You can find your Zone ID by going to https://alerts.weather.gov/ 7, scroll down to your state and click on the “zone list” then look for the entry for your county. @@ -40,6 +43,93 @@ sensor: - platform: nws_alerts zone_id: 'GAZ034,GAC135' + - platform: template + sensors: + flood_watch: + friendly_name: 'Flood Watch' + value_template: >- + {% if 'Flood Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[0] or + 'Flood Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[1] or + 'Flood Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[2] or + 'Flood Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[3] or + 'Flood Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[4] or + 'Flood Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[5] + %} + {{ states.sensor.nws_alerts.attributes.spoken_desc }} + {% else %} + inactive + {% endif %} + flood_warning: + friendly_name: 'Flood Warning' + value_template: >- + {% if 'Flood Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[0] or + 'Flood Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[1] or + 'Flood Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[2] or + 'Flood Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[3] or + 'Flood Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[4] or + 'Flood Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[5] + %} + {{ states.sensor.nws_alerts.attributes.spoken_desc }} + {% else %} + inactive + {% endif %} + tstorm_warning: + friendly_name: 'Thunderstorm Warning' + value_template: >- + {% if 'Thunderstorm Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[0] or + 'Thunderstorm Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[1] or + 'Thunderstorm Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[2] or + 'Thunderstorm Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[3] or + 'Thunderstorm Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[4] or + 'Thunderstorm Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[5] + %} + {{ states.sensor.nws_alerts.attributes.spoken_desc }} + {% else %} + inactive + {% endif %} + tstorm_watch: + friendly_name: 'Thunderstorm Watch' + value_template: >- + {% if 'Thunderstorm Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[0] or + 'Thunderstorm Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[1] or + 'Thunderstorm Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[2] or + 'Thunderstorm Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[3] or + 'Thunderstorm Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[4] or + 'Thunderstorm Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[5] + %} + {{ states.sensor.nws_alerts.attributes.spoken_desc }} + {% else %} + inactive + {% endif %} + tornado_watch: + friendly_name: 'Tornado Watch' + value_template: >- + {% if 'Tornado Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[0] or + 'Tornado Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[1] or + 'Tornado Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[2] or + 'Tornado Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[3] or + 'Tornado Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[4] or + 'Tornado Watch' in states.sensor.nws_alerts.attributes.title.split(' - ')[5] + %} + {{ states.sensor.nws_alerts.attributes.spoken_desc }} + {% else %} + inactive + {% endif %} + tornado_warning: + friendly_name: 'Tornado Warning' + value_template: >- + {% if 'Tornado Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[0] or + 'Tornado Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[1] or + 'Tornado Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[2] or + 'Tornado Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[3] or + 'Tornado Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[4] or + 'Tornado Warning' in states.sensor.nws_alerts.attributes.title.split(' - ')[5] + %} + {{ states.sensor.nws_alerts.attributes.spoken_desc }} + {% else %} + inactive + {% endif %} + automation: - alias: 'NWS Weather Alert Pop Up Control' initial_state: 'on' @@ -82,6 +172,14 @@ automation: {% else %} "{{ states.sensor.nws_alerts.attributes.display_desc.split('\n\n-\n\n')[0] }}" {% endif %} + + - alias: 'NWS Weather Sensor Refresh' + initial_state: 'on' + trigger: + platform: state + entity_id: sensor.nws_alerts + action: + - service: script.refresh_weather_alert_sensors - alias: NWS Notification Weather Alert initial_state: 'on' @@ -207,6 +305,40 @@ automation: title: "Tornado Warning!" message: "The National Weather Service Has issued a Tornado Warning for our area." + - alias: Lightning Detected + initial_state: 'on' + trigger: + - platform: geo_location + source: wwlln + zone: zone.lightning_warning + event: enter + action: + # - service: input_boolean.turn_on + # entity_id: input_boolean.lightning_warning + - service: script.text_notify + data_template: + who: "jeff" + title: "Lightning Detected!" + message: "Lightning has been detected within 50 miles of Anchorage House" + # - service: script.lightning_warning_audible + + # - alias: Lightning Warning Off + # initial_state: 'on' + # trigger: + # - platform: numeric_state + # entity_id: sensor.lightning_strike_count + # below: 1 + # action: + # - service: input_boolean.turn_off + # entity_id: input_boolean.lightning_warning + # - service: script.text_notify + # data_template: + # who: "jeff" + # title: "Lightning Threat Over." + # message: "No more Lightning Strikes detected." + # - service: script.lightning_clear_audible + + - alias: NWS Freeze Warning initial_state: 'on' trigger: @@ -318,3 +450,47 @@ script: data: media_content_id: http://192.168.7.40/audio/tornado_alarm.mp3 media_content_type: "music" + + lighning_warning_audible: + sequence: + - condition: state + entity_id: binary_sensor.day + state: 'on' + - service: script.twitter_notify_image + data_template: + tweet: '{{ [ "Did you see that flash? I did. Letting everyone know there is lightning nearby.", + "When Lightning is near I notify the residents of Anchorage House to keep them safe.", + "If the residents of Anchorage House didnt hear the thunder I just gave them a heads up.", + "Everyone inside! If you are near Anchorage House that is. Lightning is near." ] | random }}' + image: >- + {{ [ "/config/www/tweet_images/lightning.jpg", + "/config/www/tweet_images/lightning-bolt.jpg"] | random }} + - service: script.ah_report + data: + call_interuption: 1 + call_lightning_alert: 1 + + lighning_clear_audible: + sequence: + - condition: state + entity_id: binary_sensor.day + state: 'on' + - service: script.ah_report + data: + call_interuption: 1 + call_lightning_clear: 1 + + refresh_weather_alert_sensors: + sequence: + - service: homeassistant.update_entity + entity_id: sensor.tornado_warning + - service: homeassistant.update_entity + entity_id: sensor.tornado_watch + - service: homeassistant.update_entity + entity_id: sensor.tstorm_warning + - service: homeassistant.update_entity + entity_id: sensor.tstorm_watch + - service: homeassistant.update_entity + entity_id: sensor.flood_warning + - service: homeassistant.update_entity + entity_id: sensor.flood_watch \ No newline at end of file diff --git a/config/sensors/weather.yaml b/config/sensors/weather.yaml index 2dd9f8f..9616763 100755 --- a/config/sensors/weather.yaml +++ b/config/sensors/weather.yaml @@ -190,4 +190,9 @@ current_inside_humidity: friendly_name: "Current Inside Humidity" unit_of_measurement: '%' - value_template: "{{ states.climate.home.attributes.current_humidity }}" \ No newline at end of file + value_template: "{{ states.climate.home.attributes.current_humidity }}" + lightning_strike_count: + friendly_name: 'Lightning Strike Count' + entity_id: [] + value_template: >- + {{ states.geo_location | list | count }} \ No newline at end of file