diff --git a/docs/hassio_addon_communication.md b/docs/hassio_addon_communication.md index a6af02ea..b6c75a64 100644 --- a/docs/hassio_addon_communication.md +++ b/docs/hassio_addon_communication.md @@ -40,7 +40,27 @@ Add-ons can call some API commands without needing to set `hassio_api: true`: ***Note:*** For Home Assistant API access requirements, see above. +## Services API + +We have an internal services API to make services public to other add-ons without the user need to add additional configuration. An add-on can get the full configuration for a service to use and to connect to. The add-on need to mark the usage of a service over his [configuration](hassio_addon_config.md) in order to be able to access a service. All supported services, including its available options, are documented in the [API documentation][supervisor-services-api]. + +Supported services are: + +- mqtt +- mysql + +You can use Bashio to get this information for your add-on init as: `bashio::services ` + +For example: + +```bash +MQTT_HOST=$(bashio::services mqtt "host") +MQTT_USER=$(bashio::services mqtt "username") +MQTT_PASSWORD=$(bashio::services mqtt "password") +``` + [core-api]: https://www.home-assistant.io/developers/rest_api/ [core-websocket]: https://www.home-assistant.io/developers/websocket_api/ [supervisor-api]: https://github.com/home-assistant/supervisor/blob/master/API.md [supervisor-addon-api]: https://github.com/home-assistant/supervisor/blob/dev/API.md#restful-for-api-addons +[supervisor-services-api]:https://github.com/home-assistant/supervisor/blob/dev/API.md#services-1