[RELEASE] Xiaomi Aqara Mijia Sensors and Switches Driver

@chirpy ,when I monitor my sensors I see a check-in between 55 and 58 min, sometimes 60 - 63 min. When the precence check is on 2 hours and there is a check-in missing I see an alarm for a few minutes for the sensors with 60min+ check-in.
I think the initial idea of 3 hours was perfect after all :grinning:
Is it a big deal to add 3 hours in the list?

Looking into it now.

2 Likes

That's no problem.

1 Like

There's an issue with this and the nature of this combined driver. I have it working for various commands and it works fine. However, it makes the Commands section a bit of a confusing mess and if you click on one button that is unrelated to the actual device you get that attribute set for the life of the HE device entry. That is, to clear them completely you have to remove the device and re-add it.

To keep things neat and tidy, would it work just as well to have a single "Toggle" command button?

What "Toggle" does would depend on what the device actually does, e.g. open/close or active/not active. It would simply flip the attribute to the opposite of the current state.

EDIT: The alternative is to have all the code in place but comment out the Commands, leaving it up to the user to comment them in if they want them. The problem with that is you'd have to make the change every time the driver is upgraded.

That would work for me but I suppose it does introduce an element of user error.
Not sure what to suggest.
Would it be easier to not have the set active/inactive, set open/close and just introduce those attributes to the code so people can pick those commands in custom attributes?
Just thinking aloud as I haven't the slightest knowledge of coding.

Having the code there does not expose the command unfortunately, it has to be declared as a command for that to work, which means a mass of buttons. I'll have a think about it.

I am using this driver with a WXKG02LM [Aqara Double Rocker Wireless Switch]

It works well for click and double click on buttons 1, 2 and 3 (buttons 1 & 2 pressed together).
The state changes to pushed / doubletapped.

However when you hold the button(s) down, it changes to "held" and doesn't change state when the button(s) are released. Not sure if this is a feature of the physical device or can be fixed in the driver? :slight_smile:

If you could turn on debug logging and then do the hold and release (only) that does not complete, then provide the log output I can have a look as I don't have that switch.

EDIT: Looking at the device abilities it seems likely that it only supports held and not released. This will be apparent once you release the button as to whether an event is triggered or not.

Also, can you post the model in the Data section of the Device Details, if it is set.

dev:2712021-02-09 21:03:10.002 infoStudy Switch Double Rocker button 2 was held
dev:2712021-02-09 21:03:09.998 debugStudy Switch Double Rocker Button:2, Action:0
dev:2712021-02-09 21:03:09.994 debugProcessing Xigbee data (cluster:0012, attrId:0055)
dev:2712021-02-09 21:03:09.990 debugIncoming data from device : read attr - raw: 1FAB0200120A5500210000, dni: 1FAB, endpoint: 02, cluster: 0012, size: 0A, attrId: 0055, encoding: 21, command: 0A, value: 0000
dev:2712021-02-09 21:02:50.253 infoStudy Switch Double Rocker button 1 was held
dev:2712021-02-09 21:02:50.248 debugStudy Switch Double Rocker Button:1, Action:0
dev:2712021-02-09 21:02:50.244 debugProcessing Xigbee data (cluster:0012, attrId:0055)
dev:2712021-02-09 21:02:50.240 debugIncoming data from device : read attr - raw: 1FAB0100120A5500210000, dni: 1FAB, endpoint: 01, cluster: 0012, size: 0A, attrId: 0055, encoding: 21, command: 0A, value: 0000

Model is: lumi.remote.b286acn01

Thanks. :grinning:

Thanks for that. Yep, the device doesn't technically report released, only held. If a release would help, I can fake one if you need it?

That would be very useful - thank you. :grinning:

I'm using the WXKG01LM and I'm wondering is it possible to use the triple tap and 4 time tap with the button controller app and if yes how?

The driver reports that there are 5 buttons, so the button controller app thinks it can work with pushed, held, double tapped and released for 5 buttons. However in reality only button 1 is available and from what I've seen the app can only make use of pushed, double tapped, held and released.

I've seen other drivers map the multiple presses to other button presses.
i.e. press = button 1 pushed
double tap = button 2 pushed
triple = button 3 pushed
4 times = button 4 pushed
long press = button 5 pushed.

That is one option for the implementation I've seen but I'm sure there are better ways too.

So If I'm not missing anything in terms of using the driver would it be possible to make a change to it?

Also wondering is it at all possible to allow a 500ms button hold duration for it or is the minimum 1 second?

Thanks very much,

Alex

v0.12 released:

  • Added more presence intervals
  • Added device Commands, however they are all commented out by default
  • Removed unnecessary "isStateChange:true" for all devices apart from buttons
  • Added fingerprint for WXKG02LM
  • Modified Held duration setting to float to allow for milliseconds (e.g 0.5 = 500 milliseconds)
  • Added configurable virtual Release event for WXKG02LM and WXKG03LM
  • Added setting to allow WXKG01LM to represent 5 buttons instead of a single button with multiple states
2 Likes

@chirpy I noticed today, that temperature sensors stoped to report temperature or report interval is very rare. Battery and voltage level is reported frequently, but not the temperature. Any hint for this?

1 Like

Which driver are you using? If it's the latest one then it will only raise an event if the temperature changes from the previous reading.

1 Like

v 0.11 and on second sensor that is sitting next to the first one Xiaomi Temperature Humidity Sensor driver. The second one was updating temperature well. I will do some more testing and try v.12
Edit: I checked other 4 sensor running with this driver and they do work fine. Seems to be sensor issue.
OK so did a quick test. took the sensor down from the wall and blew into it. Only Humidity was updated, no record of temperature change, and it was changed for sure with my breath :slight_smile:

Then I changed driver to Xiaomi temperature humidity sensor and everithing was updated continuosly.

What is strange, that other sensor are being updated fine with your driver

@chirpy found a bug: No matter how I do enter temp offset (0,5 or 0.5) I do always get this error: dev:2802021-02-10 17:35:02.663 errorjava.lang.NumberFormatException: For input string: "-0.5" on line 243 (parse)
Once I do enter number without decimals, or no offset, ot works.

Thanks for this @chirpy
Much appreciated. :+1:

1 Like

It only accepts integer values for the temperature offset.