Have you added a device handler? Having a quick look I appear to be using the one from @dbej (should probably update to @Gutheinz’s one, but I only have sockets at the moment).
My device preferences look like this
EDIT: Sorry - if you’re seeing that, then you must have a device handler. Can you type ping 192.168.1.62 into your command prompt?
Ok, I replaced the one from Gutheinz with the one from dbej and got it working!
How did you setup getting it to start with Windows? I do IT for a living, but getting a bat file to run in task scheduler correctly can be quite a challenge at times:/
Thanks, Ill stick to the one Ive got working. But there is no 2way integration it seems? If I physically push the on/off button on the switch or use Kasa app, Smartthings cant pick it up?
I got them for like 1/3rd of the price of Z-Wave switches, but would be nice to know the status…
OK, it seems it was my fault. I used the wrong device handler version, I reinstalled the one from Gutheinz, and it fixes the stuff you pointed out @jymbob.
I can now control it with his code also. Though I need to manually hit refresh to get the correct status… Any way to fix that?
Polling is calling the refresh command. The frequency is completely controlled by smartthings (i.e., this code does not initiate polling). Is there a way to set the frequency?
I have the same issue - very occasionally. I set the DH as a state machine, where I use a different color/label when it is turning on/off and the state updates to the new state when return data received from the bridge.
When it occurs, I think it us usually the ST server (the command return was sent, etc). There is no log in ST. I have not figured this out. Polling will correct the state miss-match on the next poll, or refresh.
Explicitly what device? Firmware version? DH name?
Below is what the log looks like - indicating a round trip through the server. (This is on version 2.3). Anything else indicate an error in the bridge - device communication.
2017-05-08T12:41:12.887Z
Sending to IP address: 192.168.0.137 Command: {“system”:{“get_sysinfo”:{}}}
Command Response sent to SmartThings!
There are only two other cases possible:
The bulb communications time out. The console message will look like:
and the ST tile will turn orange with the label bulb or plug off line. This means that the TCP command to the TP-Link device timed out - either device is off, offline (known problem with bulbs) or the IP has changed.
The final case is a TCP error (I have never seen this error). Error will display on the console. this is an automatic message; however, I have never seen it. (future update?
In my DH, there is an automatic polling. About every 15 minutes (just re-confirmed by looking at ST events). This DH does not go through the TP-LInk site (not currently feasible), so it knows only it’s own state.
It turns out I’m entirely wrong. I don’t seem to see any polling updates here using Dan’s code. Sorry for the misleading posts.
In other news, one of my switches is the HS-110. If you’ve got any code around getting energy usage out you want testing, let me know. I might have a tinker myself at some point, but right now I have actual work to do!
When you say display energy usage, are you talking about the current energy usage (relatively easy to integrate) or the daily/monthly sums (requires some math functions summing data from bulb). If the first, a relatively easy mod to existing DH. Other, more complex.
I have created a prototype for “Current Power” only. Tested on a bulb, so logic works. Issue will be format of the returned data. The below link is where the groovy file is located. The “TP-LinkServer.js” file is the same as for my Version 2.1, 2.2, and 2.3 systems, so you do not have to run separate node.js app. The read-me has some more info for you.