Lightning Strike Alarm for Outdoor Swimming Pool

This is a fun project I worked on.

If there is lightning within 10 miles detected by my Tempest Weather Station (and near by sensors), it will send a SMS notification and also play an audible alert in my outdoor space.

alias: "Safety: Lightning Strike"
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.weatherflow_last_lightning_strike
condition:
  - condition: numeric_state
    entity_id: sensor.weatherflow_last_lightning_strike_distance
    below: 10
action:
  - variables:
      ttsmessage: >-
        Lightning has been detected within {{
        states('sensor.weatherflow_last_lightning_strike_distance') }} miles.
        Please stop outdoor activities and seek shelter until at least 30
        minutes after the most recent strike, which is currently {{
        (as_timestamp(now()) + 1800) | timestamp_custom('%I:%M%p') }}.
      smsmessage: "666 Evil St: {{ ttsmessage }}"
  - service: notify.twilio_sms
    data:
      message: "{{ smsmessage }}"
      target:
        - "+155555551212"
  - if:
      - condition: time
        after: "08:00:00"
        before: "22:00:00"
    then:
      - repeat:
          count: "2"
          sequence:
            - repeat:
                count: "3"
                sequence:
                  - service: media_player.play_media
                    target:
                      entity_id:
                        - media_player.pool_1
                        - media_player.pool_2
                        - media_player.deck
                    data:
                      announce: true
                      media_content_id: >-
                        https://www.mydomain.com/public/urgent_alert.mp3
                      media_content_type: music
                      extra:
                        volume: 70
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 2
                      milliseconds: 0
            - service: media_player.play_media
              target:
                entity_id:
                  - media_player.pool_1
                  - media_player.pool_2
                  - media_player.deck
              data:
                announce: true
                media_content_id: media-source://tts/cloud?message={{ ttsmessage | urlencode }}
                media_content_type: provider
                extra:
                  volume: 70
            - delay:
                seconds: >
                  {% set l = ttsmessage|length %} {% set speed = 120 %} {% set
                  duration_seconds = ((speed *
                  l)/1000)|round(0,method='ceil')|int %} {{ duration_seconds }}
  - delay:
      hours: 0
      minutes: 25
      seconds: 0
      milliseconds: 0
    enabled: true
mode: single

The safer thing to do is to install a lightning bolt arrestor somewhere tall and away from the pool, connected to ground.

Have that also, but it’s still safer to be inside and not in the pool during a storm.

I’m looking to have a Tempest station detect lightning and have Home Assistant trigger sirens and strobes…seems doable enough. Any insight you can provide would be greatly appreciated. Thanks!

You have to use the local integration, once you have that setup here’s my YAML, you’ll probably need to modify it.

alias: "Safety: Lightning Strike"
description: ""
triggers:
  - entity_id:
      - sensor.br_sensors_time_of_last_lightning_strike
    to: null
    trigger: state
conditions:
  - condition: numeric_state
    entity_id: sensor.br_sensors_distance_last_lightning_strike
    below: 10
  - condition: state
    entity_id: binary_sensor.br_binary_sensors_is_lightning
    state: "on"
actions:
  - variables:
      in_quiet_hours: "{{ is_state('binary_sensor.quiet_hours', 'on') }}"
      ttsmessage: >-
        Lightning has been detected within {{
        states('sensor.br_sensors_distance_last_lightning_strike') |
        float | round(1) }}  miles. Please stop outdoor activities and seek
        shelter until at least 30 minutes after the most recent strike, which is
        currently {{ (as_timestamp(now()) + 1800) | timestamp_custom('%I:%M%p')
        }}.
      smsmessage: "Home: {{ ttsmessage }}"
  - data:
      sms_message: "{{ smsmessage }}"
    action: script.send_sms
  - if:
      - condition: template
        value_template: "{{ not in_quiet_hours }}"
    then:
      - repeat:
          count: "2"
          sequence:
            - action: script.play_announcement
              metadata: {}
              data:
                tts_message: "  {{ ttsmessage }}"
                volume_input: 55
                media_selection_input: media-source://media_source/local/chime.mp3
                target_speakers:
                  entity_id:
                    - media_player.pool_1_sonos
                    - media_player.pool_2_sonos
                    - media_player.deck_sonos
            - delay:
                seconds: >
                  {% set l = ttsmessage|length %} {% set speed = 105 %} {% set
                  duration_seconds = ((speed *
                  l)/1000)|round(0,method='ceil')|int %} {{ duration_seconds }}
  - delay:
      hours: 0
      minutes: 25
      seconds: 0
      milliseconds: 0
    enabled: true
