homebridge-z2m: [Bug] Excluding keys by default doesn't work

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Tried to exclude a few properties/keys by default (occupied_cooling_setpoint to be specific) so I don’t have to manually add a new configuration entry for every single thermostat discovered via MQTT to actually make them appear in Home.

Unfortunately, it seems like this doesn’t work as expected, and excluded keys are still present on the newly discovered accessories. However, excluding keys on a per-device basis works fine.

Related devices

No response

Related Devices

No response

Steps To Reproduce

No response

Expected behavior

No response

Device entry

No response

Status update

No response

Messages from this plugin

No response

This plugin

1.11.0-beta.5

Homebridge

1.7.0

Zigbee2MQTT

1.37.1-dev

Homebridge Config UI X (if applicable)

4.56.2

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (13 by maintainers)

Most upvoted comments

I have no solution found 😦

@mpuff solution is: enable keys restart plugin wait some minutes disable keys restart plugin

I tried today exclude by default device_temperature, but the temperature from all motion and door sensors are still shown, also did delete the cache for all devices in homebridge.

"defaults": {
    "exclude": false,
    "excluded_keys": [
        "device_temperature"
    ]

Had quick look. The code that filters the exposes based on this setting is here: https://github.com/itavero/homebridge-z2m/blob/31b0fd9c4624bfd84e3e6e5bc62f6ee2f27baf3e/src/platformAccessory.ts#L401-L410

Current code uses sanitizeAndFilterExposesEntries. As far as I can tell that also filters all the features, but perhaps you can spot a mistake. https://github.com/itavero/homebridge-z2m/blob/31b0fd9c4624bfd84e3e6e5bc62f6ee2f27baf3e/src/helpers.ts#L82-L117