Help - Xiaomi Switch doesn't show up as light/plug (only as sensor) = uncontrollable via API, lost control of multiple switches operating 1 light

Hi all,
First of all thanks for all the great work in the past years!
I have recently migrated from Connbee 2 to Connbee 3 and upgraded from 2.23 to 2.28. My problems have started here: I had to re-connect every single sensor/switch - ok.

Unfortunately however, some of the Xiaomi wall switches (rocker: lumi.ctrl_ln1.aq1, lumi.ctrl_ln2.aq1) which worked perfectly fine with Connbee 2/2.23 don’t show up anymore neither as Lights nor as Plugs. When pairing them most of them show up as sensors with a button state which precludes me from adding them to Light Groups to start with.

Since many of the switches were formerly cross-linked to control the same light, I wrote a bash script essentially retrieving the status of every switch every second and syncronizing the others through a curl PUT to the state of the /light - i.e. if the same light was turned on with switch 4 then when switch 2 was turned ON, it turned the light off (these are all rocker switches).

Since the light doesn’t exist anymore I lost control over my house’s lights.
I guess it’d be an option to go back to 2.23 and Connbee 2 in the worst case but I hope there’s another solution.

I can only add these Xiaomi 1-way wall switches now as “Add Switch” - when I try “Add Lights” or “Add Plugs” they don’t get recognized.

It now shows up as /sensor/416

    "416": {
        "config": {
            "on": true,
            "reachable": true,
            "temperature": 2500
        },
        "ep": 5,
        "etag": "306df8b4c13b4c59d105d0804eb51360",
        "lastannounced": "2025-03-26T08:51:35Z",
        "lastseen": "2025-03-26T08:51Z",
        "manufacturername": "LUMI",
        "mode": 1,
        "modelid": "lumi.ctrl_ln1.aq1",
        "name": "GFKitchenLiv",
        "state": {
            "buttonevent": 1002,
            "lastupdated": "2025-03-26T08:51:36.882"
        },
        "type": "ZHASwitch",
        "uniqueid": "00:15:8d:00:04:26:52:f4-05-0012"
    },

instead of the same way as some others of the same type (from previous config, also re-added but they somehow stayed on)

as /lights/37/

    "37": {
        "capabilities": {
            "alerts": [
                "none",
                "select",
                "lselect"
            ]
        },
        "config": {
            "groups": [
                "5",
                "0",
                "0",
                "15",
                "21"
            ]
        },
        "etag": "afa9e46b14e1f24070e8bdfd359923a1",
        "hascolor": false,
        "lastannounced": "2023-06-05T19:53:06Z",
        "lastseen": "2024-09-01T21:11Z",
        "manufacturername": "LUMI",
        "modelid": "lumi.ctrl_ln1.aq1",
        "name": "LivingLEDFront",
        "state": {
            "alert": "none",
            "on": true,
            "reachable": true
        },
        "swversion": "06-25-2018",
        "type": "Smart plug",
        "uniqueid": "00:15:8d:00:04:0e:47:2d-01"
    },

If I curl PUT/POST a buttonevent to the sensor, nothing happens - I’d like to be able to 1) Assign it as a light; 2) Control it via curl or any other means

Thanks in advance!

Hello, you are sure the device is not present in “light” section ? You need to have 1 entry in “sensor” and 1 in “light”.
From my memory this device is an enddevice ( lumi.ctrl_ln1.aq1) , not a router, and don’t have DDF, so a code regression is possible, but strange you are alone with this issue.

I have recently migrated from Connbee 2 to Connbee 3 and upgraded from 2.23 to 2.28. My problems have started here: I had to re-connect every single sensor/switch - ok.

You haven’t make a backup ? The migration is made to be invisible.

If we need to make a DDF, you haven’t a working model id similar to this one ? (to mimic the DDF if the device have one)
Else I think we can use this one deconz-rest-plugin/devices/xiaomi/xiaomi_ws-euk01_h1_switch.json at master · dresden-elektronik/deconz-rest-plugin · GitHub

Hi,

Thanks a lot for the response!
I went through the /lights items one by one, and I can confirm that there’s nothing there from these few switches :frowning: I only have the sensor entries.

I had a backup, also reloaded the backup, but still they don’t show up. I went back to an older backup as well (I automatically make one every night), but it’s the same thing - like they never existed.
Indeed, the Xiaomi Lumi switch is an enddevice to my knowledge too.

Is there no way to “manually” add the device to the /lights part?

As above, there’re other ones which are recognized/works perfectly with the same model id (lumi.ctrl_ln1.aq1) under /lights

/sensors entry

   "195": {
        "capabilities": {
            "sleeper": false
        },
        "config": {
            "group": "30188",
            "on": true,
            "reachable": true,
            "temperature": 2300
        },
        "ddf_hash": null,
        "ddf_policy": "latest_prefer_stable",
        "ep": 5,
        "etag": "319d8700349598341f2f8c6f296e7763",
        "lastannounced": "2025-03-21T17:34:57Z",
        "lastseen": "2025-03-27T08:07Z",
        "manufacturername": "LUMI",
        "mode": 1,
        "modelid": "lumi.ctrl_ln1.aq1",
        "name": "GFLivingLEDF",
        "nwkaddress": 33797,
        "state": {
            "buttonevent": 1002,
            "lastupdated": "2025-03-21T17:34:32.569"
        },
        "swversion": "6.1.0.18912",
        "type": "ZHASwitch",
        "uniqueid": "00:15:8d:00:04:0e:47:2d-05-0012"
    },

/lights entry on the same

    "37": {
        "capabilities": {
            "alerts": [
                "none",
                "select",
                "lselect"
            ],
            "sleeper": false
        },
        "config": {
            "groups": [
                "5",
                "0",
                "0",
                "15",
                "21",
                "34"
            ]
        },
        "ddf_hash": null,
        "ddf_policy": "latest_prefer_stable",
        "etag": "06c61e30de983c7eb73a586448b7a921",
        "hascolor": false,
        "lastannounced": "2025-03-21T17:34:57Z",
        "lastseen": "2025-03-27T07:56Z",
        "manufacturername": "LUMI",
        "modelid": "lumi.ctrl_ln1.aq1",
        "name": "LivingLEDFront",
        "nwkaddress": 33797,
        "state": {
            "alert": "none",
            "on": false,
            "reachable": true
        },
        "swversion": "06-25-2018",
        "type": "Smart plug",
        "uniqueid": "00:15:8d:00:04:0e:47:2d-01"
    },

What I can think of is that some of my switches came 1-2 months apart from each other and might be another batch(?). Some were with neutral, others were without the neutral that’s for sure but I don’t know which is which - it wasn’t a problem until now.
If it helps, I can remove them from the wall and have a closer look. Can this make a difference?

So you have the same device working and not working ?
Have you tried to re-include the not working device, without deleting it first, then after deleting it ?

If yes do you know what is DDF and how it work ? What is your OS ?

This DDF will force a ZHAswitch and a light device (1 gang)

{
  "schema": "devcap1.schema.json",
  "manufacturername": "$MF_LUMI",
  "modelid": "lumi.ctrl_ln1.aq1",
  "vendor": "Xiaomi Aqara",
  "product": "QBKG11LM",
  "sleeper": false,
  "status": "Gold",
  "subdevices": [
    {
      "type": "$TYPE_ON_OFF_LIGHT",
      "restapi": "/lights",
      "uuid": [
        "$address.ext",
        "0x01"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "state/alert"
        },
        {
          "name": "state/on",
          "refresh.interval": 300
        },
        {
          "name": "state/reachable"
        }
      ]
    },
    {
      "type": "$TYPE_SWITCH",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x05",
        "0x0012"
      ],
      "fingerprint": {
        "profile": "0x0104",
        "device": "0x0100",
        "endpoint": "0x05",
        "in": [
          "0x0012"
        ]
      },
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/buttonevent"
        },
        {
          "name": "state/lastupdated"
        }
      ]
    }
  ]
}

Hi,

Yes I tried adding them again with/without removing first.
I just add them as Switch - Xiaomi - Wall transmitter 1-channel.

The text on the back side of the switch is QBKG11LM (with neutral). There have been some discussions about it previously:

As opposed to the post I have a good temperature reading (ballpark), but I don’t care about that, I want the switch to show up as a light/plug…

I’m running Bullseye on a RPI3 with a Connbee III.

This is what I tried already with and without removing (rebooted RPI after searching for Lights and Plugs as I read about a bug that there’re no sensor updates afterwards in some cases):

  1. Tried searching for Lights and holding the wall switch button down when the light is on (standard way to pair the Xiaomi switches) for about 10-15 seconds, then let go of the button → light goes off - and normally pairs. No lights were found.
  2. Tried searching for plugs, the same way, no plugs were found.
  3. Tried searching for switches, but since it’s already paired it doesn’t pick it up

Sorry for the stupid question, but what do I need to do with the code you inserted? I copy-pasted it into a file with .ddf extension but the import fails when I try.

Thanks!

For the “pairing” procedure, you need to press it until the blue light starts blinking and stops blinking (around 10s), so I think it’s same.
On “deconz rules” it’s definitively a “light”.

I copy-pasted it into a file with .ddf extension but the import fails when I try.

You have a real OS, so it will be fine ^^.
copy-paste the contain on a file called what_you_want.json (not ddf) and put in a “devices/xioami” folder.
For exemple this one deconz-rest-plugin/devices/xiaomi at master · dresden-elektronik/deconz-rest-plugin · GitHub
But other folder in the “devices” folder will be fine

All DDF provided directly with deCONZ typically reside in /usr/share/deCONZ/devices/ on a Linux system and are loaded first. However, files residing in the home directory of the user running deCONZ (e.g. /home/<DECONZUSER>/.local/share/dresden-elektronik/deCONZ/devices) will override the pre-packaged files to allow users to amend and keep their own files if desired.

Better to delete the device on deconz first, because the DDF will not use exactly the same stuff, for exemple it will be a “on-off light” and not a “smart plug” with it.
Then just restart deconz, the device will be handled by DDF core after that, can try to re-include it.

BTW the DDF will work only for the lumi.ctrl_ln1.aq1

Thanks - I renamed the file to json and copied it to the directory (it was empty btw) + restarted Deconz (service deconz restart). Previously I deleted the switch item for the Xiaomi switch.

I tried to re-pair it as:

  1. Switch Xiaomi/Wall transmitter 1-channel
  2. Switch Xiaomi/Other
  3. Lights
    While pressing the button 10+sec, releasing (light goes off, switch reboots as it doesn’t react to button presses - and normally following this pairing happens) - but no pairing happens at all anymore - not even as a sensor… Any ideas?

Wich one have you used ?
One of them need to have native file.

From this video, it NEED to blink https://www.youtube.com/watch?v=q9MD2JB-MD8

Have you acces to the GUI, to get logs during the pairing ? (with info and info_l2) ?

I just copy-pasted from your comment above and used that as a json. Blinking is ok, it worked before but it doesn’t pick it up now when I try to add it as a switch.

I run it on a headless RPI3, so by default I don’t see the logs.
I used this post How to get logs? to get logs while I tried to pair it:
17:13:55:359 /root/.local/share/dresden-elektronik/deCONZ/config.ini exists and - Pastebin.com

You have “open the network” ?
You don’t have 2 phoscon instance openened on browser ?
I dont see the permit join enabled and you have so much device blocked

17:15:02:229 CTRL skip creating node 0x00158D0002E29A7C while permit join is disabled
17:15:02:542 CTRL skip creating node 0x00158D00044E3262 while permit join is disabled
17:15:03:022 CTRL skip creating node 0x00158D0002E28A3A while permit join is disabled
17:15:03:983 CTRL skip creating node 0x54EF4410003B297B while permit join is disabled
17:15:04:462 CTRL skip creating node 0x00158D00036D201C while permit join is disabled

Your device is a “light”.

And which one folder you have choose to put the DDF ? there is 2 possibles.

Make a try on another machine.
For information, zigbee network setting are stored on the Gateway, but devices setting are stored on the host.
So if you migrate only the conbee, without backup/restore, it will work but you will see strange thing happening (devices will be in the network but not in the API), don’t worry with them.

Edit:

17:14:09:411 APS-DATA.indication from unknown node 0xA7EA

Ok , so IDK what you have done, but for me it’s a new instance, without database. All device are unknow.

Um I’m not 100% sure what you mean on “open network” - I opened the Phoscon GUI via a web browser and went Devices/Switches/Add new switch. I suppose that opens the network…?
I tried the same from Group/Edit/Add new lights too - still nothing shows up in the GUI. :frowning:

I’ve put the .json file under /home/pi/.local/share/dresden-electronik/deconz/devices

The thing is that I already have a bunch of devices of older Xiaomi Aqara QBK04LM 1-way rocker switches which are also showing up as lumi.ctrl_ln1.aq1

Edit: Solved.
Edited a new file based on your recommendation and xiaomi_ws-euk04_h1_switch.json - now they all work as designed, also show up as lights.
I probably butchered it making a config file with very limited understanding so if you see anything really bad in it please correct it - but it works :slight_smile:
Placed at: /home/pi/.local/share/dresden-electronik/deconz/devices/QBK11LM.json

{
  "schema": "devcap1.schema.json",
  "manufacturername": "$MF_LUMI",
  "modelid": "lumi.ctrl_ln1.aq1",
  "vendor": "Xiaomi Aqara",
  "product": "QBKG11LM",
  "sleeper": false,
  "status": "Gold",
  "subdevices": [
   "subdevices": [
    {
      "type": "$TYPE_ON_OFF_LIGHT",
      "restapi": "/lights",
      "uuid": [
        "$address.ext",
        "0x01"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "parse": {
            "at": "0x00f7",
            "ep": 1,
            "fn": "xiaomi:special",
            "idx": "0x0d",
            "script": "xiaomi_swversion.js"
          },
          "read": {
            "fn": "none"
          }
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "state/alert"
        },
        {
          "name": "state/on",
          "refresh.interval": 300
        },
        {
          "name": "state/reachable"
        }
      ]
    },
    {
      "type": "$TYPE_SWITCH",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x05",
        "0x0012"
      ],
      "fingerprint": {
        "profile": "0x0104",
        "device": "0x0100",
        "endpoint": "0x05",
        "in": [
          "0x0012"
        ]
      },
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "config/temperature"
        },
        {
          "name": "state/buttonevent"
        },
        {
          "name": "state/lastupdated"
        }
      ]
    }
  ]
} 

Lol, I m happy for you, but I m still don’t understand what happened.
You have put the json at the same place ? without edition ? so what is different that make the DF working ?

In the end I still had Switches/Plugs coming and going from the network, it wasn’t perfect: removing certain sensors/switches was impossible and caused Deconz to hang and restart.

So the only real solution was to uninstall Deconz (on 2.29.2 the reset gateway didn’t work anymore) and reinstall it. Now it works, recognized all those switches without any JSON and they all work fine… It was an installation/config from 2019 so probably outdated.

I ran into some weird things with the fresh one too, like open/close sensors being recognized as light/presence and again deconz service restarts but step by step I’m getting there and backing up after every step…