Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xiaomi Aqara Wall Switches #356

Closed
mathos77 opened this issue Jan 9, 2018 · 100 comments
Closed

Xiaomi Aqara Wall Switches #356

mathos77 opened this issue Jan 9, 2018 · 100 comments

Comments

@mathos77
Copy link

mathos77 commented Jan 9, 2018

Hi @manup,

I have ordered these Xiaomi single and double key switches, which are powered by mains.
https://www.gearbest.com/alarm-systems/pp_610096.html?utm_source=email_sys&utm_medium=email&utm_campaign=shipping
https://www.gearbest.com/alarm-systems/pp_625774.html?utm_source=email_sys&utm_medium=email&utm_campaign=shipping

I was hoping to find these supported as being a light (on-off) as they should have this capability.

After joining them into deCONZ, I see this:
image

Can we get these switches supported, as it would greatly improve my home automation, for places where I do not want a real smart light, so in this case it would become a semi-smart light.

Thanks!

Kind regards, Tom.

@ebaauw
Copy link
Collaborator

ebaauw commented Jan 9, 2018

I was hoping to find these supported as being a light (on-off) as they should have this capability.

Looks like they do - see endpoint 0x03.

Can we get these switches supported, as it would greatly improve my home automation, for places where I do not want a real smart light, so in this case it would become a semi-smart light.

I'd expect the REST API to create already an on/off light for this? Did you open the network from the Settings in the Web app, or from the deCONZ GUI? The REST API will only create a resource when you open the network from the Web app.

Could you open the Cluster Info panel on the Basic cluster on endpoint 0x01, Read the attributes, and post a screenshot? It might take a couple of attempts, but as this switch is mains powered it might work straight away. We would especially need the Manufacturer Name and the Model Identifier. If they work like the other Xiaomi switches, you might need to press briefly the reset button, to have the switch report it's Basic attributes.
Please check both the single and double key switches - they're probably slightly different.

The switch looks very similar to the QBKG03LM (#335) and the WXKG02LM (#165), so maybe adding the name is enough to get the buttons to work with deCONZ. You wouldn't be able to sniff the ZigBee network and see what messages the switch sends?

@mathos77
Copy link
Author

mathos77 commented Jan 9, 2018

Hi @ebaauw ,

I did try both, WebUI (deCONZ plain) and deCONZ GUI. I even tried Phoscon.
Anyway, so you believe it should already have entry under lights.
It did not unfortunately.
I can switch (ON or OFF) and Toggle both switches on the Double-Key switch via Cluster Info btw.
Not tried the single switch yet, but will do when I get this one fixed.

The screenshot requested: (btw, deCONZ 2.04.99 with the built REST-plugin)
image

I believe it is VERY similar if not the same, as the other QBKG03LM

Kind regards, Tom.

@mathos77
Copy link
Author

mathos77 commented Jan 9, 2018

Oh, I do not have a sniffer ready, but....I do have a dusty RaspBee and a spare pi lying around.
How easy is it to start sniffing with that ?

@ebaauw
Copy link
Collaborator

ebaauw commented Jan 9, 2018

Oh, I do not have a sniffer ready, but....I do have a dusty RaspBee and a spare pi lying around.
How easy is it to start sniffing with that ?

Not - you'd need a ConBee.

@mathos77
Copy link
Author

mathos77 commented Jan 9, 2018

oh, well I do have a conbee, as my main device. Can I do this without messing up my setup afterwards ? (I would have to have to revisit all Hue bulps again :) )

@ebaauw
Copy link
Collaborator

ebaauw commented Jan 9, 2018

You'd need to shutdown deCONZ and flash different firmware to the ConBee, see #69. The deCONZ installation would remain untouched, except for the info stored on the ConBee (stuff like PANID, network key, channel). Best make some screenshots of the deCONZ Network Settings, so you can restore these. deCONZ should prompt to flash the ConBee firmware back.

