Danielhiversen / PyXiaomiGateway

PyXiaomiGateway
MIT License
152 stars 55 forks source link

Add support for Xiaomi gateway alarm? #166

Closed starkillerOG closed 4 years ago

starkillerOG commented 4 years ago

I was wondering if it would be possible to add support to turn on/off the alarm on the xiaomi aqara gateway and get the state of the alarm.

I know it is possible using the "Xiaomi's miIO protocol" as implemented by this library: https://github.com/rytilahti/python-miio, also used by homeassistant.

An old HomeAssistant PR already tried to implement it, but it mixed the xiaomi_aqara and the xiaomi_miio platforms I think: https://github.com/home-assistant/home-assistant/pull/20294 Therefore It would be greath if this could be implemented in this library such that it can be integrated in the xiaomi_aqara component and automatically added if you add the hub to your homeassistant configuration.

for now I am using a custom component that works greath, but I would like to see it integrated in the official component: https://github.com/hekm77/homeassistant-config/tree/master/custom_components/xiaomi_gateway_alarm This custom component is bassically an small adaption of Xiaomi Raw: https://github.com/syssi/xiaomi_raw, which in turn uses the already mentioned "Xiaomi's miIO protocol" as implemented by the already mentioned python-miio library.

syssi commented 4 years ago

This is impossible. The Xiaomi Aqara API (LAN protocol) doesn't expose any alarm functionality.

starkillerOG commented 4 years ago

@syssi and you do not want to mix the LAN protocol and "Xiaomi's miIO protocol" in one library?

syssi commented 4 years ago

Correct.

starkillerOG commented 4 years ago

For anyone looking for this in the future: I added support for the Xiaomi Gateway Alarm in the python-miio platform (https://github.com/rytilahti/python-miio). I am also busy with the HomeAssistant official integration of the Xiaomi Gateway Alarm and that schould be finished soon (only waiting on a version push of the python-miio library). https://github.com/home-assistant/core/pull/32091