Z2m switch isn't recognized

Hi all,

I searched and found some problems that look the same, but not entirely so sorry if I missed a right answer that already is giving.

Was running ZHA first and had the sonoff 01minizb running without problems.

Just changed to z2m and paired it again. It works in z2m and I can control it. Back in HA is sees the device, only the only entity it shows in mqtt is linkquality. I have some other zigbee devices that work flawless.

How can I add the switch to HA?

Thanks!

Should work
afbeelding

Strange enough, you are not the first one asking the last few weeks.

Maybe it has to do with

            "legacy_api": true

Can you help maybe?

Nederlands ook…

It works if in z2m but no switch visable in HA…

I don’t know how to add the switch function.

In z2m:

I do make these modifications in Zigbee2MQTT’s configuration.yaml for the zbmini’s:

  '0x0c4314fffeb51643':
    friendly_name: slaapkamer
    homeassistant:
      switch:
        type: light
        object_id: light
      light:
        name: licht_slaapkamer
        value_template: null
        state_value_template: '{{ value_json.state }}'
  '0x00124b0024c09cdd':
    friendly_name: lichtbovengang
    homeassistant:
      switch:
        type: light
        object_id: light
      light:
        name: lichtbovengang
        value_template: null
        state_value_template: '{{ value_json.state }}'

Maybe this helps.
Restart of Z2M required after making the modifications !

I have a similar problem since the latest HA update. Also all my old switches are not available anymore. This affects all my divices (Aqara and Zonoff).
I assume it has something to do with the MQTT naming changes from August?

Do you have the latest version of Zigbee2MQTT and HA ?

Yes as far as I can see they are both up to date. Z2M is on 1.33.0-1 and HA on 2023.10.5…

Latest is 2023.9.1 ??

Oh man, what a brain fart on my part… I was looking at the OS, I acctually didn’t update to the new cor yet, doing I right now and hope that solves the problem.

I have both the os and core update. I have tried to add your lines in yaml but it gave some errors.

This is the yaml file for z2m now;

homeassistant: true

advanced:

  network_key:

    - 196

    - 164

    - 108

    - 112

    - 55

    - 50

    - 254

    - 60

    - 36

    - 239

    - 33

    - 41

    - 235

    - 230

    - 214

    - 183

  pan_id: 45280

  ext_pan_id:

    - 22


    - 26

    - 72

    - 92

    - 205

    - 120

    - 82

    - 216

  homeassistant_legacy_entity_attributes: false

  legacy_api: false

  legacy_availability_payload: false

mqtt:

  server: mqtt://core-mosquitto:1883

  user: #####

  password: ##########

frontend:

  port: 8099

serial:

  port: >-

    /dev/serial/by-id/usb-Silicon_Labs_Sonoff_Zigbee_3.0_USB_Dongle_Plus_0001-if00-port0

device_options:

  legacy: false

devices:

  '0xa4c13874fdec4810':

    friendly_name: Sensor1

    description: sensor 1

  '0xe0798dfffea7bafe':

    friendly_name: Slaapkamer ouders

    description: Licht slaapkamer ouders

    state_action: true

    homeassistant:

        switch:

        type: light

        object_id: light

    legacy: true

    optimistic: true

If you are using the add-on (I don’t) it is not in configuration.yaml but I think devices.yaml (or device.yaml, I’m not sure)