Not sure I would recommend this. I would take the next reinstallation (we're still on beta...) to move production to the RaspBee, before messing with the ConBee. Which reminds me: I still need to do a restore test from my production pi to my test/backup pi (both having a RaspBee).

@mathos77
Copy link
Author

@manup
Hi Manuel,

As a side-note to the lumi.ctrl_neutral2, I also have a lumi.ctrl_neutral1 (One Button in-wall switch)
(Reference: #335)

Now, can we get the one that has a typo (neural2 instead of neutral2) fixed, + this one with neutral1.

I would also like to see this as a light ON/OFF, as this is what it supports.
I do see a benefit of it also being a sensor though, so it will match more with the similar remotes, which do not have the switching part. That way you could use it also as a sensor to trigger other things too.

I can click on the On/Off/Toggle button and that works great:
image

When the switch (light) is "OFF", this is shown:
image

When the switch (light) is "ON", this is shown:
image

Please let me know if you require more info.

Kind regards, Tom.

@ebaauw
Copy link
Collaborator

ebaauw commented Jan 11, 2018

I would expect the OnOff cluster on the 03 endpoint to reflect the state of the light.

The OnOff on some other endpoint should reflect the state of (one of the) the key(s), probably true for pressed and false when not pressed (there are stateless switches, aren't they?). If they work like the other Xiaomi switches, the value should change life, when you press/release the key. It would be cool if you could reverse-engineer what the Multistate Input clusters represent (i.e. what value to they show under what condition).

@manup I don't understand why the On/off light isn't exposed. Could it be a ZLL On/off light on a ZHA endpoint (would deCONZ display it like this)?

@mathos77, I'm happy to submit a PR for support of the switches, but you'll have to wait for Manual to return and release a new version.

@mathos77
Copy link
Author

Hi @ebaauw Erik,

That would be cool. if you can create the PR.
So, can you elaborate a bit more on what you would like to see as in information?
Do you want to see the status for all nodes from deCONZ UI during the different states ?

@ebaauw
Copy link
Collaborator

ebaauw commented Jan 16, 2018

Yes, we’d need to understand how the attribute value for each cluster changes when you press/release/hold a (or both) key(s). Typically, attribute 0x0000 of cluster 0x0006 of endpoint 02 would be true while you hold the left button and false after you release it. Same for the right button and endpoint 04. Maybe endpoint 05 for both buttons. I’m hoping the multistate input (endpoint 05, cluster 0x0012, I think attribute 0x0055) might provide more specific info, like different values for press, double press or so. We need to map these to the buttonevent values of the REST API. You should be able to observe the value change in real time in the deCONZ GUI.

@mathos77
Copy link
Author

Hi Erik, okay, I will test this tonight with both the single and double key switches

@mathos77
Copy link
Author

Hi @ebaauw ,

I have tested the single-key wall switch (lumi.ctrl_neutral1) which I also added to the 2.04.99 version of the REST plugin before building it.

It is added as a sensor, but not doing anything (actually 3 clusters are added)
I press the button, to turn it on or off, I see the node giving the blue light.
In REST no changes are seen.

image

Futher, the only status I see changing is under EP 02 0x0000, Cluster 0x0006:
ON
image

OFF
image

On this EP/Cluster, I can also utilize the Toggle, On and Off buttons to switch the light on/off

@ebaauw
Copy link
Collaborator

ebaauw commented Jan 18, 2018

I have tested the single-key wall switch (lumi.ctrl_neutral1) which I also added to the 2.04.99 version of the REST plugin before building it.

You need to pair the switches with the compiled plugin. Please delete the sensor resources from the REST API, delete the node from the deCONZ GUI and re-pair the sensor. It might be prudent to shutdown deCONZ and remove physically the Deleted sensor resources from the database (in ~/.local/share/dresden-elektronik/deCONZ/zll.db). With the latest commit, deCONZ only creates resources for the Mulitstate input (0x0012) and Analog Input (0x000c) clusters for the Xiaomi Smart Cube. And it should create resources for the Basic cluster (0x0006), but I've a hunch that it might not...

Something odd is going on: the GUI screenshots only show endpoints 01, 02, 03 and 04. The REST resources suggest that there's also endpoints 05, 06, and 08, the first two with a 0x0012 cluster and the last with a 0x000c cluster.

Futher, the only status I see changing is under EP 02 0x0000, Cluster 0x0006:

Is this on a one-button switch (ctrl_neutral1)? Did the REST API create a light resource for this one? I assume true when the button is pressed (held) and false when it's not?

On this EP/Cluster, I can also utilize the Toggle, On and Off buttons to switch the light on/off

That's probably because this endpoint is still bound to the 03 endpoint.

@zydeco
Copy link

zydeco commented Jan 18, 2018

I have two one-key switches, and I've been experimenting with them a bit:

  • The OnOff cluster on endpoint 03 does reflect the state of the light, but it doesn't respond to changes, only the 0xFFFF cluster allows turning the light on and off.
  • The light isn't exposed to the REST side because the device is an end device, so it's skipped from addLightNode completely

I've tried to implement this on my fork, and it seems to work, but sometimes the switch will stop responding to commands until the device is paired again, and I'm not sure what's going on: the log will have several entries saying delay sending request 139 cluster 0x0004 to 0x00158d0001614b4b and eventually give up.

@ebaauw
Copy link
Collaborator

ebaauw commented Jan 18, 2018

The OnOff cluster on endpoint 03 does reflect the state of the light, but it doesn't respond to changes, only the 0xFFFF cluster allows turning the light on and off.

Do you mean the 0x0006 cluster on the 02 endpoint with device type 0xFFFF? What do you mean by "respond to changes"? Did you try the On, Off, and Toggle commands on cluster 0x0006 of endpoint 03 (the On/Off light)?

The light isn't exposed to the REST side because the device is an end device, so it's skipped from addLightNode completely

Bloody hell, it's mains powered but not a ZigBee router. Good catch!

I've tried to implement this on my fork

You're exposing endpoint 02 as the light? Won't that break adding it to a group or a scene, as these clusters are on endpoint 03?

I think in addLightNode() it's probably enough to check for device type (ZLL or ZHA? On/Off light) and the MAC address prefix instead of going through the trouble of finding the model. Afaik none of the other Xiaomi devices use an On/Off light device type.

@ebaauw
Copy link
Collaborator

ebaauw commented Jan 18, 2018

Something odd is going on: the GUI screenshots only show endpoints 01, 02, 03 and 04. The REST resources suggest that there's also endpoints 05, 06, and 08, the first two with a 0x0012 cluster and the last with a 0x000c cluster.

See #335: that has the 05, 06, and 08 clusters in the screenshot, but the 03 cluster isn't an On/Off light. If I were superstitious, I'd say these switches are cursed.

@zydeco
Copy link

zydeco commented Jan 18, 2018

On my lumi.ctrl_neutral1 (single key switch):
Endpoint 02, device type 0xFFFF, cluster 0x0006:

  • Attribute 0x0000 reports the state of the light
  • On, Off and Toggle commands work, they will turn the attached light on, off or toggle

Endpoint 03, On/off light, cluster 0x0006:

  • Attribute 0x0000 reports the state of the light
  • On, Off and Toggle commands don't do anything, even though it will say "success" after pressing exec.

This is why I'm exposing endpoint 02 as the light, but I haven't tried to add them to groups or scenes.

Regarding the missing endpoints, the previous screenshots by @mathos77 do have endpoints 05, 06 and 08, like mine do, they seem to have disappeared from his setup?

The one on #335 is the two button model, but it has three 0xFFFF endpoints with a 0x0006 cluster instead of two.

@ebaauw
Copy link
Collaborator

ebaauw commented Jan 18, 2018

The one on #335 is the two button model, but it has three 0xFFFF endpoints with a 0x0006 cluster instead of two.

But no On/Off light.

Regarding the missing endpoints, the previous screenshots by @mathos77 do have endpoints 05, 06 and 08, like mine do,

And a 04 0xFFFF endpoint, similar to the two-button switch.

they seem to have disappeared from his setup?

And 04 has changed from device type 0xFFFF and having only an OnOff cluster to an On/Off switch with also a Multistate input cluster?

I suspect pairing, deleting, re-pairing using a different version, without removing the deleted records from the database would do this. Probably combined with the usual Xiaomi pairing blues - the device not being read in full. Maybe you need to press briefly the reset button a couple of times while pairing, as is typically needed for the battery-powered Xiaomi switches.

Doing some digging on Ali-Express, GearBest and YouTube, the two-button switch actually has two independent light outputs. I would expect it to expose two On/Off lights. I'd theorise that the 02 and 03 endpoints are, in fact, the two outputs, but the 03 is not fully functional on the lumi.ctrl_neutral1.

Do you have group and scene clusters on your endpoint 02, or only on 03?

@zydeco
Copy link

zydeco commented Jan 18, 2018

Do you have group and scene clusters on your endpoint 02, or only on 03?

Only on 03, it's like the first screenshots in this thread:
screen shot 2018-01-18 at 21 16 52

@mathos77
Copy link
Author

@zydeco @ebaauw
Mine also have the 05,06,08 now. After re-pairing it.
Now I screwed my ConBee setup bigtime, so I am now migrating all to RaspBee. Then I have the ConBee to play with these safely without messing up my hue stuff again :)

I can then also load the bitcatcher on it so we can sniff.

This was referenced Jan 29, 2018
@mathos77
Copy link
Author

mathos77 commented Feb 13, 2018

@manup @ebaauw
Hi Erik, Manuel,

Can we get something going for these?
I am now running 2.05.02, and even though the 1 and 2 button switches are added correctly to deCONZ, I still see no sensors nor lights.

Please let me know what you require to get these properly supported as both sensor, and switch/light (On/Off).

(ps. I can sniffer if that is required)

Thanks!!!

Kind regards, Tom.

@zladukas
Copy link

Hello,

got QBKG03LM from Gearbest https://www.gearbest.com/alarm-systems/pp_610096.html , but unable to add to REST plugin & zll DB . It looks like #335, but not working.

I'm running 2.05.02, compiled REST plugin. Read all issues about that. Tried to add via REST plugin Web interface, PWA, directly making HTTP POST, but no success.

I can see device only in deCONZ GUI and at least EP 2 & 3 cluster 0006 are working, when clicking ON/OFF/TOGLE

screen shot 2018-02-17 at 15 27 50

screen shot 2018-02-17 at 15 28 34

also captured debug logs, by running:
deCONZ --dbg-info=2 --dbg-zdp=1 --dbg-zcl=1 --db-aps=1 --dbg-http=2 --upnp=0

deCONZ_QBKG03LM_libde_rest.log

What I'm doing wrong?

BR Dalius.

@manup
Copy link
Member

manup commented Feb 17, 2018

Thanks that's helpful, 2.05.03 will arrive shortly, this should add the REST sensor resource for lumi.ctrl_neutral2, anyway button events likely need some more work.

There will be more debug options too in order to see APS/ZCL payload.

@manup
Copy link
Member

manup commented Feb 17, 2018

Version 2.05.03 is online for Raspbian:
http://www.dresden-elektronik.de/rpi/deconz/beta/deconz-2.05.03-qt5.deb

More noisy debug output via --dbg-aps=2 --dbg-info=2

To add the sensor open the network in the WebApp or Phoscon App (search sensors).
When power-cycle the device and press some buttons.

@zladukas
Copy link

@manup,
2.05.03, as You told, successfully added sensor to REST.
I can see buttonevent is changing.

collected two logs with options
deCONZ --dbg-info=2 --dbg-zdp=1 --dbg-zcl=1 --dbg-http=2 --upnp=0 --dbg-aps=2 --dbg-info=2

adding sensor:
deCONZ_QBKG03LM_2.5.3.log

and different button combination:
(1st button) ON, then OFF
(2nd button) ON, then OFF
(both buttons) ON, then OFF
deCONZ_QBKG03LM_2.5.3_button_events.log

BR Dalius.

@manup
Copy link
Member

manup commented Feb 18, 2018

From the logs it looks like the switch does only send 3 states like the battery version of the switch.

The button events should be:

2002   1st button
3002   2nd button
6002   both buttons

If you see these via REST API that's all we can do, since the switch does not send events for press and release.

@simonporter007
Copy link

Looking forward to testing on Ubuntu build! Cheers manup!

@tomfritz1
Copy link

I have the Aqara (single) wall switch. After update to 2.05.23 it works immediately for the first time ever - well done!!! It shows 4 lights in Phoscon (and no sensors); one of the 4 lights can turn the switch on/off (the other 3 are without any function). The only problem I see: when I create group and add this single light and switch the group on/off (which I would like to use with sensor) it does not work - only the single light can be switched on/off.

@simonporter007
Copy link

serious serious kudos. Deleted the node form deconz gui, deleted the sensor from rest api too and then upgraded to .23 and re-joined the light. It gives me two lamps in the phoscon app (which both work). I have some new daylight sensors and consumption sensors (not sure if they were part of it too). This is fantastic, just what I've been waiting for.

Now back to home assistant to get this hooked up with everything else! Thanks so much!

@ebaauw
Copy link
Collaborator

ebaauw commented Apr 24, 2018

@tomfritz1, which model is this, the lumi.ctrl_neutral1? Could you please list the light and any sensor resources? I'm afraid the switch doesn't support groups, which could be handled better by Phoscon (and by the web app).

@simonporter007, which model is this, the lumi.ctrl_neutral2 or the lumi.ctrl_ln2? Could you also please list the light and sensor resources? The Daylight sensor was recently introduced and is unrelated to the Xiaomi wall switch.

@simonporter007
Copy link

simonporter007 commented Apr 25, 2018

@ebaauw Yup, the lumi.ctrl_neutral2
/sensors =

{
    "6": {
        "config": {
            "battery": null,
            "on": true,
            "reachable": true,
            "temperature": null
        },
        "ep": 4,
        "etag": "da23764c0cd9d001967fec85ac258bed",
        "manufacturername": "LUMI",
        "mode": 1,
        "modelid": "lumi.ctrl_neutral2",
        "name": "Kitchen Light",
        "state": {
            "buttonevent": 1002,
            "lastupdated": "2018-04-24T23:43:26"
        },
        "type": "ZHASwitch",
        "uniqueid": "00:15:8d:00:01:6c:73:51-04-0006"
    },
    "7": {
        "config": {
            "battery": null,
            "on": true,
            "reachable": true,
            "temperature": null
        },
        "ep": 8,
        "etag": "da23764c0cd9d001967fec85ac258bed",
        "manufacturername": "LUMI",
        "modelid": "lumi.ctrl_neutral2",
        "name": "Consumption 7",
        "state": {
            "consumption": null,
            "lastupdated": "none"
        },
        "type": "ZHAConsumption",
        "uniqueid": "00:15:8d:00:01:6c:73:51-08-000c"
    }
}

/lights =

{
    "2": {
        "etag": "da23764c0cd9d001967fec85ac258bed",
        "hascolor": false,
        "manufacturername": "Unknown",
        "modelid": null,
        "name": "Light 2",
        "state": {
            "alert": "none",
            "on": false,
            "reachable": true
        },
        "swversion": null,
        "type": "Smart plug",
        "uniqueid": "00:15:8d:00:01:6c:73:51-02"
    },
    "3": {
        "etag": "da23764c0cd9d001967fec85ac258bed",
        "hascolor": false,
        "manufacturername": "Unknown",
        "modelid": null,
        "name": "Light 3",
        "state": {
            "alert": "none",
            "on": false,
            "reachable": true
        },
        "swversion": null,
        "type": "Smart plug",
        "uniqueid": "00:15:8d:00:01:6c:73:51-03"
    }
}

The other sensors and lights are just ikea/motion sensor stuff I cut out for brevity sake.

Cheers,

@DB-Alex
Copy link

DB-Alex commented Apr 25, 2018

How come mine is not working?

@KingTomaHawk
Copy link

KingTomaHawk commented Apr 26, 2018

I have the same issue. Only the Light with the name "Xiaomi Wallswitch" works, light 8,9,10 seems to have no effect.

EDIT: It looks like, "light 10" is the name of the device in deConz, but "Xiaomi Wallswitch" (former "light 7") is able to turn it on and off.

Lights REST:

	"10": {
		"etag": "b32882b1693f6a0e60d36c9cbfa993b8",
		"hascolor": false,
		"manufacturername": "Unknown",
		"modelid": null,
		"name": "Light 10",
		"state": {
			"alert": "none",
			"on": false,
			"reachable": true
		},
		"swversion": null,
		"type": "On/Off light",
		"uniqueid": "00:15:8d:00:01:a2:3f:c3-06"
	},
	"7": {
		"etag": "b32882b1693f6a0e60d36c9cbfa993b8",
		"hascolor": false,
		"manufacturername": "Unknown",
		"modelid": null,
		"name": "Xiaomi Wallswitch",
		"state": {
			"alert": "none",
			"on": false,
			"reachable": true
		},
		"swversion": null,
		"type": "Smart plug",
		"uniqueid": "00:15:8d:00:01:a2:3f:c3-02"
	},
	"8": {
		"etag": "b32882b1693f6a0e60d36c9cbfa993b8",
		"hascolor": false,
		"manufacturername": "Unknown",
		"modelid": null,
		"name": "Light 8",
		"state": {
			"alert": "none",
			"on": true,
			"reachable": true
		},
		"swversion": null,
		"type": "On/Off light",
		"uniqueid": "00:15:8d:00:01:a2:3f:c3-04"
	},
	"9": {
		"etag": "b32882b1693f6a0e60d36c9cbfa993b8",
		"hascolor": false,
		"manufacturername": "Unknown",
		"modelid": null,
		"name": "Light 9",
		"state": {
			"alert": "none",
			"on": false,
			"reachable": true
		},
		"swversion": null,
		"type": "On/Off light",
		"uniqueid": "00:15:8d:00:01:a2:3f:c3-05"
	}
}

Sensors REST:

{
	"11": {
		"config": {
			"battery": null,
			"on": true,
			"reachable": true,
			"temperature": 0
		},
		"ep": 4,
		"etag": "b32882b1693f6a0e60d36c9cbfa993b8",
		"manufacturername": "LUMI",
		"mode": 1,
		"modelid": "lumi.ctrl_neutral1",
		"name": "lumi.ctrl_neutral1",
		"state": {
			"buttonevent": 1002,
			"lastupdated": "2018-04-25T22:05:12"
		},
		"type": "ZHASwitch",
		"uniqueid": "00:15:8d:00:01:a2:3f:c3-04-0006"
	},
	"12": {
		"config": {
			"battery": null,
			"on": true,
			"reachable": true,
			"temperature": 0
		},
		"ep": 8,
		"etag": "b32882b1693f6a0e60d36c9cbfa993b8",
		"manufacturername": "LUMI",
		"modelid": "lumi.ctrl_neutral1",
		"name": "Consumption 12",
		"state": {
			"consumption": null,
			"lastupdated": "none"
		},
		"type": "ZHAConsumption",
		"uniqueid": "00:15:8d:00:01:a2:3f:c3-08-000c"
	},
}

@tomfritz1
Copy link

@ebaauw here is the /lights

},
"21": {
"etag": "2c1f2fb4ac36440a9cad9b6843d7718e",
"hascolor": false,
"manufacturername": "Unknown",
"modelid": null,
"name": "Klo1",
"state": {
"alert": "none",
"on": false,
"reachable": true
},
"swversion": null,
"type": "Smart plug",
"uniqueid": "00:15:8d:00:01:f5:69:52-02"
},
"22": {
"etag": "2c1f2fb4ac36440a9cad9b6843d7718e",
"hascolor": false,
"manufacturername": "Unknown",
"modelid": null,
"name": "Klo2",
"state": {
"alert": "none",
"on": false,
"reachable": true
},
"swversion": null,
"type": "On/Off light",
"uniqueid": "00:15:8d:00:01:f5:69:52-04"
},
"23": {
"etag": "2c1f2fb4ac36440a9cad9b6843d7718e",
"hascolor": false,
"manufacturername": "Unknown",
"modelid": null,
"name": "Klo3",
"state": {
"alert": "none",
"on": false,
"reachable": true
},
"swversion": null,
"type": "On/Off light",
"uniqueid": "00:15:8d:00:01:f5:69:52-05"
},
"24": {
"etag": "2c1f2fb4ac36440a9cad9b6843d7718e",
"hascolor": false,
"manufacturername": "Unknown",
"modelid": null,
"name": "Klo4",
"state": {
"alert": "none",
"on": false,
"reachable": true
},
"swversion": null,
"type": "On/Off light",
"uniqueid": "00:15:8d:00:01:f5:69:52-06"
}
}

@tomfritz1
Copy link

@ebaauw model identification is "lumi.ctrl_neutral1" it is the xiaomi wall switch (single button)

@ebaauw
Copy link
Collaborator

ebaauw commented Apr 27, 2018

@alexvandervegt , @simonporter007 , @tomfritz1 , @KingTomaHawk ,
My lastest PR should suppress the superfluous light resources and config.battery. Could you please test this and let me know if it works? Please make sure to delete the light and sensor resources and purge the database before re-pairing the switch.

The PR also parses the Xiaomi magic report for the lumi.ctrl_ln2.aq1, see the --dbg-info=2 log from deCONZ:

Apr 27 20:14:36 pi1 deCONZ[29394]: 20:14:35:323 APS-DATA.indication srcAddr: 0x00158d00022a9cc7, dstAddrMode: 2, profile: 0x0104, cluster: 0x0000, lqi: 255, rssi: -48
Apr 27 20:14:36 pi1 deCONZ[29394]: 20:14:35:323 ZCL attribute report 0x00158D00022A9CC7 for cluster 0x0000, ep 0x01
Apr 27 20:14:36 pi1 deCONZ[29394]: 20:14:35:323 	payload: 01ff422e64100065100003281d9839000000009539ba1c093e052105009a201008211f110727000000000000000009210001
Apr 27 20:14:36 pi1 deCONZ[29394]: 20:14:35:323 0x00158D00022A9CC7 extract Xiaomi special
Apr 27 20:14:36 pi1 deCONZ[29394]: 20:14:35:323 	64 on/off 0
Apr 27 20:14:36 pi1 deCONZ[29394]: 20:14:35:323 	65 on/off 0
Apr 27 20:14:36 pi1 deCONZ[29394]: 20:14:35:323 	03 temperature 29 °C
Apr 27 20:14:36 pi1 deCONZ[29394]: 20:14:35:323 	98 power (?) 0x00000000
Apr 27 20:14:36 pi1 deCONZ[29394]: 20:14:35:323 	95 consumption (?) 0x3E091CBA
Apr 27 20:14:36 pi1 deCONZ[29394]: 20:14:35:323 	05 unknown 5 (0x0005)
Apr 27 20:14:36 pi1 deCONZ[29394]: 20:14:35:323 	9a unknown 16 (0x10)
Apr 27 20:14:36 pi1 deCONZ[29394]: 20:14:35:323 	08 unknown 4383 (0x111F)
Apr 27 20:14:36 pi1 deCONZ[29394]: 20:14:35:323 	07 unknown 0 (0x0000000000000000)
Apr 27 20:14:36 pi1 deCONZ[29394]: 20:14:35:323 	09 unknown 256 (0x0100)
Apr 27 20:14:36 pi1 deCONZ[29394]: 20:14:35:324 Node data 0x00158d00022a9cc7 profileId: 0x0104, clusterId: 0x0000
Apr 27 20:14:36 pi1 deCONZ[29394]: 20:14:35:324 Update Sensor 0x00158D00022A9CC7 Basic Cluster

