Skeleton of Discovery Implementation #381
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed change
This is a functioning basic implementation of the Discovery feature. It lacks lots of documentation, and is only implemented on Dimmers. The idea is this:
discovery_topic_base
anddiscovery_ha_status
device_info_template
that allows the user to define a device template that can be reused as a variable in the discovery templates. @schirner had implemented something like this, and I agree this is very handy. This is likely to be reused in every template.mqtt
key in the config.yaml file for the discovery templates. So dimmers look tomqtt->dimmer
by default.discovery_entities
key is defined. This key must have acomponent
subkey andconfig
key. Theconfig
key must include at minimum aunique_id
. Other HomeAssistant config settings also need to be defined.name, address, name_user_case, engine, model, firmware, modem_addr, device_info_template
. Additionally all topics defined in yaml are also available.Customization
As referenced in the
min_hops
addition, users can create new discovery classes that can be used on one or more devices. By specifyingdiscovery_class
as an config_extra key for the device. The value is a reference to a key under themqtt
section. This new subkey would then need to contain adiscovery_entities
key as defined above.Additional information
Checklist
Below is a sample of the published topic
homeassistant/light/4f.23.38/4f.23.38_light/config
using the config settings shown in the attached commits: