Skip to content

Add support for World Wide Lightning Location Network#25001

Merged
bachya merged 15 commits into
home-assistant:devfrom
bachya:wwlln
Jul 10, 2019
Merged

Add support for World Wide Lightning Location Network#25001
bachya merged 15 commits into
home-assistant:devfrom
bachya:wwlln

Conversation

@bachya
Copy link
Copy Markdown
Contributor

@bachya bachya commented Jul 7, 2019

Description:

This PR adds support for the World Wide Lightning Location Network (WWLLN) as a geolocation platform.

Related issue (if applicable): N/A

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#9802

Example entry for configuration.yaml (if applicable):

wwlln:

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@MartinHjelmare
Copy link
Copy Markdown
Member

MartinHjelmare commented Jul 7, 2019

Sounds like this could better be a geo_location platform?

For each lightning strike within the configured radius a new geo_location entity is created. Optionally let the time frame be configured to set the clean up window when entities should be removed.

If the user wants to count strikes a template sensor can be used.

@bachya
Copy link
Copy Markdown
Contributor Author

bachya commented Jul 7, 2019

@MartinHjelmare Interesting! Let me ponder that. One issue I currently see: the geo_rss_events component seems to expect everything in metric, but I want to give users the ability to use whatever unit system they've defined in their configuration.yaml. I suppose I could convert imperial units to metric units (when necessary) before instantiating a GeoRSS client..

EDIT: Another issue is that the geo_rss_events component expects an HTTP-hosted XML stream as input data; that won't exist in this case. Rather, I would need to give aiowwlln a method that can produce valid GeoRSS XML and then modify python-georss-generic-client to accept that raw input. Seems like a lot of work, no?

@MartinHjelmare
Copy link
Copy Markdown
Member

The geo_location component is a general base component and doesn't rely on any specific library or metric system.

https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/geo_location/__init__.py

@bachya
Copy link
Copy Markdown
Contributor Author

bachya commented Jul 7, 2019

Ahh, okay; I misread and assumed you meant GeoRSS. Let me dig into this a bit.

@bachya
Copy link
Copy Markdown
Contributor Author

bachya commented Jul 9, 2019

@MartinHjelmare I've refocused this PR from sensors to geolocation; will appreciate your thoughts at your leisure.

FYI, this is now waiting on #25046 (which allows geolocation platforms to use config entries).

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Comment thread homeassistant/components/wwlln/__init__.py Outdated
Comment thread homeassistant/components/wwlln/geo_location.py
Comment thread homeassistant/components/wwlln/geo_location.py Outdated
Comment thread homeassistant/components/wwlln/geo_location.py Outdated
@bachya
Copy link
Copy Markdown
Contributor Author

bachya commented Jul 10, 2019

@MartinHjelmare In addition to addressing your latest feedback, I realized aiowwlln wasn't providing a good "window" option, meaning strike data could feasibly hang on for way too long. The latest commits add this; sorry for additional chunks to review.

Comment thread homeassistant/components/wwlln/config_flow.py Outdated
Comment thread homeassistant/components/wwlln/geo_location.py Outdated
Comment thread homeassistant/components/wwlln/geo_location.py Outdated
Comment thread tests/components/wwlln/test_config_flow.py
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Unfortunately python 3.7 tests are flaky at the moment so I can't merge. We have to wait for an admin or until we fix the tests and can rebase.

@bachya bachya merged commit 9ccb85d into home-assistant:dev Jul 10, 2019
@bachya bachya deleted the wwlln branch July 10, 2019 22:41
@lock lock Bot locked and limited conversation to collaborators Jul 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants