Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/steveredden/homebridge-kasa-lightstrip

A homebridge plugin for controlling Kasa Light Strips :zap:
https://github.com/steveredden/homebridge-kasa-lightstrip

homeautomation homebridge homebridge-plugin homekit kasa kl4005l kl430 python-kasa smarthome tp-link tp-link-kasa tplink tplink-kasa

Last synced: 24 days ago
JSON representation

A homebridge plugin for controlling Kasa Light Strips :zap:

Awesome Lists containing this project

README

        



[![GitHub license](https://badgen.net/github/license/steveredden/homebridge-kasa-lightstrip)](https://github.com/steveredden/homebridge-kasa-lightstrip/blob/main/LICENSE)
[![GitHub last commit](https://img.shields.io/github/last-commit/steveredden/homebridge-kasa-lightstrip.svg?style=flat-square)](https://github.com/steveredden/homebridge-kasa-lightstrip)
[![GitHub issues](https://img.shields.io/github/issues/steveredden/homebridge-kasa-lightstrip.svg)](https://GitHub.com/steveredden/homebridge-kasa-lightstrip/issues/)
[![Npm package version](https://badgen.net/npm/v/homebridge-kasa-lightstrip)](https://npmjs.com/package/homebridge-kasa-lightstrip)
[![Npm package total downloads](https://badgen.net/npm/dt/homebridge-kasa-lightstrip)](https://www.npmjs.com/package/homebridge-kasa-lightstrip)

# homebridge-kasa-lightstrip

`homebridge-kasa-lightstrip` is a [Homebridge](https://homebridge.io) plugin that exposes tp-link kasa light strip devices to [Apple's](https://www.apple.com) [HomeKit](https://www.apple.com/ios/home) smart home platform.

This plugin was developed as a stop-gap to provide integration of Kasa's light strips, while the [far superior] plugin ([homebridge-tplink-smarthome](https://github.com/plasticrake/homebridge-tplink-smarthome#readme)) lacks support!

This plugin creates Lightbulb accessories for you to integrate with your lightstrips. It can also, optionally, create stateless Switch accessories to enable Light Effects.

## Prerequisites

The [python-kasa](https://github.com/python-kasa/python-kasa) library is required for this plugin. Credit to that team and the maintainers! :trophy::clap:

Specifically, version `0.4.0.dev3` is required, as newer iterations (0.4.1+) do not work quickly/effectively.

#### Installation instructions for [Homebridge Raspberry Pi Image](https://github.com/homebridge/homebridge-raspbian-image/wiki/Getting-Started):

```sh
sudo apt install python3-pip
sudo pip3 install python-kasa==0.4.0.dev3
```

If you have the incorrect version you can uninstall the library with:

```sh
sudo pip3 uninstall python-kasa
```

#### Installation instructions for the [onzu/homebridge Docker Container](https://github.com/homebridge/homebridge/wiki/Install-Homebridge-on-Docker):

```sh
sudo docker exec -it homebridge sudo pip3 install python-kasa==0.4.0.dev3
```

...where `homebridge` is your container name. You can get your container name by typing `sudo docker ps`.

#### Validation

You can validate that the correct version of `python-kasa` library is installed by executing `kasa --version` at the command line of your environment:

![kasa --help output](img/validatePython-kasa2.png)

You should see something similar the above output. If you do not, and you see something like `-bash: kasa: command not found`, you will need to install it (instructions above), or find a way to get it into your environment. Review the [python-kasa](https://github.com/python-kasa/python-kasa#readme) repository for any additional instructions.

## Installation Instructions

#### Option 1: Install via Homebridge Config UI X

Search for "kasa" in [homebridge-config-ui-x](https://github.com/oznu/homebridge-config-ui-x) and install `homebridge-kasa-lightstrip`.

#### Option 2: Manually Install

```sh
sudo npm install -g homebridge-kasa-lightstrip
```

## Supported Devices

### Kasa Light Strips

* [KL400L5](https://www.kasasmart.com/us/products/smart-lighting/product-kl400l5) - Brightness, Hue, Saturation, Effects (via stateless switch)
* [KL430](https://www.kasasmart.com/us/products/smart-lighting/kasa-smart-led-light-strip-kl430) - ""

## Configuration

Device names and IP Addresses must be configured manually in current state:

### Example

```json
platforms: [
{
"platform": "HomebridgeKasaLightstrip",
"accessories": [
{
"name": "Couch Strip",
"ip": "10.10.10.10",
"effects": {
"Aurora": true,
"Hanukkah": true,
"CustomEffects": [
{
"name": "MyCustomEffect1",
"json": "{'custom':1,'id':'xqUxDhbAhNLqulcuRMyPBmVGyTOyEMEu','brightness':100,'name':'MyCustomEffect1','segments':[0],'expansion_strategy':1,'enable':1,'type':'sequence','duration':0,'transition':1500,'direction':4,'spread':7,'repeat_times':0,'sequence':[[120,100,100],[240,100,100],[260,100,100],[280,100,100]]}"
}
]
}
}
],
"name": "KasaLightstrip",
"debug": false
}
]
```

* **platform** (mandatory): the name of the plugin
* **accessories** (mandatory): array containing the devices and their info:
* **name** (mandatory): the name of the accessory to create
* **ip** (mandatory): the IP address of the device
* *effects* (optional): object containing any effects to create:
* *\* (optional): boolean to enable a specific built-in effect
* *CustomEffects* (optional): array containing any custom effects to create:
* *name* (optional): the name of the custom effect
* *json* (optional): the json for the custom effect*
* *name* (optional): platform name to display in logs
* *debug* (optional): boolean to enable more verbose logging

### Lighting Effects

Stateless Switches (they turn off after 1 second) are created if you include any of the `effects` object in your `config.json`. All 14 pre-defined Lighting Effects are available to be created and toggled for any Lightstrip you configure. Additionally, custom Lighting Effects can be created.

\*see [CustomLightingEffects.md](docs/CustomLightingEffects.md) for more information

## Characteristic Errors

Erorrs may common due to the nature of the implementation: Flooding your devices with rapid `python-kasa` calls may result in several dropped connections.

It is most often seen with the Brightness slider -> as you slide, the Home app can send numerous Brightness values, resulting in numerous `kasa` executions. You'll see the following displayed in the log:

```sh
[KasaLightstrip] StripName - Error setting characteristic 'Brightness'
```

Attempt to slow your inputs! :thinking: Or speed your swipe?! :man_shrugging: