Kasa tp-link and currentValue


#1

I came from ST and can't seem to get currentValue to work with Hubitat like it did in Smartthings.
Any ideas?

Example of code....
note: desklamp is a tp-link plug (HS105)
def desklamp_state = "on"

desklamp_state = desklamp.currentValue("switch") //get state of desk lamp

if (desklamp_state == "on"){
....do stuff.....
}


#2

in a driver it's device.currentValue("attribute name")
this whole thing here can be simplified to:

if (device.currentValue("switch") == "on") { //do stuff here...}

#3

Welcome to the community!

Just an FYI @djgutheinz has created a phenomenal local solution for TP-Link/Kasa devices. Check it out: [RELEASE] TP-Link Plug, Switch, and Bulb integration


#4

Agreed, it works amazingly well and locally!


#5

Opps. My problem was in the ....do stuff here.... code. Thanks for the input and code reduction idea.