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

Added support of Aqara Wireless Relay 2ch (LLKZMK11LM) #696

Merged
merged 5 commits into from
May 15, 2020
Merged

Added support of Aqara Wireless Relay 2ch (LLKZMK11LM) #696

merged 5 commits into from
May 15, 2020

Conversation

bskaplou
Copy link
Contributor

@bskaplou bskaplou commented May 15, 2020

Found commands here => https://github.com/igzero/xiaomigateway

Works as follows:

$ miiocli gateway --ip 192.168.2.109 --token XXXX devices
Running command devices
[<Subdevice DeviceType.Cube: lumi.158d000103ec74 fw: 3 bat: 60>, <Subdevice DeviceType.SensorHT: lumi.158d00040e2330 fw: 2 bat: 60>, <Subdevice DeviceType.Cube: lumi.158d00010202de fw: 3 bat: 60>, <Subdevice DeviceType.Unknown62: lumi.158d000429d96f fw: 5 bat: 60>, <Subdevice DeviceType.AqaraHT: lumi.158d000465ade7 fw: 3 bat: 60>, <Subdevice DeviceType.Unknown15: lumi.158d0003f0d874 fw: 1 bat: 60>, <Subdevice DeviceType.Unknown54: lumi.158d0004454133 fw: 36 bat: 60>]
$ miiocli gateway --ip 192.168.2.109 --token XXXX relay_get_state lumi.158d0004454133 first
Running command relay_get_state
on
$ miiocli gateway --ip 192.168.2.109 --token XXXX relay_toggle lumi.158d0004454133 first toggle
Running command relay_toggle
ok
$ miiocli gateway --ip 192.168.2.109 --token XXXX relay_toggle lumi.158d0004454133 second on
Running command relay_toggle
ok
$ miiocli gateway --ip 192.168.2.109 --token XXXX relay_get_load_power lumi.158d0004454133
Running command relay_get_load_power
0.06

@coveralls
Copy link

coveralls commented May 15, 2020

Coverage Status

Coverage increased (+0.02%) to 74.224% when pulling c3675cf on bskaplou:aqara2chrelay into 5bedab1 on rytilahti:master.

@bskaplou
Copy link
Contributor Author

bskaplou commented May 15, 2020

By the way, I see subdevices in code but can't call them

gatewayradio --ip 192.168.2.109 --token XXXX info
Traceback (most recent call last):
File "./build/lib/miio/cli.py", line 48, in
create_cli()
File "./build/lib/miio/cli.py", line 44, in create_cli
return cli(auto_envvar_prefix="MIIO")
File "/Users/bskaplou/github/python-miio.orig/miio/click_common.py", line 59, in call
return self.main(*args, **kwargs)
File "/Library/Python/3.7/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/Library/Python/3.7/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Library/Python/3.7/site-packages/click/core.py", line 1256, in invoke
Command.invoke(self, ctx)
File "/Library/Python/3.7/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Python/3.7/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/Library/Python/3.7/site-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/Users/bskaplou/github/python-miio.orig/miio/click_common.py", line 242, in group_callback
ctx.obj = self.device_class(*args, **kwargs)
TypeError: init() got an unexpected keyword argument 'ip'

Is it expected behavior?

@rytilahti
Copy link
Owner

Hi and thanks for the PR! The error you are seeing with subdevices is not expected, it's just a bug due to lack of testing, feel free to create an issue/PR for that if you like.

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.

A single typo, but otherwise this is ready to be merged.

miio/gateway.py Outdated Show resolved Hide resolved
Co-authored-by: Teemu R. <tpr@iki.fi>
@bskaplou bskaplou requested a review from rytilahti May 15, 2020 14:31
@rytilahti rytilahti merged commit f0d621f into rytilahti:master May 15, 2020
@bskaplou bskaplou deleted the aqara2chrelay branch May 15, 2020 17:55
xvlady pushed a commit to xvlady/python-miio that referenced this pull request May 9, 2021
* Added support of Aqara Wireless Relay 2ch (LLKZMK11LM)

* format

* removed f in strings with no subs

* isort fixing

* Update miio/gateway.py

Co-authored-by: Teemu R. <tpr@iki.fi>

Co-authored-by: Teemu R. <tpr@iki.fi>
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.

3 participants