-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Simplify MQTT device triggers in automations #108309
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
Conversation
Hey there @emontnemery, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
600074e
to
c637380
Compare
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jbouwh 👍
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Proposed change
When MQTT device triggers are used in an automation the
discovery_id
is no longer needed to identify an MQTT device trigger. Instead of thediscovery_id
identifier, that is based based on the config topic, now thedevice_id
,type
andsubtype
are used together as unique identifier. If thediscovery_id
is found in the MQTT device trigger automation config, then thediscovery_id
still will be used to identify the trigger instead, and the automation will keep working, even when the trigger has updatedtype
orsubtype
, because existing triggers then will still be referenced bydiscovery_id
.For new automation's an MQTT device trigger, set up from the UR will not have
discovery_id
added any more, as the use of this parameter is deprecated now. A consequence of that is that device triggers cannot updatetype
andsubtype
anymore without breaking the automation, which is no longer linked to thediscovery_id
.No deprecation warnings for the use of
discovery_id
are being given at this time, and users will only see the difference in YAML, not in the UI.Documentation
As this functionality is handled in the UI there is no specific documentation on how to add the MQTT trigger to a device automation in YAML. The change is not breaking because the documentation already has the following remark:
Background
The reason to change this because it makes it possible to create a blueprint based on the
device_id
,type
andsubtype
without the need to add adiscovery_id
.This PR is an alternative approach for PR #107830.
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: