miio
miio copied to clipboard
Toggle Alarm of Xiaomi gateway
Hi, I'm trying the library for making a custom project with my Xiaomi devices. I have a Xiaomi Gateway and I'd like to toggle on and off the Alarm of Xiaomi Gateway. Any suggestion about it? I can build the functionality by myself but some tips will help me a lot.
Thank you
Hi! This sounds like a great feature to add. To start it would help if you could create a Wireshark-capture and look at the commands that the Mi Home apps send. The documentation under Protocol and commands should help with getting you started.
This might help (extract from my node-red plugin, I'm switching from these manually handled gateways to miio, but also need sound playback):
- command to play sound on the gateway: https://github.com/pierrecle/node-red-contrib-mi-devices/blob/master/node-red-contrib-xiaomi-actions/xiaomi-actions.js#L103
- sounds ids: https://github.com/pierrecle/node-red-contrib-mi-devices/blob/master/node-red-contrib-xiaomi-actions/xiaomi-actions.html#L283
- stop and custom sounds: https://github.com/pierrecle/node-red-contrib-mi-devices/blob/master/node-red-contrib-xiaomi-actions/xiaomi-actions.html#L322
@pierrecle Thanks for the links! Support for alarm sounds are coming, I looked into it just before I saw your links. Just need to figure out the best way to map it. Will probably get around to it this weekend or in the beginning of next week.
@aholstenson
It seems this did not make it into the 0.15.x rebuild. Is this still on your roadmap? And would it be possible to also add functionality to switch the light on/off (cap:power) and change it's color (cap:colorable) and brightness (cap:dimmable).
@jghaanstra It is, short on time for everything right now though so can't give any estimates on when it'll be done.
But, the functionality of the gateway light is exposed as subdevice of the gateway today, with full support for the power, brightness and colors. I think you can access it via gateway.child('light')
if you want to get it from the gateway, otherwise by default it and the sensors connected to the gateway are made available as devices using miio.devices()
.
Right, never thought of looking at the child devices for this functionality. Seems to be exactly what I was looking for. No worries about any estimates for the alarm, it's done when it's done. I know how it goes.
FYI Query the status: {"id":65005,"method":"get_arming","params":[]} {"result":["off"],"id":65005}
Query the wait time: {"id":65006,"method":"get_arm_wait_time","params":[]} {"result":[5],"id":65006}
set arming: {"id":65013,"method":"set_arming","params":["on"]} {"result":["ok"],"id":65013}
set arming off: {"id":65014,"method":"set_arming","params":["off"]} {"result":["ok"],"id":65014}
Thank you @xcray 👍 That's only for enable and disable the build in "alarm system", isn't it? Any way to trigger an alarm without a Xiaomi sensor? I for example only have hue sensors.
Thanx for the commands. Toggling the alarm state is not that hard to add to the miio library but to do this properly the abstract things library which is used by the miio library needs to be expanded with a alarm capability. This is beyond my skills.
It seems @aholstenson does not have time to maintain this library anymore though.
You can use this CLI command to enable or disable alarm :
miio protocol call <id> set_arming '["on"]'
miio protocol call <id> set_arming '["off"]'
I tried but is still block without answer
C:>miio protocol call 87635042 set_arming '["off"]' INFO Attempting to call set_arming on 87635042 INFO Device found, making call
and then nothing. Any idea?
Hi,
Thanks for this good lib 👍
Question regarding security features. Can we have a way to get the status of the alarm like gateway has trigger alarm.
For eg, I want to run a script if the alarm is triggered by some sensors to send to me SMS of Pushbullet notifications.
Thanks
Hi, there is a homebridge plugin support this: https://github.com/YinHangCode/homebridge-mi-gateway-security It would be nice to support the feature in miio though, even better if miio can send notification when the alarm is triggered :)
Any chance the alarm ringtone and doorbell sound will be supported in the near future? FYI Domoticz has these features implemented: https://github.com/domoticz/domoticz/blob/development/hardware/XiaomiGateway.cpp Maybe something to look into? Thanks!
Hi,
I started to develop the alarm feature but I failed to add the different tests and stuff to get a successfull merge request.
https://github.com/toribola/home-assistant/blob/dev/homeassistant/components/xiaomi_aqara.py https://github.com/toribola/home-assistant/blob/dev/homeassistant/components/alarm_control_panel/xiaomi_gateway.py
Hope that it will be added in a near future !
Regards,