Skip to content

Commit

Permalink
Added some error handling in the device init
Browse files Browse the repository at this point in the history
  • Loading branch information
sockless-coding committed May 22, 2020
1 parent 65a2042 commit 03f9c9c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions custom_components/panasonic_cc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
api = pcomfortcloud.Session(username, password, verifySsl=False)
devices = await hass.async_add_executor_job(api.get_devices)
for device in devices:
api_device = PanasonicApiDevice(hass, api, device)
await api_device.update()
hass.data[PANASONIC_DEVICES].append(api_device)
try:
api_device = PanasonicApiDevice(hass, api, device)
await api_device.update()
hass.data[PANASONIC_DEVICES].append(api_device)
except:
_LOGGER.warning(f"Failed to setup device: {device['name']}")

if hass.data[PANASONIC_DEVICES]:
for component in COMPONENT_TYPES:
Expand Down

0 comments on commit 03f9c9c

Please sign in to comment.