mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Fix an Ambient PWS exception when location info is missing (#21220)
This commit is contained in:
parent
9057da01bd
commit
be26fc896d
@ -339,8 +339,10 @@ class AmbientStation:
|
|||||||
|
|
||||||
self.stations[station['macAddress']] = {
|
self.stations[station['macAddress']] = {
|
||||||
ATTR_LAST_DATA: station['lastData'],
|
ATTR_LAST_DATA: station['lastData'],
|
||||||
ATTR_LOCATION: station['info']['location'],
|
ATTR_LOCATION: station.get('info', {}).get('location'),
|
||||||
ATTR_NAME: station['info']['name'],
|
ATTR_NAME:
|
||||||
|
station.get('info', {}).get(
|
||||||
|
'name', station['macAddress']),
|
||||||
}
|
}
|
||||||
|
|
||||||
for component in ('binary_sensor', 'sensor'):
|
for component in ('binary_sensor', 'sensor'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user