Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if devices_resp is None or devices_resp.get("items") is None:
_LOGGER.debug("Response did not contain any devices, no updates.")
return
for device_json in devices_resp["items"]:
serial_number = device_json.get("serial_number")
if serial_number is None:
_LOGGER.debug("No serial number for device with name {name}.".format(name=device_json.get("name")))
continue
if serial_number in self.devices:
device = self.devices[serial_number]
device.device_json = device_json
else:
self.devices[device_json["serial_number"]] = MyQDevice(
self, device_json
)
self._last_state_update = datetime.utcnow()