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 🙏

© 2024 – Pkg Stats / Ryan Hefner

yeelight-manager

v0.1.1-preview.9

Published

CLI to control yeelight devices!

Downloads

12

Readme

yeelight-manager

A CLI to super charge your yeelight use! Works on Linux and Mac (not tested on Windows)

Installation

Using npm

npm i -g yeelight-manager or SKIP=1 npm i -g yeelight-manager if you wanna skip rust build

Using yarn

yarn add global yeelight-manager or SKIP=1 yarn add global yeelight-manager

Requirements

  • nodejs@16+
  • rust: Needed to build native packages to be used on ambilight command.

How-to?

After installing this tool, the first thing is to run yee list to see the available devices on your network.

Then, get the IP or ID of a device and run yee blink <ip/id> (or yee toggle <ip/id>) to identify the device, then run yee set <ip/id> name <name-of-device>.

Repeat the process until you name all your devices

Commands

Most commands has default options.

  • -h, --help Display help for command
  • -t, --waitTime <value> Time to wait for yeelights connect
  • --verbose Output verbose info
  • --debug Output debuf info

yee list

List all available devices. Uses SSDP method and port scanner method to retrieve devices.

options

  • -c, --colors: Outputs a json with all available colors

yee blink <name|id|ip> (beta)

Blink a device. Useful when you have multiple devices and wanna know with id/ip belongs to a device

yee set <name|idip> <command> <value> [options]

  1. yee set <name|id|ip> name <name> Sets a name for your device
  2. yee set <name|id|ip> bright <1-100> Change the brightness of a device. Any value below 1 will be threated as 1 and above 100 will be threated as 100;
  3. yee set <name|id|ip> ct|temperature|color_temperature <1700~6500|default-temperatures> [bright] Change the color temperature of a device. Any value below 1700 will be threated as 1700 and any value above 6500 will be threated as 6500;
    • Has the following default temperatures available: cold, mid-cold, mid, mid-warm and warm.
  4. yee set <name|id|ip> color <hex-color|default-colors> [bright] Change the color of the device;
    • See the default colors available with yee list -c
  5. yee set <name|id|ip> power <off|on> Explicity turn on or off a device;

yee setx "'Living Room' ct=9999 bright=100 Kitchen ct=9999 bright=100" --save 'Normal Room'

Set a custom command to later use

yee toggle <name|id|ip>

Toggles a device

yee ambilight <name|id|ip> <resolution|default-area> <interval> [options] (beta)

Using Yeelight's Music Mode, scan for dominant color on screen and use that color on device.

Uses rust and napi-rs under the hood. Not tested on Windows.

options

  • resolution: Defines the area to fetch the dominant color. It's a string in format <width>x<height>x<x>x<y> or one of the default-area values.
    • <width>x<height>x<x>x<y>: <width>x<height> are required, x and y are optional
    • default-area: Can be top, bottom, left and right.
  • interval: Interval for fetching new colors. It's a number representing a ms value. Also, it can be a fps value, example: yee ambilight Bedroom top 30fps. Due to the way the Yeelight's Bulb changes from color to color, the recomended interval is 150. Yeelight's bulbs has a minimum interval of 30ms

In my tests, Lightbulb 1S is far more compatible with this command than Lightbulb W3

Output Examples

yee list: List devices. Sometimes, IP scan can fail

17:38:58 info:Discovery: Discovery started...
17:39:00 info:Discovery: Found 5 devices via SSDP.
17:39:00 info:Discovery: Discovery finished.
17:39:00 info:Discovery: List of devices:
┌────────────────────┬─────────────┬─────────────────────┬─────┬──────┬───────┬────────────┐
│ DeviceID           │ Name        │ IP                  │ On? │ Mode │ Value │ Brightness │
├────────────────────┼─────────────┼─────────────────────┼─────┼──────┼───────┼────────────┤
│ 0x0000000012a1c314 │ Bedroom     │ 192.168.0.191:55443 │ Yes │ CT   │ 1700  │ 50         │
├────────────────────┼─────────────┼─────────────────────┼─────┼──────┼───────┼────────────┤
│ 0x0000000011301fe3 │ Corridor #1 │ 192.168.0.169:55443 │ Yes │ CT   │ 1700  │ 26         │
├────────────────────┼─────────────┼─────────────────────┼─────┼──────┼───────┼────────────┤
│ 0x0000000012a2d4ab │ Corridor #2 │ 192.168.0.162:55443 │ Yes │ CT   │ 5244  │ 29         │
├────────────────────┼─────────────┼─────────────────────┼─────┼──────┼───────┼────────────┤
│ 0x00000000112c0549 │ Kitchen     │ 192.168.0.199:55443 │ Yes │ CT   │ 2001  │ 100        │
├────────────────────┼─────────────┼─────────────────────┼─────┼──────┼───────┼────────────┤
│ 0x0000000011301d41 │ Living Room │ 192.168.0.107:55443 │ Yes │ CT   │ 4710  │ 100        │
└────────────────────┴─────────────┴─────────────────────┴─────┴──────┴───────┴────────────┘

yee ambilight Bedroom top 500 --debug: Turn ambilight on for Bedroom device using top area for color tracking with 500ms updates

17:40:08 debug:Screenshot.GetScreenAreaDimensions: Value received: top
17:40:08 debug:Screenshot.GetScreenAreaDimensions: Value received from rust: 2560 x 1080
17:40:08 debug:AmbilightCmd: Interval MS: 500; Raw interval: 500
17:40:08 debug:ambilightCase: Received parameters
{
  "deviceNames": [
    "Bedroom"
  ],
  "height": 130,
  "width": 1280,
  "x": 640,
  "y": 100,
  "interval": 500,
  "useLuminance": true
}

17:40:10 debug:ambilightCase: Adding signal listeners
17:40:10 debug:ambilightCase: Listeners added
17:40:10 info:Bedroom: ⚡ Trying to connect into Bedroom in 192.168.0.191:55443
17:40:11 info:Bedroom: 💡 Connected into Bedroom
17:40:11 info:Bedroom: 📀 Starting music mode
17:40:11 info:Bedroom: ⚡ Server Created!
17:40:11 info:Bedroom: ⚡ TCP Server Info: :::61020
17:40:11 debug:Bedroom: Command sent: {"id":9999,"method":"set_music","params":[1,"192.168.0.104",61020]}

17:40:11 info:Bedroom: ⚡ Device connected to server
17:40:11 debug:Bedroom: Result event
{
  "method": "props",
  "params": {
    "music_on": 1
  }
}

17:40:11 verbose:Bedroom: music_on changed to 1
17:40:11 verbose:Bedroom: Props updated for
{
  "music_on": 1
}

17:40:11 debug:Bedroom: Result event
{
  "id": 9999,
  "result": [
    "ok"
  ]
}
17:40:12 debug:ambilightCase: Values from worker: {"color":"030304","factor":0.8627451062202454,"luminance":1.2047842741012573}
17:40:12 debug:Bedroom: Command sent: {"id":1,"method":"set_bright","params":[1.2047842741012573,"smooth",500]}

17:40:12 debug:Bedroom: Command sent: {"id":2,"method":"set_rgb","params":[197380,"smooth",500]}

17:40:12 debug:ambilightCase: Values from worker: {"color":"050507","factor":0.8784313797950745,"luminance":2.017411708831787}
17:40:12 debug:Bedroom: Command sent: {"id":3,"method":"set_bright","params":[2.017411708831787,"smooth",500]}

17:40:12 debug:Bedroom: Command sent: {"id":4,"method":"set_rgb","params":[328967,"smooth",500]}

^C

17:40:13 info:Bedroom: 📀 Finishing music mode
17:40:13 debug:Bedroom: Command sent: {"id":9999,"method":"set_music","params":[0,"192.168.0.104",61020]}

17:40:13 info:ambilightCase: 🦄 See you soon

Troubleshooting

Can't find my devices via SSDP

Try to turn off IGMP Snooping on your router (source: https://forum.yeelight.com/t/bulb-stops-to-respond-to-ssdp-requests-after-some-minutes/702)

Gets a Error: connect EHOSTUNREACH error

If you're connected in VPN, please disconect and try again. (Problem reported on a macos 12.3.1 M1 Pro with Cisco Any Connect)