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

Read/write exposed enums are now discovered as MQTT Select entities #7980

Merged
merged 5 commits into from
Jul 9, 2021

Conversation

ruifung
Copy link
Contributor

@ruifung ruifung commented Jul 8, 2021

In Home Assistant 2021.7, a new type of entity (select) was added and can now be configured via MQTT Discovery.

This change makes enums exposed with STATE and SET to be discovered as select entities in home assistant in addition to a sensor (that is a disabled entity by default).

Requires at least home assistant 2021.7 for select entities to work.

@Koenkk
Copy link
Owner

Koenkk commented Jul 8, 2021

Looks good, I will merge this after the next z2m release in dev (1 August), then it will be included in the 1 September release. This gives people some time to update HA.

@ruifung
Copy link
Contributor Author

ruifung commented Jul 8, 2021

That, and this is likely to be breaking for people that have setups that depend on reading the state of some enum property via a sensor (does Z2M clean up old discovery messages...?)

@Koenkk
Copy link
Owner

Koenkk commented Jul 8, 2021

Good point, it will indeed.

Might be better to return both configs for now, can you modify this function to return an array instead of one discoveryEntry?

…ing sensor, for compatibility.

Also, the sensor will be disabled by default for new entities, shouldn't effect existing installations.
@ruifung ruifung changed the base branch from master to dev July 8, 2021 23:43
@ruifung
Copy link
Contributor Author

ruifung commented Jul 8, 2021

With this change, I don't think you need to wait until september for people to update as the old sensor behavior has been restored, albeit with the enabled_by_default flag set to false to disable new sensor entities by default if select entities are present.

Use cases:

  1. Those who have existing sensor entities will still have them, enabled_by_default doesn't affect existing entities.
  2. Those who haven't updated, should just get a warning in the HASS log about an unsupported integration 'select', everything else just works as usual.
  3. Those who are adding new devices will get disabled sensor entities (and can enable them in HASS if wanted.)

@Koenkk Koenkk merged commit 9edbe5a into Koenkk:dev Jul 9, 2021
@Koenkk
Copy link
Owner

Koenkk commented Jul 9, 2021

Yes you are right, thanks!

@ruifung ruifung deleted the hass-2021.7-select branch July 9, 2021 22:53
@frenck
Copy link
Contributor

frenck commented Jul 19, 2021

Running this one dev, one comment I have:

image

These entities are not really "common". As in, they can be useful, but probably most people won't use them in their automation or dashboards in general. Therefore, it is recommended to send a disabled by default in Home Assistant. This allows a user to enable them when needed, but not overwhelm the user with entities they do not need or pollute the database unneeded.

Can we adjust this for this feature before release it to the public?

@frenck
Copy link
Contributor

frenck commented Jul 19, 2021

Additionally, opened issue #8078, as this PR is generating warnings as it sends in unexpected/invalid values.

@frenck
Copy link
Contributor

frenck commented Jul 20, 2021

Extracted my above listed comment/report into its own issue here: #8083

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants