Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

HS105 Support #28

Closed
ShayBox opened this issue May 14, 2019 · 2 comments
Closed

HS105 Support #28

ShayBox opened this issue May 14, 2019 · 2 comments

Comments

@ShayBox
Copy link

ShayBox commented May 14, 2019

It's a "newer version" of the HS110, but without power usage monitoring, its just an outlet/switch

EDIT: I guess it's exactly like a HS100, could probably just extend that.

{
	fwVer: '1.5.4 Build 181224 Rel.092927',
	deviceName: 'Smart Wi-Fi Plug Mini',
	status: 1,
	alias: 'Light',
	deviceType: 'IOT.SMARTPLUGSWITCH',
	appServerUrl: 'https://use1-wap.tplinkcloud.com',
	deviceModel: 'HS105(US)',
	deviceMac: '<Removed>',
	role: 0,
	isSameRegion: true,
	hwId: '<Removed>',
	fwId: '00000000000000000000000000000000',
	oemId: '<Removed>',
	deviceId: '<Removed>',
	deviceHwVer: '1.0'
}

I'm unsure what information is sensitive so if you need one of the things I removed let me know

Also, unrelated but would you know how the devices stream data to the api?
Do the devices constantly upload their usage to the api, or do they poll the api, and when the api tells them it needs the data, the device then uploads its data, or does it somehow connect to the device to get its data.
I'm trying to create my own api that I can set the device to use instead of tplinks, and then I wouldn't need my overdone system I have right now of:
Device > TPLink API > My API > Client
it would be closer to:
Device > My API > Client

EDIT: After some investigating it turns out it checks the site, though possible it would be outside of my reach to pull this off, I will either just stick to polling tplinks cloud api every second or setup a pi to be a reverse proxy for the device, with authentication for me.
image

@PrabhanshuAttri
Copy link

Hi

See this, if this works for you as well #35

@adumont
Copy link
Owner

adumont commented Jun 6, 2020

Hi @ShayBox,

Have you tried the HS100 type? It might work without any modification.

In the example, change "my plug" in let myPlug = tplink.getHS100("my plug"); with the alias of your HS105:

require('dotenv').config()
const { login } = require("tplink-cloud-api");
const uuidV4 = require("uuid/v4");

// define these 3 variables in your .env file
const TPLINK_USER = process.env.TPLINK_USER;
const TPLINK_PASS = process.env.TPLINK_PASS;

// you can optionally define this one, or it will get a value
const TPLINK_TERM = process.env.TPLINK_TERM || uuidV4();

async function main() {
    // log in to cloud, return a connected tplink object
    const tplink = await login(TPLINK_USER, TPLINK_PASS, TPLINK_TERM);
    console.log("current auth token is", tplink.getToken());

    // get a list of raw json objects (must be invoked before .get* works)
    const dl = await tplink.getDeviceList();
    console.log("DeviceList:", dl);

    let myPlug = tplink.getHS100("my plug");
    console.log("deviceId:", myPlug.getDeviceId());

    //let response = await myPlug.powerOn();
    //console.log("response=" + response );

    let response = await myPlug.toggle();
    console.log("response=" + response);

    response = await myPlug.getSysInfo();
    console.log("relay_state=", response.relay_state);
}
  
main();

@ShayBox ShayBox closed this as completed Oct 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants