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

govee-lan-control

v3.0.2

Published

A package to control Govee devices using their new LAN control.

Downloads

98

Readme

Govee LAN API

Someone will probably make this better than I ever could, but I wan't to abandon Govee's API that uses their servers, since I don't like it.

What is this?

An npm module to control Govee devices using their new LAN API.

What devices are supported?

Check Govee's WLAN Guide, they have a list.

Documentation

Note for Docker users:

UDP ports 4001, 4002 and 4003 are used on address 239.255.255.250. If you only allow certain IP addresses, also add the ip of your device directly.

Use these flag to allow for the correct ports to be accessed.

-p 4001:4001/udp -p 4002:4002/udp -p 4003:4003/udp

Also if you have a firewall inside of your container, make sure it allows requests going to remote port 4001 and 4003, and it allows requests comming in on local port 4002.

Here is an example of how to allow outgoing requests on port 4001 and 4003 (This is for Red Hat / Centos, check with the firewall on your distro)

sudo iptables -A INPUT -p udp --dport 4001 -j ACCEPT
sudo iptables -A INPUT -p udp --dport 4003 -j ACCEPT

Examples

For Node_RED examples, check the examples folder

Initial setup

const Govee = require("govee-lan-control");

var govee = new Govee.default();
govee.on("ready", () => {
  console.log("Server/client is ready!");
});
govee.on("deviceAdded", (device) => {
  console.log("New Device!", device.model);
});

Fade to random color and brightness every 2 seconds.

setInterval(() => {
  govee.devicesArray[0].actions.fadeColor({
    time: 2000,
    color: {
      hex: Math.floor(Math.random() * 16777215).toString(16),
    },
    brightness: Math.random() * 100,
  });
}, 2000);

Rainbow

var i = 0;

setInterval(() => {
  i++;
  // Loop back to 0 when at 360
  i %= 360;

  govee.devicesArray[0].actions.setColor({
    hsl: [i, 100, 50],
  });
}, 30);