diff --git a/API.md b/API.md index b8d719a39..d6a6ba4d2 100644 --- a/API.md +++ b/API.md @@ -574,7 +574,7 @@ Write data to add-on stdin } ``` -### Service discovery +### discovery - GET `/discovery` ```json @@ -584,8 +584,6 @@ Write data to add-on stdin "addon": "slug", "service": "name", "uuid": "uuid", - "component": "component", - "platform": "null|platform", "config": {} } ] @@ -598,8 +596,6 @@ Write data to add-on stdin "addon": "slug", "service": "name", "uuid": "uuid", - "component": "component", - "platform": "null|platform", "config": {} } ``` @@ -608,8 +604,6 @@ Write data to add-on stdin ```json { "service": "name", - "component": "component", - "platform": "null|platform", "config": {} } ``` @@ -623,6 +617,8 @@ return: - DEL `/discovery/{UUID}` +### Services + - GET `/services` ```json { diff --git a/hassio/api/discovery.py b/hassio/api/discovery.py index 0acf972a9..b3ff6f99e 100644 --- a/hassio/api/discovery.py +++ b/hassio/api/discovery.py @@ -3,8 +3,8 @@ import voluptuous as vol from .utils import api_process, api_validate from ..const import ( - ATTR_ADDON, ATTR_UUID, ATTR_COMPONENT, ATTR_PLATFORM, ATTR_CONFIG, - ATTR_DISCOVERY, ATTR_SERVICE, REQUEST_FROM) + ATTR_ADDON, ATTR_UUID, ATTR_CONFIG, ATTR_DISCOVERY, ATTR_SERVICE, + REQUEST_FROM) from ..coresys import CoreSysAttributes from ..exceptions import APIError, APIForbidden from ..validate import SERVICE_ALL @@ -12,8 +12,6 @@ from ..validate import SERVICE_ALL SCHEMA_DISCOVERY = vol.Schema({ vol.Required(ATTR_SERVICE): SERVICE_ALL, - vol.Required(ATTR_COMPONENT): vol.Coerce(str), - vol.Optional(ATTR_PLATFORM): vol.Maybe(vol.Coerce(str)), vol.Optional(ATTR_CONFIG): vol.Maybe(dict), }) @@ -44,8 +42,6 @@ class APIDiscovery(CoreSysAttributes): ATTR_ADDON: message.addon, ATTR_SERVICE: message.service, ATTR_UUID: message.uuid, - ATTR_COMPONENT: message.component, - ATTR_PLATFORM: message.platform, ATTR_CONFIG: message.config, }) @@ -78,8 +74,6 @@ class APIDiscovery(CoreSysAttributes): ATTR_ADDON: message.addon, ATTR_SERVICE: message.service, ATTR_UUID: message.uuid, - ATTR_COMPONENT: message.component, - ATTR_PLATFORM: message.platform, ATTR_CONFIG: message.config, } diff --git a/hassio/const.py b/hassio/const.py index 762e9c95e..a9733cf86 100644 --- a/hassio/const.py +++ b/hassio/const.py @@ -160,8 +160,6 @@ ATTR_HOST = 'host' ATTR_USERNAME = 'username' ATTR_PROTOCOL = 'protocol' ATTR_DISCOVERY = 'discovery' -ATTR_PLATFORM = 'platform' -ATTR_COMPONENT = 'component' ATTR_CONFIG = 'config' ATTR_SERVICES = 'services' ATTR_SERVICE = 'service' diff --git a/hassio/discovery.py b/hassio/discovery.py index e5db61fa9..65ad2bcbf 100644 --- a/hassio/discovery.py +++ b/hassio/discovery.py @@ -76,8 +76,8 @@ class Discovery(CoreSysAttributes, JsonConfig): _LOGGER.warning("Duplicate discovery message from %s", addon.slug) return old_message - _LOGGER.info("Send discovery to Home Assistant %s/%s from %s", - component, platform, addon.slug) + _LOGGER.info("Send discovery to Home Assistant %s from %s", + service, addon.slug) self.message_obj[message.uuid] = message self.save() @@ -89,8 +89,8 @@ class Discovery(CoreSysAttributes, JsonConfig): self.message_obj.pop(message.uuid, None) self.save() - _LOGGER.info("Delete discovery to Home Assistant %s/%s from %s", - message.component, message.platform, message.addon) + _LOGGER.info("Delete discovery to Home Assistant %s from %s", + message.service, message.addon) self.sys_create_task(self._push_discovery(message, CMD_DEL)) async def _push_discovery(self, message, command): @@ -115,9 +115,7 @@ class Discovery(CoreSysAttributes, JsonConfig): @attr.s class Message: """Represent a single Discovery message.""" + uuid = attr.ib(factory=lambda: uuid4().hex, cmp=False) addon = attr.ib() service = attr.ib() - component = attr.ib() - platform = attr.ib() config = attr.ib(cmp=False) - uuid = attr.ib(factory=lambda: uuid4().hex, cmp=False) diff --git a/hassio/validate.py b/hassio/validate.py index 6c3eaf39a..98858ad33 100644 --- a/hassio/validate.py +++ b/hassio/validate.py @@ -9,8 +9,7 @@ from .const import ( ATTR_ADDONS_CUSTOM_LIST, ATTR_PASSWORD, ATTR_HOMEASSISTANT, ATTR_HASSIO, ATTR_BOOT, ATTR_LAST_BOOT, ATTR_SSL, ATTR_PORT, ATTR_WATCHDOG, ATTR_CONFIG, ATTR_WAIT_BOOT, ATTR_UUID, ATTR_REFRESH_TOKEN, ATTR_HASSOS_CLI, - ATTR_ACCESS_TOKEN, ATTR_DISCOVERY, ATTR_ADDON, ATTR_COMPONENT, - ATTR_PLATFORM, ATTR_SERVICE, + ATTR_ACCESS_TOKEN, ATTR_DISCOVERY, ATTR_ADDON, ATTR_SERVICE, SERVICE_MQTT, CHANNEL_STABLE, CHANNEL_BETA, CHANNEL_DEV) from .utils.validate import schema_or, validate_timezone @@ -114,8 +113,6 @@ SCHEMA_DISCOVERY = vol.Schema([ vol.Required(ATTR_UUID): UUID_MATCH, vol.Required(ATTR_ADDON): vol.Coerce(str), vol.Required(ATTR_SERVICE): SERVICE_ALL, - vol.Required(ATTR_COMPONENT): vol.Coerce(str), - vol.Required(ATTR_PLATFORM): vol.Maybe(vol.Coerce(str)), vol.Required(ATTR_CONFIG): vol.Maybe(dict), }, extra=vol.REMOVE_EXTRA) ])