mode: single

Why is this needed. a simple weather alert and party time over. Technically this will work is most scenarios but since its only measuring the last lightning bolt distance and not actually predicting anything it could fail you can still get zapped in your pool then it will tell you last lightning strike was 0 feet away :people_hugging:

What type of weather alert are you suggesting? Current conditions are not always accurate on forecasting apps.

Typically for pools you want people out of the water if it’s lightning a minimum of 10 miles away, realistically lightning can travel 25 miles, although rare.

It’s not perfect, but it’s an additional safety measure, and we have teens that sometimes they need the reminder to come inside.

I also have another alert tied to the NWS web service that will play alerts for severe thunders storm warnings, tornado watches, and tornado warnings.

To your question though, why do I need this? My answer is, do we really need half the stuff we do in Home Assistant?

@amattas Hello! Just read through your outdoor pool lightning alarm thread, and it's basically the same project I've been building for my own setup, so I wanted to ask:

  1. Did you ever run into random false strikes?

On my end the local/UDP feed throws phantom strikes on totally calm, dry days. Almost every morning I get a "strike" pinned right overhead (~1 km / 0.6 mi) with no storm anywhere near and WeatherFlow's cloud shows nothing. Every so often that same noise reads farther out (like 5 mi) instead of overhead, which is annoying because it slips into a different alert tier. My best guess, after reading the datasheet on the AS3935 chip, seems like local RF interference... A/C compressor, appliances; no idea... lots of things seem to arc in the same frequency the chip listens on.

I also noticed you moved to the local UDP feed and lean on NWS alerts as a backstop... so a few questions if you don't mind:

  1. Did you hit the same calm-day false strikes on the local feed?
  2. If so, did you filter them out somehow, or just let NWS be the sanity check?
  3. How often do false alerts actually fire for you and has a real storm ever properly set the thing off?

Trying to figure out if this is just the nature of the AS3935 chip or something I can build a real filter for. Appreciate any insight, and nice work on the build.

It was just some weirdness for me on how the integration reports. This is what I do now and I rarely get a false notification.

alias: "Safety: Lightning Strike"
description: ""
triggers:
  - entity_id:
      - sensor.weatherstation_sensors_time_of_last_lightning_strike
    to: null
    trigger: state
conditions:
  - condition: numeric_state
    entity_id: sensor.weatherstation_sensors_distance_last_lightning_strike
    below: 10
  - condition: state
    entity_id: binary_sensor.weatherstation_binary_sensors_is_lightning
    state: "on"
actions:
  - variables:
      in_quiet_hours: "{{ is_state('binary_sensor.quiet_hours', 'on') }}"
      ttsmessage: >-
        Lightning has been detected within {{
        states('sensor.beckett_ridge_sensors_distance_last_lightning_strike') |
        float | round(1) }}  miles. Please stop outdoor activities and seek
        shelter until at least 30 minutes after the most recent strike, which is
        currently {{ (as_timestamp(now()) + 1800) | timestamp_custom('%I:%M%p')
        }}.
      smsmessage: "1428 Elm St: {{ ttsmessage }}"
  - data:
      sms_message: "{{ smsmessage }}"
    action: script.send_sms
  - if:
      - condition: template
        value_template: "{{ not in_quiet_hours }}"
    then:
      - repeat:
          count: "2"
          sequence:
            - action: script.play_announcement
              metadata: {}
              data:
                tts_message: "  {{ ttsmessage }}"
                volume_input: 55
                media_selection_input: media-source://media_source/local/chime.mp3
                target_speakers:
                  entity_id:
                    - media_player.pool_1_sonos
                    - media_player.pool_2_sonos
                    - media_player.deck_sonos
            - delay:
                seconds: >
                  {% set l = ttsmessage|length %} {% set speed = 105 %} {% set
                  duration_seconds = ((speed *
                  l)/1000)|round(0,method='ceil')|int %} {{ duration_seconds }}
  - delay:
      hours: 0
      minutes: 25
      seconds: 0
      milliseconds: 0
    enabled: true
mode: single

That's a pretty elegant way to do it. I'm over here creating helpers and a 4-part filter to corroborate against rain, wind, pressure, and storm approach... mode: single + a trailing delay is way cleaner.

Are your distance and is_lightning entities coming from the local UDP integration or the cloud one?

I'm trying to work out whether my noise is the chip or just my neighborhood.

It's from the local UDP one

I’m using https://www.blitzortung.org/