Jan Bouwhuis 61114d8328
Install and start Mosquitto MQTT broker add on from MQTT config flow (#124106)
* Opt in to install Mosquitto broker add-on in MQTT config flow

* rephrase

* Tests with supervisor and running add-on

* Complete tests for success flows

* Also set up entry in success flow

* Use realistic names for addon and broker

* Finetuning and fail test cases

* Spelling

* Improve translation strings

* Update addon docstr

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Raise AddonError if add-on does not start

* Only show the option to use the add-on

* Simplify flow, rework and cleanup

* Revert unrelated cleanup, process suggestion

* Move ADDON_SLUG const to addon module

* Move fixture to component level

* Move back supervisor fixture

* Move addon_setup_time_fixture and superfixe to config flow model tests

* Refactor hassio fixture

* Rename helpers as they are no fixtures, remove fixture from their names

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-08-22 09:07:45 +02:00

23 lines
623 B
Python

"""Provide MQTT add-on management.
Currently only supports the official mosquitto add-on.
"""
from __future__ import annotations
from homeassistant.components.hassio import AddonManager
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.singleton import singleton
from .const import DOMAIN, LOGGER
ADDON_SLUG = "core_mosquitto"
DATA_ADDON_MANAGER = f"{DOMAIN}_addon_manager"
@singleton(DATA_ADDON_MANAGER)
@callback
def get_addon_manager(hass: HomeAssistant) -> AddonManager:
"""Get the add-on manager."""
return AddonManager(hass, LOGGER, "Mosquitto Mqtt Broker", ADDON_SLUG)