Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
session = async_get_clientsession(hass)
if beta:
branch = "beta"
else:
branch = "stable"
if source == "pypi":
haversion = VersionData(PyPiVersion(hass.loop, session, branch))
elif source == "hassio":
haversion = VersionData(HassioVersion(hass.loop, session, branch, image))
elif source == "docker":
haversion = VersionData(DockerVersion(hass.loop, session, branch, image))
elif source == "haio":
haversion = VersionData(HaIoVersion(hass.loop, session))
else:
haversion = VersionData(LocalVersion(hass.loop, session))
if not name:
if source == DEFAULT_SOURCE:
name = DEFAULT_NAME_LOCAL
else:
name = DEFAULT_NAME_LATEST
async_add_entities([VersionSensor(haversion, name)], True)