Closed groenmarsmannetje closed 3 years ago
I'm not the author of the software, but I think this line of geo_location.py
is key:
coordinator = hass.data[DOMAIN][config_entry.entry_id]
I think the const DOMAIN
is the geolocation source id, which in this case is set to blitzortung
in const.py
.
I'm setting my own map to that to see what happens, but I'm not 100% confident that is the correct value.
I have also set it up like that... now have to wait for some thunder storms ;-)
I don't think that will work as the integration provides a distance, azimuth and number of strikes. I have been through this some time ago with this on the forum. You have to make an automation that creates a device tracker from it:
- id: 'lightning'
alias: Lightning
trigger:
- platform: state
entity_id: sensor.blitzortung_lightning_azimuth
condition:
- "{{ states('sensor.blitzortung_lightning_counter') | float != 0 }}"
mode: restart
action:
- service: device_tracker.see
data:
dev_id: lightning
gps:
- "{{ state_attr('sensor.blitzortung_lightning_azimuth', 'lat') }}"
- "{{ state_attr('sensor.blitzortung_lightning_azimuth', 'lon') }}"
It will then make a device_tracker in known_devices.yaml or you might need to manually create it first..
lightning:
icon:
mac:
name: lightning
picture:
track: true
Then you can add to a map card in Lovelace like this:
- type: map
show_header_toggle: false
dark_mode: true
geo_location_sources: #these and the sources are optional
- nsw_rural_fire_service_feed
- gdacs
entities:
- zone.home
- device_tracker.lightning
Note when there is lightning, it will create a geo_location.lightning* entity but you can't plot it without calling the device.see service... I am actually wondering what will happen here when they finally do kill off known_devices.yaml? @mrk-its
@MrSuttonmann I can confirm that it works. See example of map with lightning strikes in my Home Assistant.
@groenmarsmannetje Awesome! Glad I could help.
You could also use (in your map card):
geo_location_sources:
- all
This will show all the geolightning entities without having to turn them into device_trackers.
- id: 'lightning' alias: Lightning trigger: - platform: state entity_id: sensor.blitzortung_lightning_azimuth condition: - "{{ states('sensor.blitzortung_lightning_counter') | float != 0 }}" mode: restart action: - service: device_tracker.see data: dev_id: lightning gps: - "{{ state_attr('sensor.blitzortung_lightning_azimuth', 'lat') }}" - "{{ state_attr('sensor.blitzortung_lightning_azimuth', 'lon') }}"
your condition syntax is incorrect and doesn’t pass checking, see here examples : https://www.home-assistant.io/docs/scripts/conditions/
- id: 'lightning' alias: Lightning trigger: - platform: state entity_id: sensor.blitzortung_lightning_azimuth condition: - "{{ states('sensor.blitzortung_lightning_counter') | float != 0 }}" mode: restart action: - service: device_tracker.see data: dev_id: lightning gps: - "{{ state_attr('sensor.blitzortung_lightning_azimuth', 'lat') }}" - "{{ state_attr('sensor.blitzortung_lightning_azimuth', 'lon') }}"
your condition syntax is incorrect and doesn’t pass checking, see here examples : https://www.home-assistant.io/docs/scripts/conditions/
It passed like this:
alias: Lightning_track
description: ""
trigger:
- platform: state
entity_id: sensor.blitzortung_lightning_azimuth
condition:
- "{{ states('sensor.blitzortung_lightning_counter') | float != 0 }}"
action:
- service: device_tracker.see
data:
dev_id: lightning
gps:
- "{{ state_attr('sensor.blitzortung_lightning_azimuth', 'lat') }}"
- "{{ state_attr('sensor.blitzortung_lightning_azimuth', 'lon') }}"
mode: restart
I would like to show a Lovelace map card with the lighting strikes, but to me it is not clear which "geo_location_source" I should use to only display these Blitzortung locations on the map. Please explain.