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

Fully finish the GatewayAlarm class and fix style issues #633

Merged
merged 20 commits into from
Mar 6, 2020

Conversation

starkillerOG
Copy link
Contributor

@starkillerOG starkillerOG commented Feb 19, 2020

I have fully tested and varified all functions in the GatewayAlarm class.
I have moved all functions related to the GatewayAlarm out of the Gateway class.
I run black on top of the file to fix lots of styling issues.

This includes everything of PR: #630, so I will close that one.

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

coveralls commented Feb 19, 2020

Coverage Status

Coverage increased (+0.06%) to 71.037% when pulling 647f39d on starkillerOG:patch-2 into 46a1a46 on rytilahti:gateway.

miio/gateway.py Outdated Show resolved Hide resolved
@starkillerOG
Copy link
Contributor Author

@rytilahti could you please merge this PR?
I have cleaned up the Gateway PR a lot in this PR and everythin that has to do with the GatewayAlarm is now included in a seprate class that is fully tested and working.

.flake8.ini 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 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
starkillerOG and others added 4 commits February 19, 2020 22:12
Co-Authored-By: Teemu R. <tpr@iki.fi>
Co-Authored-By: Teemu R. <tpr@iki.fi>
Co-Authored-By: Teemu R. <tpr@iki.fi>
miio/gateway.py Outdated Show resolved Hide resolved
miio/gateway.py Outdated Show resolved Hide resolved
miio/gateway.py Outdated Show resolved Hide resolved
@starkillerOG
Copy link
Contributor Author

@rytilahti all finished, I think I have adressed all improvements you pointed out.
Any more suggestions, or can this be merged?

(only the device class left, schould it be underneath Gateway class or not...)

@starkillerOG
Copy link
Contributor Author

@rytilahti The GatewayAlarm can now be used from the Gateway class.
The following works in python3:

from miio import (Device, gateway)
miio_device = Device("IP_of_the_gateway", 'token_of_the_gateway')
gateway = gateway.Gateway(miio_device)
gateway.alarm.status() #--> response: 'off'
gateway.alarm.on() #--> response: ['OK']
gateway.alarm.status() #--> response: 'oning'
#wait some time
gateway.alarm.status() #--> response: 'on'
gateway.alarm.off() #--> response: ['OK']
gateway.alarm.status() #--> response: 'off'

@starkillerOG
Copy link
Contributor Author

@rytilahti can this now be merged?

@starkillerOG
Copy link
Contributor Author

@rytilahti could you merge this and push to a new version so I can continue with the HomeAssistant PR as refrenced?

Copy link
Owner

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay, if you could make those two changes and update the README to add this device, I think we can merge it as partially supported.

miio/gateway.py Outdated Show resolved Hide resolved
miio/gateway.py Outdated Show resolved Hide resolved
miio/gateway.py Outdated Show resolved Hide resolved
@starkillerOG
Copy link
Contributor Author

@rytilahti no problem!
I made the changes requested and tested the code, it works.
I also added the xiaomi aqara gateway to the readme.

I think this can now be merged.

@rytilahti
Copy link
Owner

Great, thanks 👍 I'll take care of cleaning up the original PR and get it merged for a new release.

@rytilahti rytilahti merged commit 420b659 into rytilahti:gateway Mar 6, 2020
rytilahti added a commit that referenced this pull request Mar 15, 2020
* 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 added a commit that referenced this pull request Mar 16, 2020
* WIP: gateway support thanks to dgi (dustcloud fame) and javascript miio lib

* add set_gateway_volume, slight fixes

* port over to the new cli api, remove MessageNet which was supposed only for testing

* Added more light controls for gateway (#624)

* added color and brightness functionality

* added command to set both color and brightness

* linting fixes

* Fully finish the GatewayAlarm class and fix style issues (#633)

* 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>

* Cleanup gateway for initial release

* fix import sorting

Co-authored-by: Maksim Melnikov <approximatenumber@gmail.com>
Co-authored-by: starkillerOG <starkiller.og@gmail.com>
@starkillerOG
Copy link
Contributor Author

@rytilahti do you know when you will push to a new version of miho?

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.

4 participants