Could you please capture these log messages for the lumi.ctrl_ln1.aq1, lumi.ctrl_neutral1, and lumi.ctrl_neutral2? Thanks.

@DB-Alex
Copy link

DB-Alex commented Apr 27, 2018

@ebauw how can i purge the database?

@ebaauw
Copy link
Collaborator

ebaauw commented Apr 27, 2018

When you delete a resource through the REST API, the corresponding record in the database is marked "deleted". When the node is re-discovered, the "deleted" record is restored. For a clean re-pairing, you need to delete the "deleted" records from the sqlite database in ~/.local/shared/dresden-elektronik/deCONZ/zll.db. The lights are in the nodes table, with the marking in the state column. The sensors are in the sensors table, with the marking in the deletedState column.

I use sqlitebrowser, which, on Raspbian Stretch, is simply installed through sudo apt install sqlitebrowser. Make sure to stop deCONZ before editing the database.

manup pushed a commit that referenced this issue Apr 28, 2018
@KingTomaHawk
Copy link

@manup Can you please upload a new build with the fix included? I'm not very familiar with the build process.

@1968-Larry
Copy link

I created earlier to create a ticket(#543) for my aqara wall switches but @manup refered to this ticket. I have upgraded to latest package available, removed the switches in pwa and database and tried to connect it back to the network. It's paired and I can see it in pwa/device/switches but I can't use it in groups. I tried to read /api/apikey/switches and it's missing.
I got this in the database:
"3549" "5" "lumi.sensor_86sw2 5" "ZHASwitch" "lumi.sensor_86sw2" "LUMI" "00:15:8d:00:01:e0:75:db-01-0006" "" "{""buttonevent"":null,""lastupdated"":null}" "{""battery"":null,""on"":true,""reachable"":true,""temperature"":null}" "{""d"":65535,""ep"":1,""in"":[0,6],""p"":260}" "normal" "1"

@ebaauw
Copy link
Collaborator

ebaauw commented Apr 29, 2018

This is not a wall switch - please use the original issue.

@KingTomaHawk
Copy link

I can confirm that the number of detected lights is reduced to 2 (I had to clear the entries from the DB before) :

"7": {
		"etag": "1f5b2e4c2e0286192dbf70c9c41bfe54",
		"hascolor": false,
		"manufacturername": "Unknown",
		"modelid": null,
		"name": "Light 7",
		"state": {
			"alert": "none",
			"on": false,
			"reachable": true
		},
		"swversion": null,
		"type": "Smart plug",
		"uniqueid": "00:15:8d:00:01:a2:3f:c3-02"
	},
	"8": {
		"etag": "42b52b99cf6b85c55cc5a9dfa1377f2b",
		"hascolor": false,
		"manufacturername": "Unknown",
		"modelid": null,
		"name": "Light 8",
		"state": {
			"alert": "none",
			"on": false,
			"reachable": true
		},
		"swversion": null,
		"type": "On/Off light",
		"uniqueid": "00:15:8d:00:01:a2:3f:c3-03"
	}

Light number 7 is the working one. If someone can explain me how to get the the requested --dbg-info=2 log, I will post them too.

@DB-Alex
Copy link

DB-Alex commented May 7, 2018

@ebaauw

It looks like all other Xiaomi wireless switches dont work now anymore.

I just updated to deconz 2.0.5.25 and when i check the logs i see:

11:42:22:645 Daylight now: goldenHour1, status: 160
11:42:31:629 no button map for: lumi.sensor_86sw1 cl: 0x0006 cmd: 0x0A pl[0]: 000
11:42:31:629 ZCL attribute report 0x00158D0001711605 for cluster 0x0006, ep 0x01
11:42:31:629 APS-DATA.indication from unknown node 0x00158D0001711605
11:42:32:649 Daylight now: goldenHour1, status: 160
11:42:32:668 Current channel 15
11:42:32:847 no button map for: lumi.sensor_86sw1 cl: 0x0006 cmd: 0x0A pl[0]: 000
11:42:32:847 ZCL attribute report 0x00158D0001711605 for cluster 0x0006, ep 0x01
11:42:32:847 APS-DATA.indication from unknown node 0x00158D0001711605
11:42:42:649 Daylight now: goldenHour1, status: 160
11:42:52:649 Daylight now: goldenHour1, status: 160
11:43:02:649 Daylight now: goldenHour1, status: 160

@ebaauw
Copy link
Collaborator

ebaauw commented May 7, 2018

I've only looked at the wired in-wall switches (lumi.ctrl_neutral and lumi.ctrl_ln), not at the wireless switches. My lumi.sensor_switch.aq2 switches work fine with v2.5.25. I think there might be an issue with lumi.sensor_86sw switches, see #543.

@KingTomaHawk
Copy link

It seems like none of the light entries are discoverable over the hue Api. Can someone confirm that?

@DB-Alex
Copy link

DB-Alex commented May 22, 2018

Any updates about the non working buttons for the wireless switch?

@ebaauw

@saurabh984
Copy link
Contributor

WXKG02LM & WXKG03LM both work for me using deCONZ v2.05.27

It took several attempts to get them to join and be reported by the REST API. I found that resetting them first by pressing the button for >5 seconds after removing and reinserting the battery had better results.

After doing the reset cycle I added them again by opening the network and pressing the button for 5 seconds.

Hope it helps!

@manup
Copy link
Member

manup commented Oct 5, 2018

Closing this issue, discussion continues in issue #798

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests