Skip to content

Commit c9fc345

Browse files
committed
Fix bug, previous fix did not take into account that the data was under the specific mac and so it would have failed when there was no previous data inserted for that mac.
1 parent 2263a80 commit c9fc345

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

custom_components/airthings_wave/airthings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,10 @@ def get_sensor_data(self):
203203
if characteristic.uuid in sensor_decoders:
204204
sensor_data = sensor_decoders[characteristic.uuid].decode_data(data)
205205
_LOGGER.debug("{} Got sensordata {}".format(mac, sensor_data))
206-
self.sensordata[mac].update(sensor_data)
206+
if self.sensordata.get(mac) is None:
207+
self.sensordata[mac] = sensor_data
208+
else:
209+
self.sensordata[mac].update(sensor_data)
207210
except (BLEError, NotConnectedError, NotificationTimeout):
208211
_LOGGER.exception("Failed to read characteristic")
209212

0 commit comments

Comments
 (0)