Fix an Ambient PWS exception when location info is missing (#21220)
parent
9057da01bd
commit
be26fc896d
|
@ -339,8 +339,10 @@ class AmbientStation:
|
|||
|
||||
self.stations[station['macAddress']] = {
|
||||
ATTR_LAST_DATA: station['lastData'],
|
||||
ATTR_LOCATION: station['info']['location'],
|
||||
ATTR_NAME: station['info']['name'],
|
||||
ATTR_LOCATION: station.get('info', {}).get('location'),
|
||||
ATTR_NAME:
|
||||
station.get('info', {}).get(
|
||||
'name', station['macAddress']),
|
||||
}
|
||||
|
||||
for component in ('binary_sensor', 'sensor'):
|
||||
|
|
Loading…
Reference in New Issue