Support for more Mi-Home Aqara items

My aqara motion sensor arrived last week. The aqara switch and water sensor are also on their way. Hopefully OH support will follow :slight_smile:



I got the Smoke sensor, Aqara body sensor, Aqara Wireless Wall Switch, if anybody want to have something tested, please let me know.

I’m planning to try helping developing the new Aqara ‘things’. Based on the existing things, I think I will be able to contribute. My question is now how to capture the used variables (like temperature, battery
) Simply with Wireshark or by another way?

I saw that the latest Aqara Door/Window Sensor is also already supported (https://github.com/openhab/openhab2-addons/commit/1543c4ccfa90445e9337c1c5caef523be7fbd255)

Hi,
I used WireShark to get the traces, it was straighforward.

Indeed, i received some info


Aqara motion sensor

^24E’lP2&v{“cmd”:“report”,“model”:“sensor_motion.aq2”,“sid”:“158d000xxxxxxx”,“short_id”:46445,“data”:"{“lux”:“51”}"}
^24E’nP2&}]{“cmd”:“report”,“model”:“sensor_motion.aq2”,“sid”:“158d000xxxxxxx”,“short_id”:46445,“data”:"{“status”:“motion”}"}

Water leak sensor

^24E’7P2&zj{“cmd”:“report”,“model”:“sensor_wleak.aq1”,“sid”:“158d000xxxxxxx”,“short_id”:52832,“data”:"{“status”:“leak”}"}
^24E(/P2&}{“cmd”:“report”,“model”:“sensor_wleak.aq1”,“sid”:“158d000xxxxxxx”,“short_id”:52832,“data”:"{“status”:“no_leak”}"}

2 Likes

@wars thank you so much!

I’ve started working on the Water Leak sensor support and your data will be very helpful :slight_smile:

Also pinging @horschte and @X-Ray181 as they’ve reported that the smoke sensor doesn’t work for them.
In this PR I’m attempting to fix it to:

2 Likes

I’ve added Aqara Motion Sensor support as well thanks to @wars logs.
If anyone’s interested in testing my changes, feel free to grab compiled JAR from here:

Please let me know if it works :slight_smile:

Hi guys - i received my Xiomi stuff the other day. Gateway, 2x Motion senors ( very small! ), a round button and 2 pieces of the “xiaomi aqara smart switch 2 button”. I managed to get these setup and detected as things in OH with the binding installed via PaperUI - im using the latest snapshot of OH2.

My problem 

On the 2button wireless switches I cannot get it to “detect” the ch1 button presses ( or when “both” are pressed.) -only the “ch2” are detected

Both sets of these have the same problem - i dont believe its a hardware issue as the log in the “Mi Home” app logs the button presses.

Any ideas?


18:09:46.354 [INFO ] [smarthome.event.ChannelTriggeredEvent] - mihome:86sw2:158d000128f1a3:ch2 triggered SHORT_PRESSED

Hi @greg, it’s a known issue - see this thread.

Hi thereXiaomi technician told me that the bug be found! they will publish the new firmware resolve it next week! maybe the version will be 1.4.1_149.0150, PLS be patienthappy automating.

1 Like

Hello kubawolanin,

Thanks for the good work!, I can confirm that the Smoke sensor comes Online in PaperUI, now to test if it works start a fire in my house! :stuck_out_tongue: or wait for one off my many chinese gadgets to start smoking by itself :joy:

The Water sensor is not detected, have to test some more to see whats the problem, it was detected by Mi Home App, but an actual test (put it on a saucer of water) gave no alarm!, Hmmm thats not what you want, i’ll test some more and will report back
Ray

Hi @X-Ray181, thank you for initial testing!

I suspect that it’s a matter of Gateway firmware, just like this bug with 82SW2 wired switch.
@wars managed to trace the logs with Wireshark, but the Gateway doesn’t expose these messages though API, I think.

Hopefully they’ll provide support (and documentation) for more devices in the near future :slight_smile:

I have the previous firmware, I don’t update if i’m not sure that its an improvement or I need it. if it aint broke, don’t fix it! :stuck_out_tongue_winking_eye:

Testing with the smoke sensor: Seems to work, when i short push the test button on the smoke sensor, i hear the little chinese lady thats stuck in my gateway and a beep, when i long press the test button i hear beep, beep, beep and see the “Smoke Detected” channel in PaperUI switch from off to on and back off again.
And making a simple rule works:

// Smoke & Gas Detector Rule

rule "Smoke Detector Rule"
when
Item SmokeAlarm_HW changed to ON
then
sendCommand(iBox_Office_Switch, ON)
end

1 Like

ok, the last one, was all good news, however the “Status” channel doesn’t seem to work, it gives “unknown”

image
in my openhab.log i get:
2017-09-03 11:52:47.941 [WARN ] [home.handler.XiaomiSensorBaseHandler] - Channel mihome:smoke:158d0001576b5b:status does not exist
But it does:
image

Will look at this, thanks!
@dimalo maybe you’ll throw any ideas too? :slight_smile:

Ok -cool - thanks for the info!

Thanks for programming part. I’m on holiday atm, so I’ll test everything within 2 days. I hope the smoke detector also arrived :slight_smile:

@kubawolanin
Many thanks for your work. Would you be able to implement many of the other features of the gateway such as Arm, play radio, set volume for various options?

I’d love to :slight_smile: The thing is that we (@pboos, @dimalo, @Ondrej_Pecta, @danielwalters86 and others) rely on the rough documentation written in Chinese to implement all those things. (see the repository of it).

Everything that was documented there regarding the MiHome suite is already implemented in the binding.

Sometimes people like @wars provide more details needed for reverse-engineering, like the Wireshark logs.
But on the flip side, if Gateway firmware doesn’t provide you a valid API that’s exposed, there’s not much we can do.

Maybe someone could Wireshark the traffic of a Gateway for play/pause radio action? :wink:

Thanks for the clarification. I can certainly try and see if I can get something useful. I’d love to contribute :slight_smile:

I’ve downloaded the snapshot you referenced in your post above into the addons folder then used the OH console to bundle:update the default 2.1 binding with this one and confirmed that I now have 2.2 as the active one and the 2.1 as Installed but OH doesn’t seem to find the Aqara motion sensor. Am I doing anything wrong?

Further to my last post. I’ve managed to add the “thing” for the motion sensor manually but noticed that the door/window sensor stopped reporting the “closed” status. It only shows “Open” when the door is opened but not “Closed” after it’s been closed. I checked the Mi Home app and it shows the correct status.