Open unm4sk1g opened 6 years ago
Can you run the hs100-api details <ip>
(the device's IP) and paste the output? If I keep some example data I can add support.
Will do it tomorrow. Also, what's the minimal version of node required for this library to work?
6.5, as specified in the package.json
Is there something in the lib that requires 6.5 or? Since NAS devices don't support node v6. Also, my colleague took the Wi-Fi Range Extender home so I'll tell him to send the details tonight and I'll put them here.
Now that I'm using babel on this project I may be able to support v4 with minimal changes. I'll see what I can do.
{ sysInfo: { plug: { feature: 'TIM', relay_status: 'ON', on_time: 285025, next_action: { type: -1 } }, err_code: 0, 'rangeextender.wireless': { w5g_client_count: 0, w2g_uplink_time: 128975, w5g_uplink_enabled: true, w5g_rssi: -256, w5g_uplink_time: 0, w2g_mac: '50:C7:BF:C8:5E:DE', w2g_uplink_enabled: true, w2g_downlink_enabled: true, w5g_downlink_enabled: true, w2g_client_count: 0, w5g_uplink_connected: false, w2g_rssi: -73, w5g_mac: '50:C7:BF:C8:5E:DD', w2g_uplink_connected: true }, system: { ethernet_mac: '50:C7:BF:C8:5E:DE', type: 'IOT.RANGEEXTENDER.SMARTPLUG', oemId: 'A4551BD7CF274B28C532A79E87B9FFB5', icon_hash: '', system_time: 1506983062, updating: false, deviceId: '801773997DCEC2F8134A9673D74C296318C860BA', sw_ver: '1.1.8 Build 20170317 rel.37472', hwId: '5AC4CF9E3183C16825EB28BC3C27059C', longitude: 17.79082, led_status: 'ON', model: 'RE270K(EU)', hw_ver: '1.0.0', latitude: 43.351783, alias: 'Hi-fi', dev_name: 'AC750 Wi-Fi Range Extender with Smart Plug' } }, cloudInfo: { err_msg: 'method not support', err_code: -1 }, consumption: { err_msg: 'method not support', err_code: -1 }, scheduleNextAction: { err_msg: 'method not support', err_code: -1 } }
There's the data for RE270K
I was able to configure babel and get this working on node 4.8 (will release a version of hs100-api soon). It looks like TPLINK keeps slightly tweaking the API for each device, I would need to know the commands that are sent to control it.
This is how to control HS* devices:
{"system":{"set_relay_state":{"state":1)}}}}
I noticed that RE270K they have moved sys_info.system.relay_state
to sys_info.plug.relay_status
. Without having a dump of the network traffic its hard for me to know which commands to send to control it.
You could try running different versions of the command to see if any work:
hs100-api send <ip> '{"system":{"set_relay_status":{"state":1)}}}'
hs100-api send <ip> '{"plug":{"set_relay_status":{"state":"ON")}}}'
hs100-api send <ip> '{"plug":{"set_relay_state":{"state":1)}}}'
hs100-api send <ip> '{"plug":{"set_relay_state":"ON"}}'
hs100-api send <ip> '{"system":{"plug":{"set_relay_state":{"state":1)}}}}}'
hs100-api send <ip> '{"system":{"plug":{"set_relay_status":{"state":1)}}}}}'
hs100-api send <ip> '{"system":{"plug":{"set_relay_status":{"status":1)}}}}}'
hs100-api send <ip> '{"system":{"plug":{"set_relay_status":{"status":"ON")}}}}}'
etc...
If you find anything let me know!
If you or anyone else with access to that model could dump the traffic I can add updates to support it. Here's an example: https://github.com/softScheck/tplink-smartplug
I used your sysinfo
and my simulator to try to mimic your device and spy on the Kasa app traffic. One thing this device does different is Kasa tries to login to the router. That is where I hit a roadblock.
/data/LINKIE.json
with {"smartlife.common.system":{"get_sysinfo":{}}}
(but "tplink" encrypted), this is not something done with the other plugs/bulbs.So this is where I'm stuck. I'm not sure what Kasa is expecting when it sends that POST. If I knew whatever authorization its doing I could maybe replicate.
If anyone has any more info please let know!
My colleague (who owns this model) is out of country until Wednesday, so nothing until then.
I tried also to reach it, but in another way.
Assume 192.168.1.1
is the ip address of your RE270K
I first configured the plug via the Kasa app with particular password. Afterwards I logged in via /data/json.html
and observed the developer console's network log of chrome, where I found the provided formdata and my password but somehow encrypted.
POST http://192.168.1.1/data/login.json
with following Header:
Content-Type:application/x-www-form-urlencoded
and following Form-Data:
operation:login
encoded: admin:<pw-somehow-encrypted>
nonce:
In the response you get a Cookie, which may help you contact the endpoint anew, but this time to get the specs or turn the plug on/off.
Unfortunately, I have not more information than that. Maybe someone else has an idea how to contact the smartplug endpoint (different from the webinterface for configuring the wifi extender).
The only way I could get it to work in SmartThings was to use IFTTT to turn on / off and the standard commands to get the status. Better than just using IFTTT (since you get a return status). I am still looking for a full solution (I want it for the Hubitat Enviroment UDP control.)
I'm wondering if this Wi-FI Range Extender + SmartPlug is supported? Using setPowerState doesn't work. Also._type property is device and alot of stuff differs from standard plug or bulb.