Lightning strikes nearby

I understand that but still I should get a new entity to show up in HA no ? :confused: Will activate back Map in HA just in case !

Does anyone have an example of setting up an automation with this? Would like to have a notification if a lightning strike occurs

1 Like

docs are here:

https://www.home-assistant.io/components/wwlln/

Entities are generated, updated and removed automatically with each update from the feed.

This may make it tough to automate however

All, please see the Geolocation docs for how to automate this (and any other geo_location platform): https://www.home-assistant.io/components/geo_location/

I do it the old fashioned way. You hear thunder, you get out of the pool.
Actually this gives me an idea for a project from my old ham radio days which used an inexpensive AM radio receiver to detect lightning strikes and the static build-up a few seconds before the bolt lets loose.

1 Like

I like the idea, but Iā€™m wondering whether any ā€œsmartā€ switch would really be sufficient protection against a lightning strike. My understanding (and thankfully Iā€™ve never been hit by one) is that even if an appliance or device is turned off, it can still get ā€œfriedā€ if itā€™s plugged in.

Trying to get it working. I get this error after a restart of HA:

2019-07-20 08:14:56 ERROR (MainThread) [homeassistant.components.geo_location] Error while setting up platform wwlln
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 122, in _async_setup_platform
    task = async_create_setup_task()
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 87, in async_create_setup_task
    None, platform.setup_platform, hass, platform_config,
AttributeError: module 'homeassistant.components.wwlln.geo_location' has no attribute 'setup_platform'

Regarding lightningmaps.org, you can download data, however you must be a contributor to that network. I.E. you must have the hardware and be an active participant.

On the wwlln, you can download data easily. The URL previously mentioned by @daveb will give you all the current data. You probably want to filter by radius and time window.

I modified bachyaā€™s test programs to do thatā€¦ It gives an output that looks like this:

`Radius (miles)= 50
Window (minutes)= 60
Number of records= 37

Closest strike key= 6975997
key = 6975997 distance = 2.8637461086570926
{ā€˜unixTimeā€™: 1563817565.0, ā€˜latā€™: 24.82, ā€˜longā€™: 1.67, ā€˜distanceā€™: 2.8637461086570926}
2019-07-22 17:46:05
h:m:s ago = 0:36:29.516275
minutes ago= 36.5

most recent strike key= 6513357
key = 6513357 distance = 33.00594693510524
{ā€˜unixTimeā€™: 1563817975.4, ā€˜latā€™: 24.53, ā€˜longā€™: 2.11, ā€˜distanceā€™: 33.00594693510524}
2019-07-22 17:52:55
h:m:s ago = 0:29:39.116633
minutes ago= 29.6
`.

I uploaded the program to github:
https://github.com/gds32571/wwlln

Be sure to check the settings - lat, long radius, etc.

I have never seen data newer than 30 minutes, so this may not be useful for protecting hardware.

For that purpose, I use an Acurite thunderstorm sensor (06045M), and an SDR receiver connected to a Raspberry Pi with rtl_433, and some software. You might look at my sdr-bash on github.

Let me also add, you can use double pole relays to disconnect both sides of a power connection to gain some reasonable isolation. Here are some pictures of relays controlled by RPis and Home Assistant.

[https://www.flickr.com/photos/88117211@N00/albums/72157709688832461]

Nothing can protect against lightning. But if you use a double-pole relay to disconnect both sides of the power, and the device has only a power connection to the physical world (network is WiFi), then you could have at least a 1000 volts of isolation. Anything is better than nothing.

Just a thought, wouldnā€™t it better to leave the entity and then just set it to zero if not lightning strikes, increment it if there is, and then set back to zero when there isnā€™t any lightning strikes. Of course this would be off the range of time the end user sets. So if one sets it for 30 minutes then until there is no lightning strikes within 30 minutes would reflect how many times there was lightning. After the range of time without any lightning strikes the entity would reset to zero.

1 Like

I agree that does sound perfect.

Iā€™d like to use this component to trigger an automation. As an example, if lightning strikes within the distance in the config, change the state of something (boolean Lightning mode On?) so I can kick off an automation that runs until 30 minutes after Lightning mode is Off. Is this possible?

1 Like

Certainly! https://www.home-assistant.io/integrations/geo_location/

1 Like

Maybe somebody here might want to try this https://esphome.io/components/sensor/as3935.html

1 Like

FYI - Iā€™ve just created custom component for fetching lightning data from Blitzortung.org: https://github.com/mrk-its/homeassistant-blitzortung Iā€™m using websocket connection, so updates are realtime. Iā€™m also following their data usage policy http://en.blitzortung.org/contact.php (component connects to proxy mqtt server instead of direct connection to their servers)

6 Likes

Great job discovering their MQTT usage! Are you considering making this an official submission?

1 Like

MQTT proxy thing is my own :slight_smile: Blitzortung simply requires that third party applications use own servers to provide data to their user. This proxy also greatly reduces amount of data sent to users (it reduces packet size and mqtt allows for subscribing to geographical region thanks to geohashing).
Regarding official submission - yes, Iā€™m planning that, but first I want to test it as custom component (especially performance of this MQTT proxy - currently it is running on small VPS, I wonder how much concurrent connections it is going to serve). Currently Iā€™m adding it to HACS to find more testers.

3 Likes

Hi Mariusz,

thanks for this great component!

Please allow me to make some feature requests:

  • Service to reset counter
  • Config to automatically reset counter (daily, hourly)
  • Add sensor ā€œstorm is comingā€, which indicates if lightning is tracking towards the home location
  • At the moment the counter and distance are not gouped. Having this enables more features:
    *it would be nice to count lightning in mini-areas. Letā€™s say there are 5 thunderstorms active withing the range set (the default 100km). I envision a sensor which has counts per thunderstorm in its attributes.
  • track speed of moving cells

Maybe itā€™s not possible or out of your scope, thatā€™s fine.

Well done and thanks again!

@JeeCee thanks for your kind words and interesting suggestions :slight_smile: Latest version has reset timeout configurable (by default it resets sensors after 120 minutes of inactivity, it may be changed with 1-minute resolution or disabled). I can add service for resetting on demand (it may be quite useful if reset timeout is disabled).

In terms of lightning clustering or some more advanced postprocessing - I will probably try to keep this component simple. But of course such things can be done by other components / automations, using data provided by this integration :slight_smile: