Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow MQTT device based auto discovery #118757

Open
wants to merge 21 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions homeassistant/components/mqtt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
DEFAULT_QOS,
DEFAULT_RETAIN,
DOMAIN,
ENTITY_PLATFORMS,
MQTT_CONNECTION_STATE,
RELOADABLE_PLATFORMS,
TEMPLATE_ERRORS,
)
from .models import ( # noqa: F401
Expand Down Expand Up @@ -438,7 +438,7 @@ async def _reload_config(call: ServiceCall) -> None:
for entity in list(mqtt_platform.entities.values())
if getattr(entity, "_discovery_data", None) is None
and mqtt_platform.config_entry
and mqtt_platform.domain in RELOADABLE_PLATFORMS
and mqtt_platform.domain in ENTITY_PLATFORMS
]
await asyncio.gather(*tasks)

Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/mqtt/abbreviations.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"cmd_on_tpl": "command_on_template",
"cmd_t": "command_topic",
"cmd_tpl": "command_template",
"cmp": "components",
"cod_arm_req": "code_arm_required",
"cod_dis_req": "code_disarm_required",
"cod_form": "code_format",
Expand Down Expand Up @@ -92,6 +93,7 @@
"min_mirs": "min_mireds",
"max_temp": "max_temp",
"min_temp": "min_temp",
"migr_discvry": "migrate_discovery",
"mode": "mode",
"mode_cmd_tpl": "mode_command_template",
"mode_cmd_t": "mode_command_topic",
Expand Down
8 changes: 5 additions & 3 deletions homeassistant/components/mqtt/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
CONF_CERTIFICATE = "certificate"
CONF_CLIENT_KEY = "client_key"
CONF_CLIENT_CERT = "client_cert"
CONF_COMPONENTS = "components"
CONF_TLS_INSECURE = "tls_insecure"

# Device and integration info options
Expand Down Expand Up @@ -158,7 +159,7 @@
PAYLOAD_EMPTY_JSON = "{}"
PAYLOAD_NONE = "None"

RELOADABLE_PLATFORMS = [
ENTITY_PLATFORMS = [
Platform.ALARM_CONTROL_PANEL,
Platform.BINARY_SENSOR,
Platform.BUTTON,
Expand Down Expand Up @@ -189,7 +190,8 @@

TEMPLATE_ERRORS = (jinja2.TemplateError, TemplateError, TypeError, ValueError)

SUPPORTED_COMPONENTS = {

SUPPORTED_COMPONENTS = (
"alarm_control_panel",
"binary_sensor",
"button",
Expand Down Expand Up @@ -218,4 +220,4 @@
"vacuum",
"valve",
"water_heater",
}
)
Loading
Loading