TP-Link WiFi Switches
Posted: Mon Nov 07, 2016 10:08 pm
I've just put a couple TP-Link HS110 WiFi-controlled switches into use. They're Echo-accessible so I figure it wouldn't be too tough to create native Indigo support?
Software Support and Home Automation Forum
https://forums.indigodomo.com/
Usage
./tplink-smartplug.py -t <ip> [-c <cmd> || -j <json>]
kg23 wrote:Dumb Question. How do you determine the ip address of the TP-Link switch for use in the command-line script?
- Code: Select all
Usage
./tplink-smartplug.py -t <ip> [-c <cmd> || -j <json>]
{
"system": {
"get_sysinfo": {
"err_code": 0,
"sw_ver": "1.2.5 Build 171206 Rel.085954",
"hw_ver": "1.0",
"type": "IOT.SMARTPLUGSWITCH",
"model": "HS110(US)",
"mac": "50:C7:BF:00:40:51",
"deviceId": "8006E9DC881A5D7A3227882E4D3B0B7616C73011",
"hwId": "60FF6B258734EA6880E186F8C96DDC61",
"fwId": "00000000000000000000000000000000",
"oemId": "FFF22CFF774A0B89F7624BFC6F50D5DE",
"alias": "GK",
"dev_name": "Wi-Fi Smart Plug With Energy Monitoring",
"icon_hash": "",
"relay_state": 0,
"on_time": 0,
"active_mode": "none",
"feature": "TIM:ENE",
"updating": 0,
"rssi": -65,
"led_off": 0,
"latitude": 30.157556,
"longitude": -95.501769
}
}
}
ChopOMatic wrote:How do I extract the value for just the relay_state?
results['system']['get_sysinfo']['relay_state']
#!/bin/sh
python tplink_smartplug.py -t 10.0.0.26 -c info
ChopOMatic wrote:All I want to do is populate an ON or OFF status in Indigo.
#import json
# do the http request
reply = requests.get('python tplink_smartplug.py -t 10.0.0.26 -c info')
# convert the text result to Python dictionary
data = json.loads(result_json)
# extract the state
state = data['system']['get_sysinfo']['relay_state']
# update the variable (put in the correct variable ID)
indigo.variable.updateValue(1234567, value=state)