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

4 Likes

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

1 Like

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

2 Likes

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?