-
Notifications
You must be signed in to change notification settings - Fork 43
Any support of HS300 in the future? #27
Comments
I understand the HS300 is a strip of 6 independant plugs. How do you see it in the Kasa App? I mean can you set for example an alias for each of the 6 plug? |
There are 6 of them in the app with individual switch and energy monitor data. In the app, you can set alias names for each outlet. I'm not able to see a way to change the alias for the strip itself via the app. When I use the |
I am supporting the addition of HS300 support to this amazing library! Is there anything we owners of H300 can do to help with getting HS300 supported, short of doing the actual coding (which is beyond me right now)? |
In |
Adding some additional info here for if you ever get around to it. Here's what a hit to get the
It shows as a single device, the 6 port switch. The relay status method,
I suspect there's an additional endpoint to provide those |
Nevermind, simply using the |
Hi,
Thanks for the info.
This week-end I added support to retrieve a device by its deviceId (before
that, you could only get it by its alias).
You might be able to use:
response = await myPlug.getSysInfo();
to get the same output you got with all the info of the children plugs.
Then, can you test something like that?
let myPlug1 = tplink.getHS100("8006070807D6C11B3D3B5B61455944531BF7C62200");
let response = await myPlug1.toggle();
and see if that works?
(Anyway I see all the children also have an alias, so you might be able to
also use that directly?)
Does it work if you also try with the alias, instead of the deviceId?
I mean:
let myPlug1 = tplink.getHS100("Plug 1");
let response = await myPlug1.toggle();
…--
Alex
On Mon, Jun 8, 2020 at 12:53 AM atkinsj ***@***.***> wrote:
Nevermind, simply using the id field of the individual ports in the usual
plug on/plug off method works just fine.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#27 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACRLWSXE34BDBMIVNN4YNDRVQK6RANCNFSM4G6XHDLQ>
.
|
So turns out I spoke too soon. The children device ID's don't work with any of the standard plug commands, issuing the usual |
TLDR:
Alright, I got to the bottom of this. For anyone curious I spun up the Kasa app in an Android emulator and used Frida to hook like below:
This prints the JSON body of every request the application sends. The application is actually sending quite a bit more detail than this API and the documentation on your blog so they could easily detect non-application usage, I don't think it's overly important though. Here's the full request body for switching off port 6 on my HS300. You don't need this, the minimum TLDR at the top works.
|
Thank you very much for the help. This Frida method might definitely prove useful. I'll have a look at what you send when I get some time. BTW Anyone is welcome to contribute if they feel up to it, don't hesitate to send a Pull Request when you have something working so I can merge it in the NPM module. |
@atkinsj , in your TL;DR, what is "source":"redacted client id" ? What does it represent here? Is it a required parameter or does it still work if you omit it? |
It's the application client ID, the uuid4 that you generate. It works when omitted. |
I don't have a HS300, but I have tried with all the stuff here to come up with something. It might work, or not... If anyone wants to try, it's in the releases: https://github.com/adumont/tplink-cloud-api/releases/tag/v0.6.2-next.0 (2ab601c) you could try with:
don't hesitate to try all the methods of hs300child (see https://github.com/adumont/tplink-cloud-api/blob/v0.6.2-next.0/lib/hs300child.ts) and report if there any failure or success. :) |
Sorry, just realized I've left some bogus data in the code, so don't bother to test it, it will fail :(. I'll have to remove it, repack and upload a new alpha release later when I find some time. |
Hopefully I have fixed the package, and you should be able to test if for HS300 support. You can download it from: https://github.com/adumont/tplink-cloud-api/releases/tag/0.6.2-next.2 , and test with code like the one I put in my comment above. |
Were you able to test the version I posted? Hopefully it should work for
the HS300 (and support childs).
--
Alex
…On Wed, Jun 10, 2020 at 2:34 AM atkinsj ***@***.***> wrote:
It's the application client ID, the uuid4 that you generate. It works when
omitted.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#27 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACRLWTD74632HSD33ZJZELRV3ILDANCNFSM4G6XHDLQ>
.
|
@adumont I've been using your repo for a project and the child logic you wrote up has been working for me. I haven't tested your code directly, as I've been porting your logic over to Python 3, but it worked in the ported code. Also, if you could use someone to run some tests on other device types, I have a number of Kasa models I'm using and would gladly help to contribute. (HS103, HS105, HS300) |
@piekstra Could you try the HS300 support in this version https://github.com/adumont/tplink-cloud-api/releases/tag/0.6.2-next.2 ? (see example code a few comments above, in #27 (comment)) |
@adumont async function doThings() {
const { login } = require("../tplink-cloud-api-0.6.2-next.2");
const tplink = await login("redacted@email.com", "redacted");
// get a list of raw json objects (must be invoked before .get* works)
const dl = await tplink.getDeviceList();
console.log("DeviceList:", dl);
let powerStripName = "TP-LINK_Power Strip_0AB1"
let powerStrip = tplink.getHS300(powerStripName);
let children = await powerStrip.getChildren();
console.log("Children of ", powerStripName, " : ", children)
let child5 = powerStrip.getChild("Test 5");
console.log("child5 response: ", child5);
let powerOnResult = await child5.powerOn();
console.log("powerOnResult: ", powerOnResult)
let powerOffResult = await child5.powerOff();
console.log("powerOffResult: ", powerOffResult)
console.log("getSysInfo: ", await child5.getSysInfo() );
}
doThings(); It successfully read the data and also turned the individual plug on and back off |
I get back the device which is a PowerStrip in the device list. However, the object does not include an array of the underlying outlets. I understand this package doesn't include this device, just wanted to ask. I removed pertinent private values from the below JSON.
{ fwVer: "1.0.10 Build 190103 Rel.163517" deviceName: "Wi-Fi Smart Power Strip" alias: "TP-LINK_Power Strip_CDD2" appServerUrl: "https://use1-wap.tplinkcloud.com" deviceHwVer: "1.0" deviceId: "" deviceMac: "" deviceModel: "HS300(US)" deviceName: "Wi-Fi Smart Power Strip" deviceType: "IOT.SMARTPLUGSWITCH" fwId: "" fwVer: "" hwId: "" isSameRegion: true oemId: "" role: 0 status: 1 }
The text was updated successfully, but these errors were encountered: