Fix Fibaro component failure to load with HC3 (#38528)

Fixed a rarely occuring problem (maybe a change with Fibaro HC3) where some scenes don't have a "visible" parameter, which was assumed to be mandatory in the past.
This commit is contained in:
pbalogh77 2020-08-04 14:55:03 +02:00 committed by GitHub
parent 0c030cb8cf
commit fe07d79744
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -235,7 +235,7 @@ class FibaroController:
scenes = self._client.scenes.list() scenes = self._client.scenes.list()
self._scene_map = {} self._scene_map = {}
for device in scenes: for device in scenes:
if not device.visible: if "visible" in device and not device.visible:
continue continue
device.fibaro_controller = self device.fibaro_controller = self
if device.roomID == 0: if device.roomID == 0:
@ -292,7 +292,11 @@ class FibaroController:
# otherwise add the first visible device in the group # otherwise add the first visible device in the group
# which is a hack, but solves a problem with FGT having # which is a hack, but solves a problem with FGT having
# hidden compatibility devices before the real device # hidden compatibility devices before the real device
if last_climate_parent != device.parentId and device.visible: if (
last_climate_parent != device.parentId
and "visible" in device
and device.visible
):
self.fibaro_devices[dtype].append(device) self.fibaro_devices[dtype].append(device)
last_climate_parent = device.parentId last_climate_parent = device.parentId
_LOGGER.debug( _LOGGER.debug(