New TP-Link Smart Home binding with Bulb, Plug and Switch Support

The TP-Link binding is part of the openHAB distribution. The current binding supports even more devices than already mentioned here. For up-to-date information see: TP-Link Smart Home - Bindings | openHAB There is also a beta version available in the openHAB Community Marketplace. See the TP-Link binding beta topic.


In the TP-LINK HS100 Smart Plug (WiFi)? topic information about this binding was already posted, but since that might gets buried as it contains a lot ot replies I thought it might be a good idea to start a new topic about this binding.

There is now a TP-Link binding that adds support for the following TP-Link Smart Home devices: Wi-Fi Smart Plugs HS100, HS105 and HS110, Smart Switch HS200, Smart Bulbs LB100, LB110, LB120 and LB130 The Beta version of this binding is available in the Eclipse Marketplace (if you have that binding installed, you can install this binding directly in openHAB) or download the binding jar directly: org.openhab.binding.tplinksmarthome-2.2.0-SNAPSHOT.jar (This is the jar build by the openHAB pull-request builder on GitHub, and thus should be in sync with the source code) (Outdated link, the binding is part of openHAB)

The binding has been recently updated to add support for the Smart Bulbs LB100, LB110, LB120 and LB130. However, since I don’t own any of those bulbs the implementation is purely based on what I could derive from other sources. Initial feedback suggest it works. So it would be help adaption of this binding if it’s confirmed the binding works as expected . if you own any of these devices and want to provide feedback, that would help. Here are some guidelines for testing:

What model did you test?
Does switching on/off work?
Does changing the brightness work?
Does changing the color temperature work (if supported)?
Does changing the color work (if supported)?
Does setting a transitionPeriod work (this is a property)?
If anything doesn’t work please let me know what doesn’t. Also in debug log mode the response from the device is logged. Providing this in your report can help fixing an issue.

Feel free to review the code: https://github.com/openhab/openhab2-addons/pull/2348. It also contains the README with more information on manual configuration. Binding part of openHAB distribution

2 Likes

Hi,
Just to add to the testing results. I also added some more info that might help.

Tested this snapshot: org.openhab.binding.tplinksmarthome-2.2.0-SNAPSHOT.jar

cd /usr/share/openhab2/addons
wget https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.tplinksmarthome/2.2.0-SNAPSHOT/org.openhab.binding.tplinksmarthome-2.2.0-SNAPSHOT.jar
sudo chmod 644 org.openhab.binding.tplinksmarthome-2.2.0-SNAPSHOT.jar

What model did you test? - TP-Link HS-110
Does switching on/off work? - Yes
Does auto-discovery work? - Yes
Does RSSI work? - Yes (shown in dBm)

TP-Link HS-110 with Energy Monitoring (Specific features):
Does Power usage work? - Yes (shown in W)
Does Energy usage work? - Yes (shown in kWh)
Does Current work? - Yes (shown in A)
Does Voltage work? - Yes (shown in V)

Although auto-discovery works well (it even found an LED switch for HS110), I converted my configuration to manual files so I can easily back them up and restore. Also, you can remove the groups and charts if you don’t use it.

sample home.things:

//TP-Link UPS Socket
Thing tplinksmarthome:hs110:UPS "TP-Link UPS Socket" @ "Servers" [ipAddress="192.168.1.25", refresh=60]

sample home.items:
I added [ “CurrentTemperature” ] to TPL1_Power because I wanted to see the power usage of the UPS in homekit. It will appear as temperature in your ios device but you can add a label as Power.

// Main group
Group gHome
//Groups - Location
Group gLivingRoom (gHome)
Group gServers    (gHome)
//Groups - Function
Group gSecurity   (gHome)
Group gSockets    (gSecurity)
//Groups - Charts
Group gChart2     (gHome)

//TP-Link Socket
Switch TPL1_Switch "UPS Socket" (gLivingRoom, gServers, gSockets) ["Switchable"] { channel="tplinksmarthome:hs110:UPS:switch" }
Number TPL1_RSSI "Signal [%d dBm]" (gChart2) { channel="tplinksmarthome:hs110:UPS:rssi" }
Number TPL1_Power "Power Usage [%.2f W]" (gChart2) [ "CurrentTemperature" ] { channel="tplinksmarthome:hs110:UPS:power" }
Number TPL1_Energy "Energy Usage [%.2f kWh]" (gChart2) { channel="tplinksmarthome:hs110:UPS:energyUsage" }
Number TPL1_Current "Current [%.2f A]" (gChart2) { channel="tplinksmarthome:hs110:UPS:current" }
Number TPL1_Voltage "Voltage [%.2f V]" (gChart2) { channel="tplinksmarthome:hs110:UPS:voltage" }

sample home.sitemap:

    Frame label="Servers"
    {
        Switch item=TPL1_Switch label="UPS Socket" icon="poweroutlet"
        Text item=TPL1_RSSI label="Signal [%d dBm]" icon="network"
        Text item=TPL1_Power label="Power [%.2f W]" icon="heating"
        Text item=TPL1_Energy label="Energy Usage [%.2f kWh]" icon="energy"
        Text item=TPL1_Current label="Current [%.2f A]" icon="heating"
        Text item=TPL1_Voltage label="Voltage [%.2f V]" icon="heating"

        Text label="Charts" icon="line"
        {
            Chart item=TPL1_Power service="rrd4j" period=D refresh=60000
            Chart item=TPL1_Energy service="rrd4j" period=D refresh=60000
            Chart item=TPL1_Current service="rrd4j" period=D refresh=60000
            Chart item=TPL1_Voltage service="rrd4j" period=D refresh=60000
            Chart item=gChart2 service="rrd4j" period=D refresh=60000
        }
    }

