TP-Link/Kasa Bulbs and Plugs Control

dth_wallswitch
dth_smartbulb
dth_lighting
dth_pocketsocket
dth_outlet

(David) #384

ok done… pls check your mail. TIA


(Dave Gutheinz) #385

got it. looking.


(Dave Gutheinz) #386

Sent you an E-Mail. For all, I was unable to resolve the problem. The error was at the final installation step and all data was precisely correct. It may be an environment transitory error. I was able to duplicate only by modifying code to provide an incorrect name to the state.devices (looked for state.devicesx instead).

Suggest (and ugly) resolution was to wait a day or so and try again. If that failed, the states database be be corrupt (and not noticed). Suggested complete uninstall and reinstall of devices and Service Manager.

I appreciate the level of data that was provided. Although no resolution, it made my effort at futility much easier.


(David) #387

Tks and appreciate for trying to replicate the same error that i have. To be honest at the start i got plan to re do everything again. But u know the process is long, due to the fact i got so many devices.

Before i post to this forum for help, after del the 1st devices i move on to del the other 1 and before i del i update to the new account at the smart apps and try to refresh and somehow it work.

So i thought maybe there is a chance to save my laziness… lol… but i guess i have to do the hard way…

Anyway for those want to switch abother kasa accounts, you do no need to del from you account it will auto unlink for you and the best part is the old information like the devices name, devices photo and wifi password (if you using back the same wifi) will be there.

Anyway Gutheinz tks again…

Cheer


#388

Dave, Thanks so much for the code. I bought several tp link plugs and bulbs over the last year and got a smartthings hub over christmas. I realized I either needed to sell or integrate my tp link stuff into smartthings. This solved my problem as I installed your cloud based solution today!


(ServusJeff) #389

Thank you for going through with this code. I was able to get the Service Manager added to my published SmartApps, but when I try to create and publish the Device handlers I receive the following error:

No signature of method: script_app_metadata_41580157_6216_4fec_99b3_5f638adc7435.metadata() is applicable for argument types: (script_app_metadata_41580157_6216_4fec_99b3_5f638adc7435$_run_closure1) values: [script_app_metadata_41580157_6216_4fec_99b3_5f638adc7435$_run_closure1@8bd4032] Possible solutions: getMetadata(), getState(), getDateData(), setState(java.lang.Object), metaClass(groovy.lang.Closure)

This is my first attempt at addingin 3rd party devices.


(Dave Gutheinz) #390

The error is typically encountered when you try to save a Device Handler into the My SmartApps tab. Before copying a device handler,first go to the My Device Handlers tab.

Welcome to the community!


(Maxwell Gottlieb) #391

I set this up for my smart plug. Is was wondering if you could make the refresh rate less than 5 minutes?


(Dave Gutheinz) #392

It is technically feasible, but adds a lot of messaging w/o any reason. Rationale:

a. Anytime you turn on / off the plug via STs, it send an event with with isStateChange = true.
b. The refresh, sends the event with isStateChange = false.

Smart Apps monitor on-time would use the on and off with isStateChange = true to cue the on-off times. If it misses by (Up to) five minutes each way, that will average out in a distribution around zero error.

A Hint. If you use Amazon Alexa, add the app to SmartThings. Then use the SmartThings version in Alexa to control the lights and other items.

If you must change to 1 minute, you can edit the code. Near the top, there is a line that has the command “runEvery5Minutes”. Change that to runEvery1Minute. This will cause the messages to/from the cloud to increase 5X, so I do not recommend it.


(Saxnix) #393

Hi @Gutheinz, firstly, thanks for your (and others’) work on this DH. I am trying to get my HS110 plugs working, but am running into a problem, but can’t figure out where I have gone wrong. Thought I followed the instructions correctly, but the Things (I have 2 plugs - Dryer and Washing Machine), in the ST app only report as being on, no other field is populating.

yet the native Kasa app is working fine.

I have the App, generic DH, and HS110 DH installed (in that order), The plugs are showing in the ST app, and I can add them in my webCoRE pistons.

Here are the logs of for the Dryer. Can you see what I may have done wrong? TIA.


(Dave Gutheinz) #394

Some a dumb question to make sure we are on the same page, then one suggestion.

  1. From SmartThings (ST) can you turn the dryer on/off and it updates state?

  2. Suggestion: Turn on logging and then press “Refresh Stats”. Then press “Refresh”.


(Dave Gutheinz) #395

Is anyone else having any problems with the Energy Monitor function on any of these devices? I am working on a review/update of the items right now and plan to release by the next Wednesday.

Changes coming:

Slight modification to installation for Energy Monitor (User will modify a line at the top to enable/disable Energy Monitor).
Change file and device handler names to match TP-Link product area vice the model number.
Maintenance improvements (for me) to reduce maintenance time/verification.


(Saxnix) #396
  1. Yes

  2. Must be blind, can’t see where the “Refresh Stats” button is. I did clear the Live Logging and turned on/off the dryer again from the ST app.

And just the Dryer Logging


(Dave Gutheinz) #397

Refresh Stats tile is on right side just below the Power indicator.


(Dave Gutheinz) #398

What is probably happening is that the date is not being set (part of the refresh stats method) and therefore, the calculation is not working properly. (PS - I have not seen any reports of this problem in the operational system, so please be patient.)


(Saxnix) #399

Sorry, thought you were talking about in the IDE. Here are the logs as requested in # 2.


(Saxnix) #400

If it is this, could it have anything to do with the fact that I am in Australia (and that is where I have Home set to?


(Dave Gutheinz) #401

No, It should not unless you are in Canberra. The politicians always mess things up (especially in Washington DC).

Love Australia. Spent better part of a year in Melbourne about 10 years ago.


(Saxnix) #402

Ha ha, that’s funny. Melbourne is a great place, just got back from a trip down there visiting family and of course the Fairy Penguins :slight_smile:


(Dave Gutheinz) #403

def energyMeterResponse(cmdResponse) {
My first concern is why you get a null for currentPower (before the error occurs.
Open your Device Handler in the IDE. Get brave and remember, it probably will not explode.
Go to line 194 on the edit page. Insert the below:

log.debug cmdResponse

so that 194 l- 196 ooks like the below:

def energyMeterResponse(cmdResponse) {
log.debug cmdResponse
	def realtime = cmdResponse["smartlife.iot.common.emeter"]["get_realtime"]

Next, go to line 209 and add the same text so it looks like

def useTodayResponse(cmdResponse) {
log.debug cmdResponse
	def engrToday

Finally, go to line 300 and do the same, so it looks like:

> def currentDateResponse(cmdResponse) {
> log.debug cmdResponse
> 	def setDate =  cmdResponse["smartlife.iot.common.timesetting"]["get_time"]

Then Save and Publish. Enable logging again, and try again.

This may extract data I may need to fix. Once the file is published, do not change until I analyze. We will use this version for any further items and can sync via the line numbers.