-
Notifications
You must be signed in to change notification settings - Fork 128
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
Support HS300 Power Strip #131
Comments
I suggest you fork and start working on it. From here on, I see two approaches for development:
I'm in favor of approach 1, to isolate the changes to the new class, and not mess with the SmartPlug code. It's also possible that Let's wait for @rytilahti to give his opinion as well :-) |
What a nice device, just exactly what I have been looking for (a power strip with energy consumption)! The price is a bit steep, but I hope they will release this soon to european markets, too. The option 1 is definitely the preferred one. Furthermore I think this new For discovery I think it makes sense to use the "children" or "child_num" key (in If you have any questions or encounter any problems with the implementation, please feel free to ask! |
Thanks both of you. Yes, it's a nice device, and to me the price is justified for 6 smart plugs. Personally I just wish the usb port power could be controlled as well to power my RPi's and allow remote reboot if they are hung. Yes, I agree SmartPowerStrip is a new class, but I was wondering if it should be a more generic name like MultiSmartPlug which could support the HS107 as well that has 2 plugs? BTW, I'm planning to use this for an ISY Node Server for https://github.com/UniversalDevicesInc/polyglot-v2 Thanks again, hopefully will have time this weekend. |
Please also add a fake output to fakes.py and create tests for that :-) |
I'm working on this now, I fixed discovery, but I am running into some trouble with my network getting a wire shark capture of the queries for turning on/off an individual outlet. Would anyone happen to have a capture available? |
Got individual outlet control working (with some dirty code). I pushed it to a dirty branch here: https://github.com/newAM/pyHS100/tree/dirty Plug index is not integrated into the CLI, but the functions work. I still need to get a capture for the individual outlet energy monitoring, but I imagine it is a similar JSON call. |
Nice! I'll try it out tomorrow. |
Did a basic check of emetering, it's uses the same notation for indexing the outlets as setting the relay state.
I added an index to the CLI for power on/off, so that works for basic functionality tests. I probably wont be able to do a proper implementation & pull request for a couple weeks, so if anyone else can get it done sooner please go ahead :D |
I'll try to get time to look at it, did everyone want to call it smartstrip? I had said in a previous comment; I was wondering if it should be a more generic name like MultiSmartPlug which could support the HS107 as well that has 2 plugs? and @rytilahti had given 👍 |
Smartstrip sounds better to my ear than MultiSmartPlug, and furthermore the names are relevant only for developers, so I don't see a big problem with reusing that for HS107. |
no problem, sounds better to me as well, just wanted to make sure. |
I've merged your dirty branch to mine. The device state starts plug index at 1, but turning on excepts zero based. Seems that starting with 1 makes the most sense?
|
For now I've changed it to use 1-6 we can keep it that way, or make it 1-6 for cli and 0-5 for api access? emeter is also working.
|
Nice job with the emeter! There's no good answer for the 0 index or 1 index problem... You can see I was conflicted with it. On one hand zero index makes more sense programmatically, on the other hand the physical device is labeled 1-6. The HS107 is also physically indexed at 1. |
Thanks, your trail blazing made it easier. I'm conflicted as well so not sure. Also I was wondering if the get_id_by_index should be handled in smartdevice otherwise we have to add a bunch of methods in smartstrip and call super with the id. |
Yeah - that's a better solution to put it there. I imagine the same child selection structure will be used for future TP-Link devices. |
Do you mind rebasing on top of the current HEAD and creating a WIP pull request for this already? I will then do a brief initial review on it. |
Hope I did it correctly, still not a git expert #137 |
* discover runs, prints on since of device 0 * added preliminary support for HS300 * forgot to add smartdevice to commit * added index to CLI * clean up dirty code * added fake sysinfo_hs300 * changed device alias to match MAC * #131 Move _id_to_index into smartstrip so everyone can pass index * Update pyHS100/discover.py Co-Authored-By: jimboca <jimboca3@gmail.com> * refactoring to deduplicate code between smarplug and smartstrip * fixing CI failures for devices without children * incorporating feedback from pull request. * fixing hound violation * changed internal store from list of dicts to dict * changed other methods to dictionary store as well * removed unused optional type from imports * changed plugs to Dict, remove redundant sys_info calls * added more functionality for smart strip, added smart strip tests * updated FakeTransportProtocol for devices with children * corrected hound violations * add click-datetime
* discover runs, prints on since of device 0 * added preliminary support for HS300 * forgot to add smartdevice to commit * added index to CLI * clean up dirty code * added fake sysinfo_hs300 * changed device alias to match MAC * GadgetReactor#131 Move _id_to_index into smartstrip so everyone can pass index * Update pyHS100/discover.py Co-Authored-By: jimboca <jimboca3@gmail.com> * refactoring to deduplicate code between smarplug and smartstrip * fixing CI failures for devices without children * incorporating feedback from pull request. * fixing hound violation * changed internal store from list of dicts to dict * changed other methods to dictionary store as well * removed unused optional type from imports * changed plugs to Dict, remove redundant sys_info calls * added more functionality for smart strip, added smart strip tests * updated FakeTransportProtocol for devices with children * corrected hound violations * add click-datetime
Would like support for the Power Strip:
https://www.tp-link.com/us/products/details/cat-5516_HS300.html
Discover currently fails:
Because on_time is down inside children:
This is the only device I have. I can fork and work on it, but may need some guidance on how a multi-plug device should be handled.
The text was updated successfully, but these errors were encountered: