So, kudos to @exxamalte who has been prolific with GeoJson integrations.
First by creating a base feed manager, then creating bespoke integrations on top of it. For instance: New sensor for alerts by NSW rural fire service - feedback welcome
I’ve been a tad frustrated with HomeAssistant’s default handling of geo_location platforms, with limitations such as all get_json_events
share the same source attribute, making it difficult to create specific maps. The only workaround being, as @exxamalte has been doing, creating bespoke integrations.
This is frustrating because when we want to integrate something in HomeAssistant, we usually want to integrate it immediately and not wait for the proper integration. I know I’ve been a bit impatient that way
Anyway, introducing aio-geojson-qujery
(hey, naming things is hard!) which is a consumer for any GeoJson feed out there. Specify what is needed to parse the feed in configuration.yaml
and get going!
As with previous integrations, what I have done is create a Pypi package, then write the HomeAssistant integration as an example:
(this is where the README file you should look at is located)
Below: easy integration with Flex Table and the Map component:
Here is the configuration:
configuration.yaml
:
geo_location:
- platform: aio_geojson_query
source: myquakes
endpoint: https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson
latitude: !secret home_latitude
longitude: !secret home_longitude
radius: 50
criteria:
- mag > 4.0
mappings:
id: code
dateformat: milliseconds
date: updated
extra_fields:
- mag
- place
- type
entity_namespace: 'aio_earthquakes'
- platform: aio_geojson_query
source: myfires
endpoint: https://www.fire.ca.gov/umbraco/api/IncidentApi/GeoJsonList?inactive=false
latitude: !secret home_latitude
longitude: !secret home_longitude
radius: 50
criteria:
- IsActive == Y
mappings:
id: UniqueId
dateformat: iso
date: Updated
title: Name
extra_fields:
- PercentContained
- AcresBurned
entity_namespace: 'aio_fires'
Note: I added a filter on IsActive
since this source seems to now ignore the inactive
parameter.
ui-lovelace.yaml
:
- type: horizontal-stack
cards:
- type: custom:button-card
name: Map
color: auto
color_type: label-card
tap_action:
action: call-service
service: browser_mod.command
service_data:
command: popup
title: Fires
card:
type: map
dark_mode: false
geo_location_sources:
- aio_geo_myfires
- type: custom:button-card
name: Map
color: auto
color_type: label-card
tap_action:
action: call-service
service: browser_mod.command
service_data:
command: popup
title: Quakes
card:
type: map
dark_mode: false
geo_location_sources:
- aio_geo_myquakes