Z2m: entities disabled by integration. Is it possible to enable them via a glob?


I have a few tuya smart plugs which reports current,voltage,power. I have added them through zigbee2mqtt. I notice that a few entities are marked as “disabled by: integration” . If I enable visibility in the diagnostics or enable the entities via the UI, it works as expected.

I would like to know if its possible to create a config snippet that enables them automatically (or understand why the integration is disabling them). My point is I have 15 of them and would prefer to understand the cause than to just remind myself to enable those everytime I join another one to the network.

From the .storage/core.entity_registry, here is one example of said entity:

        "aliases": [],
        "area_id": null,
        "capabilities": {
          "state_class": "measurement"
        "config_entry_id": "7dd244093bf83ebb11cf11f82febb1e3",
        "device_class": null,
        "device_id": "d7cd62cbd944f7041b4a5a1390f8e11a",
        "disabled_by": "integration",
        "entity_category": "diagnostic",
        "entity_id": "sensor.0xa4c13868a0240e86_current",
        "hidden_by": null,
        "icon": null,
        "id": "aaeb42ccb780996df8f17cfdba194262",
        "has_entity_name": false,
        "name": null,
        "options": {},
        "original_device_class": "current",
        "original_icon": null,
        "original_name": "0xa4c13868a0240e86 current",
        "platform": "mqtt",
        "supported_features": 0,
        "translation_key": null,
        "unique_id": "0xa4c13868a0240e86_current_zigbee2mqtt",
        "unit_of_measurement": "A"

And here is the “state” from zigbee2mqtt:

    "child_lock": "UNLOCK",
    "current": 0,
    "energy": 0.2,
    "indicator_mode": "off/on",
    "last_seen": "2023-03-15T14:56:03.449Z",
    "linkquality": 48,
    "power": 0,
    "power_outage_memory": "off",
    "state": "ON",
    "voltage": 231,
    "update": {
        "installed_version": -1,
        "latest_version": -1,
        "state": null
    "update_available": null

I’m running home assistant core (container). I’m quite new to it and have been checking some of its internals to understand why is it getting disabled by the integration or if there are additional attributes I can set (via a glob in home assistant or in z2m) to have them enabled by default.

I did check https://github.com/home-assistant/core/blob/4d3799a9de1116de8ac202ef970dcbcdba330a97/homeassistant/components/mqtt/sensor.py but maybe because i’m new to how the code works, I couldn’t spot what I’m missing.


So … after digging for a big while … I’ve figured out why I didn’t find what was setting "entity_category": "diagnostic" and neither what was disabling it in the integration … because the integration was fine.
A tip to anyone looking into this, get something like ‘MQTT Explorer’, lens… etc… whatever flies.
My understanding improved. So Z2M is the one that makes the homeassistant topic, and in the sensors, the topics for current/power/voltage in question were published with the attribute enabled_by_default set to false.
Changing Z2M configuration.yaml including:

      enabled_by_default: true
      enabled_by_default: true
      enabled_by_default: true

Solved my issue…

1 Like

Thank you so much, I’ve been struggling with that one for some time. I saw that indeed the fault was on Z2M but was still looking for the solution. Well done!