Detect haos as well (#2724)

* Detect "haos" CPE string as Home Assistant OS as well

* Improve Home Assistant OS detection/update messages

* Update supervisor/hassos.py

Co-authored-by: Pascal Vizeli <pascal.vizeli@syshack.ch>

Co-authored-by: Pascal Vizeli <pascal.vizeli@syshack.ch>
This commit is contained in:
Stefan Agner 2021-03-17 12:23:48 +01:00 committed by GitHub
parent 75e0741665
commit 9e1f899274
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,12 +85,12 @@ class HassOS(CoreSysAttributes):
break
ota_file.write(chunk)
_LOGGER.info("OTA update is downloaded on %s", raucb)
_LOGGER.info("Completed download of OTA update file %s", raucb)
return raucb
except (aiohttp.ClientError, asyncio.TimeoutError) as err:
self.sys_supervisor.connectivity = False
_LOGGER.warning("Can't fetch versions from %s: %s", url, err)
_LOGGER.warning("Can't fetch OTA update from %s: %s", url, err)
except OSError as err:
_LOGGER.error("Can't write OTA file: %s", err)
@ -104,7 +104,8 @@ class HassOS(CoreSysAttributes):
raise NotImplementedError()
cpe = CPE(self.sys_host.info.cpe)
if cpe.get_product()[0] != "hassos":
os_name = cpe.get_product()[0]
if os_name not in ("hassos", "haos"):
raise NotImplementedError()
except NotImplementedError:
_LOGGER.info("No Home Assistant Operating System found")
@ -120,7 +121,9 @@ class HassOS(CoreSysAttributes):
await self.sys_dbus.rauc.update()
_LOGGER.info(
"Detect HassOS %s / BootSlot %s", self.version, self.sys_dbus.rauc.boot_slot
"Detect Home Assistant Operating System %s / BootSlot %s",
self.version,
self.sys_dbus.rauc.boot_slot,
)
def config_sync(self) -> Awaitable[None]: