core/homeassistant/components/hassio/const.py

63 lines
1.3 KiB
Python
Raw Normal View History

"""Hass.io const variables."""
from enum import Enum
DOMAIN = "hassio"
ATTR_ADDON = "addon"
2019-07-31 19:25:30 +00:00
ATTR_ADDONS = "addons"
ATTR_ADMIN = "admin"
ATTR_CONFIG = "config"
ATTR_DATA = "data"
2019-07-31 19:25:30 +00:00
ATTR_DISCOVERY = "discovery"
ATTR_ENABLE = "enable"
ATTR_FOLDERS = "folders"
ATTR_HOMEASSISTANT = "homeassistant"
ATTR_INPUT = "input"
2019-07-31 19:25:30 +00:00
ATTR_PANELS = "panels"
ATTR_PASSWORD = "password"
2019-07-31 19:25:30 +00:00
ATTR_TITLE = "title"
ATTR_USERNAME = "username"
ATTR_UUID = "uuid"
ATTR_WS_EVENT = "event"
ATTR_ENDPOINT = "endpoint"
ATTR_METHOD = "method"
ATTR_RESULT = "result"
ATTR_TIMEOUT = "timeout"
2019-07-31 19:25:30 +00:00
X_HASSIO = "X-Hassio-Key"
X_INGRESS_PATH = "X-Ingress-Path"
2019-07-31 19:25:30 +00:00
X_HASS_USER_ID = "X-Hass-User-ID"
X_HASS_IS_ADMIN = "X-Hass-Is-Admin"
WS_TYPE = "type"
WS_ID = "id"
WS_TYPE_API = "supervisor/api"
WS_TYPE_EVENT = "supervisor/event"
WS_TYPE_SUBSCRIBE = "supervisor/subscribe"
EVENT_SUPERVISOR_EVENT = "supervisor_event"
Add hassio addon_update service and hassio config entry with addon and OS devices and entities (#46342) * add addon_update service, use config flow to set up config entry, create disabled sensors * move most of entity logic to common entity class, improve device info, get rid of config_flow user step * fix setup logic * additional refactor * fix refactored logic * fix config flow tests * add test for addon_update service and get_addons_info * add entry setup and unload test and fix update coordinator * handle if entry setup calls unload * return nothing for coordinator if entry is being reloaded because coordinator will get recreated anyway * remove entry when HA instance is no longer hassio and add corresponding test * handle adding and removing device registry entries * better config entry reload logic * fix comment * bugfix * fix flake error * switch pass to return * use repository attribute for model and fallback to url * use custom 'system' source since hassio source is misleading * Update homeassistant/components/hassio/entity.py Co-authored-by: Franck Nijhof <frenck@frenck.nl> * update remove addons function name * Update homeassistant/components/hassio/__init__.py Co-authored-by: Franck Nijhof <frenck@frenck.nl> * fix import * pop coordinator after unload * additional fixes * always pass in sensor name when creating entity * prefix one more function with async and fix tests * use supervisor info for addons since list is already filtered on what's installed * remove unused service * update sensor names * remove added handler function * use walrus * add OS device and sensors * fix * re-add addon_update service schema * add more test coverage and exclude entities from tests * check if instance is using hass OS in order to create OS entities Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2021-03-01 08:41:04 +00:00
ATTR_VERSION = "version"
ATTR_VERSION_LATEST = "version_latest"
ATTR_UPDATE_AVAILABLE = "update_available"
ATTR_CPU_PERCENT = "cpu_percent"
ATTR_MEMORY_PERCENT = "memory_percent"
Add hassio addon_update service and hassio config entry with addon and OS devices and entities (#46342) * add addon_update service, use config flow to set up config entry, create disabled sensors * move most of entity logic to common entity class, improve device info, get rid of config_flow user step * fix setup logic * additional refactor * fix refactored logic * fix config flow tests * add test for addon_update service and get_addons_info * add entry setup and unload test and fix update coordinator * handle if entry setup calls unload * return nothing for coordinator if entry is being reloaded because coordinator will get recreated anyway * remove entry when HA instance is no longer hassio and add corresponding test * handle adding and removing device registry entries * better config entry reload logic * fix comment * bugfix * fix flake error * switch pass to return * use repository attribute for model and fallback to url * use custom 'system' source since hassio source is misleading * Update homeassistant/components/hassio/entity.py Co-authored-by: Franck Nijhof <frenck@frenck.nl> * update remove addons function name * Update homeassistant/components/hassio/__init__.py Co-authored-by: Franck Nijhof <frenck@frenck.nl> * fix import * pop coordinator after unload * additional fixes * always pass in sensor name when creating entity * prefix one more function with async and fix tests * use supervisor info for addons since list is already filtered on what's installed * remove unused service * update sensor names * remove added handler function * use walrus * add OS device and sensors * fix * re-add addon_update service schema * add more test coverage and exclude entities from tests * check if instance is using hass OS in order to create OS entities Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2021-03-01 08:41:04 +00:00
ATTR_SLUG = "slug"
ATTR_STATE = "state"
ATTR_STARTED = "started"
Add hassio addon_update service and hassio config entry with addon and OS devices and entities (#46342) * add addon_update service, use config flow to set up config entry, create disabled sensors * move most of entity logic to common entity class, improve device info, get rid of config_flow user step * fix setup logic * additional refactor * fix refactored logic * fix config flow tests * add test for addon_update service and get_addons_info * add entry setup and unload test and fix update coordinator * handle if entry setup calls unload * return nothing for coordinator if entry is being reloaded because coordinator will get recreated anyway * remove entry when HA instance is no longer hassio and add corresponding test * handle adding and removing device registry entries * better config entry reload logic * fix comment * bugfix * fix flake error * switch pass to return * use repository attribute for model and fallback to url * use custom 'system' source since hassio source is misleading * Update homeassistant/components/hassio/entity.py Co-authored-by: Franck Nijhof <frenck@frenck.nl> * update remove addons function name * Update homeassistant/components/hassio/__init__.py Co-authored-by: Franck Nijhof <frenck@frenck.nl> * fix import * pop coordinator after unload * additional fixes * always pass in sensor name when creating entity * prefix one more function with async and fix tests * use supervisor info for addons since list is already filtered on what's installed * remove unused service * update sensor names * remove added handler function * use walrus * add OS device and sensors * fix * re-add addon_update service schema * add more test coverage and exclude entities from tests * check if instance is using hass OS in order to create OS entities Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2021-03-01 08:41:04 +00:00
ATTR_URL = "url"
ATTR_REPOSITORY = "repository"
DATA_KEY_ADDONS = "addons"
DATA_KEY_OS = "os"
class SupervisorEntityModel(str, Enum):
"""Supervisor entity model."""
ADDON = "Home Assistant Add-on"
OS = "Home Assistant Operating System"