-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix entity category of Home Assistant exposed enum sensors #19474
Conversation
My errors all have |
Right, I see. Thanks, I'll test as soon as it's in dev |
lib/extension/homeassistant.ts
Outdated
|
||
// If it has an entity category of config, but exposed as sensor, then change | ||
// it to diagnostic. Sensors have no input, so can't be configured. | ||
if (discoveryEntry.discovery_payload.entity_category === 'config') { |
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.
@frenck if I understand correctly the logic is: only if type
== sensor
and entity_category
== config
, then entity_category
should be set to diagnostic
. If true, then I propose to remove this and the other similar if and instead change the end of the function to:
discoveryEntries.forEach((d) => {
// If a sensor has entity category `config`, then change
// it to `diagnostic`. Sensors have no input, so can't be configured.
// https://github.com/Koenkk/zigbee2mqtt/pull/19474
if (d.type === 'sensor' && d.discovery_payload.entity_category === 'config') {
d.discovery_payload.entity_category === 'diagnostic';
}
});
return discoveryEntries;
In this way, any future added sensors to other types are also covered.
Adjusted as suggested 👍 |
Thanks as always 😄 |
// If a sensor has entity category `config`, then change | ||
// it to `diagnostic`. Sensors have no input, so can't be configured. | ||
// https://github.com/Koenkk/zigbee2mqtt/pull/19474 | ||
if (d.type === 'sensor' && d.discovery_payload.entity_category === 'config') { |
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.
This seem to have missed binary sensors, which now also are validated.
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.
Pushed a fix!
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.
This seem to have missed binary sensors, which now also are validated.
This statement is not correct. This has not been implemented for binary sensors (but likely would in the future).
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.
It was implemented for mqtt integration.
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.
Huh? Why would we implement such rules on an integration level? That makes no sense...
Will investigate that one.
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.
Ok, so this sneaked in for 2023.11.1 unintentionally, specifically on MQTT.
We are going to revert that part and ship Home Assistant 2023.11.2.
The change by Koen is still good, as that is expected behavior for 2023.12 (which got merged today as well).
../Frenck
Similar #19434, but in this case, for the enums that are exposed as sensors.
Related to #19430