Fix HC3 compatibility further (#38931)

* Update __init__.py

Further fixes for HC3 compatibility.

* Update homeassistant/components/fibaro/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
pbalogh77 2020-08-17 08:19:34 +02:00 committed by GitHub
parent 7071f3a966
commit 5a4de04bcf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -235,10 +235,10 @@ class FibaroController:
scenes = self._client.scenes.list()
self._scene_map = {}
for device in scenes:
if "visible" in device and not device.visible:
if "name" not in device or "id" not in device:
continue
device.fibaro_controller = self
if device.roomID == 0:
if "roomID" not in device or device.roomID == 0:
room_name = "Unknown"
else:
room_name = self._room_map[device.roomID].name
@ -250,6 +250,7 @@ class FibaroController:
device.unique_id_str = f"{self.hub_serial}.scene.{device.id}"
self._scene_map[device.id] = device
self.fibaro_devices["scene"].append(device)
_LOGGER.debug("%s scene -> %s", device.ha_id, device)
def _read_devices(self):
"""Read and process the device list."""
@ -259,8 +260,10 @@ class FibaroController:
last_climate_parent = None
for device in devices:
try:
if "name" not in device or "id" not in device:
continue
device.fibaro_controller = self
if device.roomID == 0:
if "roomID" not in device or device.roomID == 0:
room_name = "Unknown"
else:
room_name = self._room_map[device.roomID].name