Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial support for xiaomi gateway devices #470

Merged
merged 7 commits into from
Mar 16, 2020
Merged

Initial support for xiaomi gateway devices #470

merged 7 commits into from
Mar 16, 2020

Conversation

rytilahti
Copy link
Owner

@rytilahti rytilahti commented Jan 30, 2019

This adds preliminary support for Xiaomi Aqara gateway devices. Currently implemented interfaces include controlling the alarm and the light facilities, as well as some other miscellaneous features.

Thanks to @approximatenumber and @starkillerOG for pushing to make this happen 🎉


This has been rotting on my computer for over a year, so I thought I'd just push this up in case someone wants to work on it - personally I'm not going to do that as I'm using zigbee2mqtt to control my xiaomi devices. The code does not work without modifications, but gives at least a starting point to build upon.

Related to home-assistant/core#20294

miio/gateway.py Outdated Show resolved Hide resolved
miio/gateway.py Outdated Show resolved Hide resolved
miio/gateway.py Outdated Show resolved Hide resolved
miio/gateway.py Outdated Show resolved Hide resolved
miio/gateway.py Show resolved Hide resolved
miio/gateway.py Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Jan 30, 2019

Coverage Status

Coverage decreased (-1.2%) to 72.902% when pulling 175830d on gateway into f0d4565 on master.

@approximatenumber
Copy link
Contributor

approximatenumber commented Jan 31, 2020

Great job! Yesterday I was upset about unsupported gateway and decided to write my own bindings, but it's cool that I've found a ready to use solution :)
This PR have to be reviewed and merged, I vote!
Added some light stuff for gateway: #624

@starkillerOG
Copy link
Contributor

@rytilahti can this be merged?
Or schould I try to clean it up a bit more, or do you have time to clean it up?

@rytilahti
Copy link
Owner Author

I'm waiting for #634 to be merged before doing the next (0.50!) release, just to avoid pushing two releases out in so short order. I'm hoping it will be done soon enough, but feel free to add cleanup PRs if you like! Otherwise I will do it when we are nearing the release.

rytilahti and others added 6 commits March 15, 2020 17:14
* added color and brightness functionality

* added command to set both color and brightness

* linting fixes
* add new line

* remove To Do comment

Since this does not have to do with the gateway (I think)

* Fully finish the GatewayAlarm class

* black fix styles

* fix hound issue

* flake8 was wrong, black is wright

* ignore flake8 E203 error since black handles that

* Turning --> Turn

Co-Authored-By: Teemu R. <tpr@iki.fi>

* Turning --> Turn

Co-Authored-By: Teemu R. <tpr@iki.fi>

* add type return

Co-Authored-By: Teemu R. <tpr@iki.fi>

* add flake8 exception for single line

* remove global flake8 ignore

* add extra space

* add return types

* fix return types

* datatime.datetime is unknown type

* remove print()

* Reorganize classes

* Use parent and improve init

* Add Xiaomi Aqara Gateway to readme

Co-authored-by: Teemu R. <tpr@iki.fi>
@rytilahti rytilahti changed the title WIP: Initial support for xiaomi gateway Initial support for xiaomi gateway Mar 15, 2020
@rytilahti rytilahti changed the title Initial support for xiaomi gateway Initial support for xiaomi gateway devices Mar 15, 2020
@rytilahti
Copy link
Owner Author

rytilahti commented Mar 15, 2020

@approximatenumber I moved the light controls underneath a "subdevice" accessible under light property.

@starkillerOG do you mind giving this a test and say OK if the functionality you want is still working and we can merge this now? I did some cleanups, but nothing that should break the alarm interfaces.

@starkillerOG
Copy link
Contributor

@rytilahti thanks, looks good!
I will test it tommorrow and let jou know

@hoangphison
Copy link

hello @rytilahti
does this PR will support aqara homekit gateway?

@rytilahti
Copy link
Owner Author

No idea, to be honest. This was based on some very old code for the first or second gen gateway (with the developer mode to be used with https://github.com/Danielhiversen/PyXiaomiGateway) which was sold in a kit several years ago.

@starkillerOG
Copy link
Contributor

@rytilahti I have just tested the Alarm class and it works perfectly!
Thank you so much for your help!
This PR can now be merged I think.

@rytilahti rytilahti merged commit 83f2ea1 into master Mar 16, 2020
@rytilahti rytilahti deleted the gateway branch March 16, 2020 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants