Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
gjohansson-ST committed Jun 7, 2020
1 parent b8b4dbf commit f959b1a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions custom_components/sector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async def async_setup(hass, config):
await sector_data.async_update()
hass.data[DATA_SA] = sector_data

if FULLSYSTEMINFO['Temperatures'] is None:
if FULLSYSTEMINFO['Temperatures'] is None or FULLSYSTEMINFO['Temperatures'] == []:
_LOGGER.debug("Sector: No Temp devices found")
else:
_LOGGER.debug("Sector: Found Temp devices")
Expand All @@ -106,7 +106,7 @@ async def async_setup(hass, config):
discovery.async_load_platform(hass, "sensor", DOMAIN, {}, config)
)

if FULLSYSTEMINFO['Locks'] is None:
if FULLSYSTEMINFO['Locks'] is None or FULLSYSTEMINFO['Locks'] == []:
_LOGGER.debug("Sector: No Lock devices found")
else:
_LOGGER.debug("Sector: Found Lock devices")
Expand All @@ -118,7 +118,7 @@ async def async_setup(hass, config):
CONF_CODE: config[DOMAIN][CONF_CODE]
}, config))

if FULLSYSTEMINFO['Panel'] is None:
if FULLSYSTEMINFO['Panel'] is None or FULLSYSTEMINFO['Panel'] == []:
_LOGGER.debug("Sector: Platform not ready")
raise PlatformNotReady
else:
Expand Down Expand Up @@ -156,7 +156,7 @@ def __init__(self, fullsysteminfo, panel_id, userid, password, authtoken):
async def get_thermometers(self):
temps = self.fullsysteminfo['Temperatures']

if temps is None:
if temps is None or temps == []:
_LOGGER.debug("Sector: failed to fetch temperature sensors")
return None

Expand All @@ -165,7 +165,7 @@ async def get_thermometers(self):
async def get_locks(self):
locks = self.fullsysteminfo['Locks']

if locks is None:
if locks is None or locks == []:
_LOGGER.debug("Sector: failed to fetch locks")
return None

Expand All @@ -174,7 +174,7 @@ async def get_locks(self):
async def get_panel(self):
panel = self.fullsysteminfo['Panel']

if panel is None:
if panel is None or panel == []:
_LOGGER.debug("Sector: failed to fetch panel")
return None

Expand Down Expand Up @@ -306,7 +306,7 @@ async def async_update(self):
_LOGGER.debug("Sector: AUTH_TOKEN still valid: %s", AUTH_TOKEN)

temps = self.fullsysteminfo['Temperatures']
if temps is None:
if temps is None or temps == []:
_LOGGER.debug("Sector: No update temps")
else:
async with session.get("https://mypagesapi.sectoralarm.net/api/Panel/GetTemperatures?panelId={}".format(self.panel_id),
Expand All @@ -323,7 +323,7 @@ async def async_update(self):
_LOGGER.debug("Sector: Tempstatus fetch: %s", json.dumps(self._tempstatus))

locks = self.fullsysteminfo['Locks']
if locks is None:
if locks is None or locks == []:
_LOGGER.debug("Sector: No update locks")
else:
async with session.get("https://mypagesapi.sectoralarm.net/api/Panel/GetLockStatus?panelId={}".format(self.panel_id),
Expand Down

0 comments on commit f959b1a

Please sign in to comment.