Giter Site home page Giter Site logo

shanecastle / homebridge-tplink-smarthome Goto Github PK

View Code? Open in Web Editor NEW

This project forked from plasticrake/homebridge-tplink-smarthome

0.0 2.0 0.0 353 KB

TPLink Smart Home Plugin for Homebridge (formerly homebridge-hs100)

License: MIT License

JavaScript 100.00%

homebridge-tplink-smarthome's Introduction

homebridge-tplink-smarthome

NPM Version js-semistandard-style

TPLink Smart Home Plugin for Homebridge. (formerly homebridge-hs100)

Models Supported

  • Plugs: HS100, HS105, HS107, HS110, HS200, HS210, HS220, HS300
  • Bulbs: LB100, LB110, LB120, LB130, LB200, LB230

More models may be supported than listed. If you have another model working please let me know so I can add here.

Homekit

Model deviceType Service Characteristics
HS100, HS105, HS107 plug Outlet On
OutletInUse (based on On state)
HS110, HS300 plug Outlet On
OutletInUse (based on energy monitoring)
Volts (Custom)
Amperes (Custom)
Watts (Custom)
VoltAmperes (Custom)
KilowattHours (Custom)
KilowattVoltAmpereHour (Custom)
HS200, HS210 plug Switch On
HS220 plug Lightbulb On
Brightness
LB100, LB110, LB200 bulb Lightbulb On
Brightness
Watts (Custom)
LB120 bulb Lightbulb On
Brightness
ColorTemperature
Watts (Custom)
LB130, LB230 bulb Lightbulb On
Brightness
ColorTemperature
Hue
Saturation
Watts (Custom)

Installation

  1. Node v8.3 or greater is required. Check by running: node --version
  2. Install Homebridge using: npm install -g homebridge or sudo npm install -g --unsafe-perm homebridge (more details)
  3. Install this plugin using: npm install -g homebridge-tplink-smarthome
  4. Update your configuration file. See the sample below.

Updating

  • npm update -g homebridge-tplink-smarthome

Note for Previous Users of homebridge-hs100

If you had homebridge-hs100 installed previously, due to how homebridge works, you may get this error on startup: Error: Cannot add a bridged Accessory with the same UUID as another bridged Accessory:. You'll need to remedy this by deleting the cachedAccessories file, or by manually editing the file to remove the old accessories under homebridge-hs100. On most systems that file will be here: ~/.homebridge/accessories/cachedAccessories.

Configuration

Sample Configuration

Minimal

"platforms": [{
  "platform": "TplinkSmarthome",
  "name": "TplinkSmarthome"
}]

All options with defaults

Note that comments aren't allowed in JSON files. But are included here for readability.

"platforms": [{
  "platform": "TplinkSmarthome",
  "name": "TplinkSmarthome",

  ////////////////////////////////
  // Device Discovery Options
  ////////////////////////////////
  "broadcast": "255.255.255.255", // Broadcast Address. If discovery is not working tweak to match your subnet, eg: 192.168.0.255
  "devices": [],         // Manual list of devices (see section below)
  "deviceTypes": [],     // set to [] or ["plug", "bulb"] to find all TPLink device types or ["plug"] / ["bulb"] for only plugs or bulbs
  "macAddresses": [],    // Whitelist of mac addresses to include. If specified will ignore other devices. Supports glob-style patterns
  "excludeMacAddresses": [],  // Blacklist of mac addresses to exclude. Supports glob-style patterns
  "pollingInterval": 10, // (seconds) How often to check device status in the background

  ////////////////////////////////
  // Device Options
  ////////////////////////////////
  "addCustomCharacteristics": true, // Adds energy monitoring characteristics viewable in Eve app
  "inUseThreshold": 0,       // (Watts) For plugs that support energy monitoring (HS110), min power draw for OutletInUse
  "switchModels": ["HS200", "HS210"], // Matching models are created in homekit as a Switch instead of an Outlet
  "timeout": 15               // (seconds) communication timeout
}]
MAC Addresses

MAC Addresses are normalized, special characters are removed and made uppercase for comparison. So any format should work: AA:BB:CC:00:11:22 or aaBbcc001122 are valid. Glob-style pattern matching is supported: ? will match a single character and * matches zero or more. To specify all MAC addresses that start with AA you could use AA*

Eve Screenshot - Custom Characteristics

Custom Characteristics in Eve

Devices that support energy monitoring (HS110, etc) will have extra characteristics that are viewable in the Eve app. Turn this off by setting addCustomCharacteristics false.

Manually Specifying Devices

If you have a network setup where UDP broadcast is not working, you can manually specify the devices you'd like this plugin to use. This will send the discovery message directly to these devices in addition to the UDP broadcast. Note that your device must have a static IP to work.

"platforms": [{
  "platform": "TplinkSmarthome",
  "name": "TplinkSmarthome",

  "devices": [
    { "host": "192.168.0.100" },
    { "host": "192.168.0.101" },
    { "host": "192.168.0.102", "port": "9999" } // port defaults to "9999" but can be overriden
  ]
}]

Accessory Names

Note the name in Homebridge/HomeKit may be out of sync from the Kasa app. This is a Homebridge/HomeKit limitation. You can rename your accessory through the Home app.

Troubleshooting

UUID Errors

Error: Cannot add a bridged Accessory with the same UUID as another bridged Accessory If you get an error about duplicate UUIDs you'll have to either remove your cached configuration files or manually edit them to remove the offending entry. By default they are stored in ~/.homebridge/accessories. In some cases you may also need to remove ~/.homebridge/persist and re-pair homebridge to your home.

You can remove them by running:

  • rm -rf ~/.homebridge/accessories
  • rm -rf ~/.homebridge/persist

Credits

Thanks to George Georgovassilis and Thomas Baust for reverse engineering the HS1XX protocol.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.