npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2021 – Pkg Stats / Ryan Hefner

kasa-smart-hub

v1.3.3

Published

Virtual Smart Hub for TP-Link Kasa Smart Home

Downloads

49

Readme

Build Status Test Coverage Dependabot Status Dependencies NPM Downloads Semantic-Release Gardener

kasa-smart-hub

Virtual Smart Hub for TP-Link Kasa Smart Home

Designed to be run on a LAN server, e.g. on a Raspberry Pi.

How to

Install as global npm packages. Then create configuration file and start with

kasa-smart-hub /path/to/config.json

Config

Configuration can be in multiple formats. Most likely you want to use config.js or config.json.

logFile

Where events logs are stored

links

Object that contains "linked" switches that are always executed together.

timer

Used to automatically switch off devices

__default

Default fallback timer. Can be set to zero to disable.

Config Example

const path = require('path');

module.exports = {
  logFile: path.join(__dirname, 'kasa-logs.txt'),
  links: {
    'kitchen-lights': [
      // when either of these is switched on / off the other one will also switch on / off
      'Kitchen Counter Lights',
      'Kitchen Ceiling Light'
    ]
  },
  timer: {
    __default: 8 * 60 * 60, // switch off everything after eight hours
    'Bathroom Fan': 60 * 60 // switch off after one hour
  },
  on: {
    'Plant Light': ['We 21:00'] // switch on every Wednesday at 9pm
  },
  off: {
    TV: ['02:00'] // switch off every day at 2am
  },
  timezone: 'America/Vancouver'
};

Configure Raspberry Pi Auto Start

Ensure you are running a recent node version. Install with

npm install -g kasa-smart-hub

Place

[Service]
WorkingDirectory=/home/pi/kasa-smart-hub
ExecStart=kasa-smart-hub start /home/pi/kasa-smart-hub/config.js
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=
User=pi
Group=pi
[Install]
WantedBy=multi-user.target

in /etc/systemd/system/kasa-smart-hub.service.

Ensure it is readable/writeable/executable by the appropriate user.

Now enable service with sudo systemctl enable kasa-smart-hub

To start the service right away run sudo systemctl start kasa-smart-hub

Acknowledgements

This project relies on tplink-smarthome-api. Documentation for that project can be found here.