openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.88k stars 3.59k forks source link

[tplinksmarthome] HS103 Support #5001

Closed dogmaphobic closed 5 years ago

dogmaphobic commented 5 years ago

Until 2 days ago I didn't even know what openHAB was. I also know nothing About Java and even less how the whole development environment works. It took me over an hour just to get an Eclipse installation working. The current documentation doesn't mention you need a very specific version of Eclipse, 2018-09. Newer ones cause the build to have lots of errors. Any way I digress...

I have a few of these TP-Link HS103 plugs and noticed it is not supported. It seems to be no different than the HS105. I looked through the code, found all references to the HS105 and added the HS103 based on that.

~It's way too much work, at least for now, for me to fork the project and create a proper PR (I don't even know how to install this modified addon yet--I will figure out eventually). In the mean time, here is a patch (with a .txt added to make Github happy) with the changes in case someone decides to add it.~

Thanks!

Added in #5046

hs103.patch.txt

screen shot 2019-02-26 at 12 57 53 pm screen shot 2019-02-26 at 1 00 37 pm
dogmaphobic commented 5 years ago

Oops, sorry. Missed this one as it was not staged:

HS103.xml

<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="tplinksmarthome"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
    xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">

    <thing-type id="hs103">
        <label>HS103</label>
        <description>TP-Link HS103 Smart Wi-Fi Plug</description>
        <category>PowerOutlet</category>

        <channels>
            <channel id="switch" typeId="system.power" />
            <channel id="led" typeId="led" />
            <channel id="rssi" typeId="rssi" />
        </channels>

        <representation-property>deviceId</representation-property>

        <config-description-ref uri="thing-type:device:plug" />
    </thing-type>
</thing:thing-descriptions>
Hilbrand commented 5 years ago

Device added and merged. Updated binding is available in the Eclipse Marketplace.