zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

homeassistant.ts: How to add entity to config section in HA?

Open AlexKay88 opened this issue 4 years ago • 1 comments

What happened?

I would like to change an entity to appear in config section of device in HA, but it doesnt work. It is a sensor and a select entity select.wohnz_saeule_control_mode sensor.wohnz_saeule_control_mode same as already existing switch_type. For switch_type it works fine as you can see on screenshot. So I went to https://github.com/Koenkk/zigbee2mqtt/blob/3f6a13786e67445840521cf8f41b030221a24dee/lib/extension/homeassistant.ts#L759 and copied line https://github.com/Koenkk/zigbee2mqtt/blob/3f6a13786e67445840521cf8f41b030221a24dee/lib/extension/homeassistant.ts#L783 to control_mode: {entity_category: 'config', icon: 'mdi:tune'}, After that

  • restarted zigbee2mqtt --> didn't help
  • renamed device in zigbee2mqtt --> didn't help
  • re-paired device --> didn't help

debug log messages Clearing Home Assistant config and Refreshing Home Assistant discovery topic for this device appeared, thus I assume topic (...)/config should have changed, but MQTT topic homeassistant/sensor/0x14b457fffe0e490b/control_mode/config and also homeassistant/select/(...) stays the same:

{
  "availability": [
    {
      "topic": "zigbee2mqtt/bridge/state"
    },
    {
      "topic": "zigbee2mqtt/Wohnz_Saeule/availability"
    }
  ],
  "availability_mode": "all",
  "device": {
    "identifiers": [
      "zigbee2mqtt_0x14b457fffe0e490b"
    ],
    "manufacturer": "Fantem",
    "model": "Smart dimmer module without neutral (ZB006-X)",
    "name": "Wohnz_Saeule"
  },
  "enabled_by_default": false,
  "json_attributes_topic": "zigbee2mqtt/Wohnz_Saeule",
  "name": "Wohnz_Saeule_control_mode",
  "state_topic": "zigbee2mqtt/Wohnz_Saeule",
  "unique_id": "0x14b457fffe0e490b_control_mode_zigbee2mqtt",
  "value_template": "{{ value_json.control_mode }}"
}

I would expect this to appear in MQTT topic:

  "entity_category": "config",
  "icon": "mdi:tune",

What went wrong or what am I missing to do?

Screenshot: image

What did you expect to happen?

No response

How to reproduce it (minimal and precise)

No response

Zigbee2MQTT version

1.25.0-dev

Adapter firmware version

26720700

Adapter

ConBee2

Debug log

No response

AlexKay88 avatar May 02 '22 10:05 AlexKay88

I have been the problem myself ;-) Mixed up local files homeassistant.js and homeassistant.ts

AlexKay88 avatar May 02 '22 14:05 AlexKay88