Frans-Willem / AqaraHub

AqaraHub is an open-source Zigbee hub for Xiaomi Aqara devices. It aims to be a replacement to the Xiaomi Gateway that does not require communication to outside servers, and uses a saner communication option (e.g. MQTT).
252 stars 34 forks source link

how to control zigbee via mqtt? #48

Closed pyxiscloud closed 5 years ago

pyxiscloud commented 5 years ago

Hello I've read https://github.com/Frans-Willem/AqaraHub/blob/master/documentation/mqtt-topics.md but still can't control zigbee devices for example i've sent to topic AqaraHub/00158D0001A35845/1/out/OnOff/OnOff value 0 or 1 please share the logic for topic and value forming? thank you

Frans-Willem commented 5 years ago

Hi, Try sending {"command": "On"} to AqaraHub/00158D0001A35845/1/out/OnOff.

Or (haven't checked this one) send {} (or just an empty string) to AqaraHub/00158D0001A35845/1/out/OnOff/On.

There are some more commands you can send to the OnOff cluster listed here. I believe On, Off, and Toggle don't take arguments, but the others might, and they've not yet been filled in in the clusters.info file, if you really wanted to you can look up the Zigbee Cluster Library reference online.

Let me know if this helps, and let's leave this topic open as a reminder for me to update the documentation :)

pyxiscloud commented 5 years ago

Thank you! It's works!)

Can I get list of paired devices?

Frans-Willem commented 5 years ago

I'm not 100% sure, but I believe that's not possible. AqaraHub leaves the pairing up to the USB dongle you're using, and I didn't find any methods of listing the paired devices...

pyxiscloud commented 5 years ago

If this will help - I've found in zigbee-shepher this API https://github.com/zigbeer/zigbee-shepherd/wiki#API_list Also it has remove() method

Frans-Willem commented 5 years ago

AqaraHub differs from Zigbee Shepherd in the fact that AqaraHub keeps no local state, and counts on the USB dongle to keep state (and track of the network), whereas Zigbee Shepherd keeps track of these kinds of things in a local database. So yeah, Zigbee Shepherd has a list function that will query it's own database, but AqaraHub has to rely on whatever the USB dongle exposes, and the USB dongle doesn't expose this functionality.

pyxiscloud commented 5 years ago

OK, understand, thank you! is there any command to get status for sensors or plugs/lights?

andrei-trybukhouski commented 5 years ago

Hi, Try sending {"command": "On"} to AqaraHub/00158D0001A35845/1/out/OnOff.

Or (haven't checked this one) send {} (or just an empty string) to AqaraHub/00158D0001A35845/1/out/OnOff/On.

both methods works! thank you!