sample rrd4j.persist:

// persistence
Strategies {
  everyDay    : "0 0 0 * * ?"
  everyHour   : "0 0 * * * ?"
  everyMinute : "0 * * * * ?"
  
  default = everyChange
}

Items {
  gChart2*  : strategy = everyChange, everyUpdate, everyMinute
}

I hope it helps with the testing and review. For persistence, you can change it to log every minute instead of every change/update.

2 Likes

Can somebody explain to a Newbie how to put this .jar for the TPLINKHS100 into my openHABianPi install either by where to drop it in the Pi’s files, or by how to load it through Paper running on my Mac? In exchange for your patience, I promise to pay if forward as I get competent with openHAB (I’m just starting out now).

In PaperUI install the Eclipse Market binding and then the TP-Link binding becomes available in the binding list and you should be able to install it in PaperUI.

I have a couple of HS200 but i´m a total Newie and I have no idea on how to add them, I really the components of the code that you place there, F.E. the IP of my switch is 192.168.1.104 but that´s the only thing I know where to replace there, can anyone give me a hand?

I just got a HS100(UK) as part of a deal another bit of kit.

I have OH2.1. I added the 2.2.0 binding and can confirm:

What model did you test? - HS100(UK)
Does switching on/off work? - Yes
Does auto-discovery work? - Yes
Does RSSI work? Signal channel shows -56 dBm
Switching the chassis LED on/off works as well :slight_smile:

Keith

What model did you test? - HS100(EU)
Does switching on/off work? - Yes
Does auto-discovery work? - Yes
Does RSSI work? Signal channel shows -82 dBm

–> confirmed:

Switch SZ_TP_Link_LED "LED Licht" 											<selfsocket> 	(gTP_Link_SZ)			{ channel="tplinksmarthome:hs100:12345:led" }
  • What model did you test? LB230

  • Does switching on/off work? There is not channel for this

  • Does auto-discovery work? No

  • Does RSSI work? - Yes (shown in dBm)

  • Does changing the brightness work? No Dim/Brightness Channel (but Bulb has dim function)

  • Does changing the color temperature work (if supported)? Yes

  • Does changing the color work (if supported)? Yes

  • Does setting a transitionPeriod work (this is a property)?

  • Does Power usage work? No Channel but Bulb has feature.

  • Does Energy usage work? No Channel but Bulb has feature.

  • Does Current work? No Channel but Bulb has feature.

  • Does Voltage work? No Channel but Bulb has feature.

Don’t have a ON | OFF Channel (switch)

There are only 4 Channels Available.
Color [color of a light.]
Color Temperature [cold (0%) to warm (100%)]
Color Temperature (Kelvin)
Signal [Wi-Fi signal strength indicator]

Hi all,

What model did you test? - TP-Link HS-110
Does switching on/off work? - Yes
Does auto-discovery work? - Yes
Does RSSI work? - Yes (shown in dBm)

TP-Link HS-110 with Energy Monitoring:
Does Power usage work? - Yes (shown in W)
Does Energy usage work? - Yes (shown in kWh)
Does Current work? - Yes (shown in A)
Does Voltage work? - Yes (shown in V)

Although auto-discovery works well!

Thx,
Michael

Just some great news on the binding. The pull request has been merged into master and is available will be available in the snapshot builds and will be part of the next release of openHAB 2.2 ! Everybody thanks for all the testing!

1 Like

Is there a list of the devices that work? Or is it just the HS100, HS110 and LB230 so far?

Also does the binding control these devices independent of Alexia/Google (like when internet is down) or without a Alexia/Google Home configuration?

Did you look into the readme of the binding?

Does openHAB work without Alexia/Google? (Yes that is a rhetorical question). So yes from openHAB it communicates directly with the devices via local network.

No, I was lazy, did not look at the binding yet…

I am running 1.9 and will be upgrading over Christmas break…

Everything has been running so well, I didn’t want to temp fate…

Too many new good things NOT to upgrade!

Thanks
Tom

hi hilbrand,

just to clarify, are you saying the version to use should be the normal snapshot version (in the current snapshot) and no-longer the market version?

Thanks.

The market version and snapshot version are basically the same at this moment as the marketplace points to the jar build by the pull request. However the marketplace jar has changed several times since the initial release, even some channels. So you might run a version not completely up-to-date. If you are running the snapshot of openHAB I would recommend to run the snapshot version of the binding instead of the binding from the marketplace. I probably will remove or disable the binding from the marketplace once version 2.2 of openHAB is released as it won’t add any value when the binding is the same as in the official release and only would confuse people.

Thanks

Are rules working with this binding already ?

I’m not sure I understand your question. Binding and rules are separate things and thus a rule can be used with any binding. So I don’t see why they shouldn’t work?

When you use the KASA app you get a little readout of runtime

where are these values stored? are they stored inside the sockets themselfs? and is there a way too access these or recreate in OH?

These values are stored in the socket and can be retrieved via the api. The openHAB binding doesn’t retrieve them. However openHAB can persist channel data with an interval and can be used to basically do the same and more: you can generate nice graphics. Because of this functionality I’m not sure if there is much added value to get those statics directly from the socket. Actually in the first reply in this topic and extensive configuration example is give that includes storing statics in openHAB and show them with a chart.