fix: Fix Home Assistant Entity category config is invalid for sensors warning https://github.com/Koenkk/zigbee2mqtt/issues/20252

This commit is contained in:
koenkk
2023-12-17 14:24:12 +01:00
parent e0f50218d7
commit 8f62a0a618
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -856,6 +856,12 @@ export default class HomeAssistant extends Extension {
delete discoveryEntry.discovery_payload.device_class;
}
// entity_category config is not allowed for sensors
// https://github.com/Koenkk/zigbee2mqtt/issues/20252
if (discoveryEntry.discovery_payload.entity_category === 'config') {
delete discoveryEntry.discovery_payload.entity_category;
}
// Let Home Assistant generate entity name when device_class is present
if (discoveryEntry.discovery_payload.device_class) delete discoveryEntry.discovery_payload.name;
+1 -1
View File
@@ -1407,7 +1407,7 @@ describe('Publish', () => {
expect(MQTT.publish.mock.calls[3]).toEqual([ 'zigbee2mqtt/bulb_color', stringify({"state":"ON","brightness":150}), { qos: 0, retain: false }, expect.any(Function)]);
});
it('onlythis Scenes', async () => {
it('Scenes', async () => {
const bulb_color_2 = zigbeeHerdsman.devices.bulb_color_2.getEndpoint(1);
const bulb_2 = zigbeeHerdsman.devices.bulb_2.getEndpoint(1);
const group = zigbeeHerdsman.groups.group_tradfri_remote;