Fix zamg station check (#49367)
This commit is contained in:
parent
2976bbbbdd
commit
623baa7964
1 changed files with 7 additions and 2 deletions
|
@ -108,7 +108,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
station_id = config.get(CONF_STATION_ID) or closest_station(
|
||||
latitude, longitude, hass.config.config_dir
|
||||
)
|
||||
if station_id not in zamg_stations(hass.config.config_dir):
|
||||
if station_id not in _get_ogd_stations():
|
||||
_LOGGER.error(
|
||||
"Configured ZAMG %s (%s) is not a known station",
|
||||
CONF_STATION_ID,
|
||||
|
@ -239,9 +239,14 @@ class ZamgData:
|
|||
return self.data.get(variable)
|
||||
|
||||
|
||||
def _get_ogd_stations():
|
||||
"""Return all stations in the OGD dataset."""
|
||||
return {r["Station"] for r in ZamgData.current_observations()}
|
||||
|
||||
|
||||
def _get_zamg_stations():
|
||||
"""Return {CONF_STATION: (lat, lon)} for all stations, for auto-config."""
|
||||
capital_stations = {r["Station"] for r in ZamgData.current_observations()}
|
||||
capital_stations = _get_ogd_stations()
|
||||
req = requests.get(
|
||||
"https://www.zamg.ac.at/cms/en/documents/climate/"
|
||||
"doc_metnetwork/zamg-observation-points",
|
||||
|
|
Loading…
Add table
Reference in a new issue