arachnetech / homebridge-mqttthing

A plugin for Homebridge allowing the integration of many different accessory types using MQTT.
Apache License 2.0
467 stars 104 forks source link

REQUEST: Aqara Magic Cube configuration support #235

Open Vants5150 opened 4 years ago

Vants5150 commented 4 years ago

Hi, is it possible to have the configuration to include the Aqara Magic Cube like a StatelessProgrammableSwitch with programmable "actions" (Tap, shake, Flip 90" etc etc" ) like "press" "Double press" "Long Press" within Home App? Or, if not, is there a way to include the Magic Cube and make it usable in Home App?

Thanks a lot

arachnetech commented 4 years ago

I use the homebridge-mi-aqara with my Aqara devices, so I've not tried to use them with mqttthing personally. There are a couple of Aqara devices in the Wiki which might prove a useful starting point for you: https://github.com/arachnetech/homebridge-mqttthing/wiki/Tested-Configurations#xiaomi-contact-sensor

Vants5150 commented 4 years ago

Hi, thanks for the reply and the advice. I was able to include the Aqara Temp+Hum sensor following the tested configurations and it works. My problem is that the Cube is a sort of switch and I am not able to include it in HomeBridge because I think it requires a particular configuration. Just for make an example, I am able to configure it in Homebridge to "pass" the face number in the battery status (it was just for test) so when cube is on face 5, I see battery status 5%. What I can't understand is if it is possible to assign custom actions to a switch in HomeKit. Example: a button can have 3 actions: "Press", "Double Press", "Long Press" and you can assign automations for every action. Instead of that 3 actions, I want to configure mqttthing to create the Cube object exposing "Tap", "shake", etc etc, in Home App but I can only see Press, Double Press and Long Press. Maybe it is impossible due to Homekit limitation or maybe I am doing something wrong. So I was looking for someone who tried to include the Cube in other ways. Now I have Domoticz managing the Cube using the Zigbee2mqtt hardware plugin+Mqttthing (it works perfect) but I want to manage the Cube directly in HomeBridge, if possible. Thanks for the great job you are doing :)

trave commented 4 years ago

Cube has 9 actions. Home App switch has 3 states - Click, Double, Long.

You can create 3 instances of StatelessProgrammableSwitch for different actions. I.e. one switch for shake, wakeup, fall, one for tap, slide, flip180, and one for flip90, rotate_left, rotate_right using common MQTT topic.