Git Product home page Git Product logo

yeelight's People

Contributors

dependabot[bot] avatar ivkos avatar jbarzegar avatar nickdub avatar nytamin avatar samuraitruong avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

yeelight's Issues

How to log events from external application

First of all, thanks for this package, it's really working great.

I've got two questions :

  • Is there any way to detect event happening but from the original application ?

  • I tried to add the logger parameter to the discover method but I can't seem to log any event

const y = require("yeelight-awesome");
const discover = new y.Discover({
    port: 1982,
    debug: true
  }, y.logger);

Am I using it the wrong way ?

Thanks in advance

connexion timeout

Hi!
I'm using your lib to develop a desktop app.

It works pretty well with electron, but I have an issue when adding an indicator (tray icon) and can't figure out why when I call the same function as on the renderer process, I get a "connexion timeout" instead of the light reacting to it.

Here is my code, the indicator (tray icon) is in the feat/indicator branch.

Maybe you could help me to find where the problem is ?

Thank you !

NPM package not updated

Hello!

I saw a fix on setMusic method that isn't made available to download on npm.
This package on NPM is in version 1.0.12 and on this repository is on 1.0.15. Can you update on NPM?

Thanks!

How to set white color

Hi, first of all good job.
I wonder: I cannot set white color to my Yeelight Bulb.
I'm trying:

yeelight.setRGB( new Color(255,255,255) ).then( () => {
...
});

but I see a violet color.
What am I doing wrong?
Thanks in advance

Error: write ECONNABORTED

Error: write ECONNABORTED
at afterWriteDispatched (internal/stream_base_commons.js:156:25)
at writeGeneric (internal/stream_base_commons.js:147:3)
at Socket._writeGeneric (net.js:798:11)
at Socket._write (net.js:810:8)
at writeOrBuffer (internal/streams/writable.js:358:12)
at Socket.Writable.write (internal/streams/writable.js:303:10)
at E:\private\autoLight\node_modules\yeelight-awesome\lib\yeelight.js:493:26
at new Promise ()
at Yeelight.sendCommand (E:\private\autoLight\node_modules\yeelight-awesome\lib\yeelight.js:472:16)
at Yeelight.ping (E:\private\autoLight\node_modules\yeelight-awesome\lib\yeelight.js:446:21)

Commands are not being send using the TCP server set in setMusic()

As far as I've tested/checked, it seems like the music mode is being correctly set, but using the lib's functions like setRGB() are not being sent through the TCP server.

Is there any workaround for that? Besides writing the raw commands and sending them using my own TCP server. Maybe a function to extract a raw command so we can just use that instead of writing by hand?

It would be nice if the lib could start it's own TCP server for each device and send the commands directly through it, if the device is in music mode.

TypeScript declarations

Great package.

The yeelight-awesome sample worked fine in JavaScript but when I used TypeScript syntax

import {Discover, IDevice} from 'yeelight-awesome';

I'm told there is no declaration file.
image

I very much appreciate that the package is in TypeScript so I presume there is a simple npm install issue.

BTW, the instructions tell me I need to put the bulb into LAN mode. I didn't find the setting but, fortunately, it jus worked anyway. Maybe the app has been updated.

scanByIp is run on a timer and does not wait for previous ip scan to finish. Exhausts system resources.

See here, IP scan is done on a timer.
https://github.com/samuraitruong/yeelight/blob/master/src/discover.ts#L128

Each IP scan will iterate over all the IPs:
https://github.com/samuraitruong/yeelight/blob/master/src/discover.ts#L76

Previous scan may still be in progress, a timeout takes at least minute on macOS and Android. The default interval is 200ms.

This results in each IP with no host behind it having 300 pending operations before the operation starts timing out. Roughly 60000 pending sockets (file descriptors) if 200 IPs are unavailable.

Suggested fix:
Keep track of the IPs being scanned, and filter that out in availabledIps.

several function that i can make it works in JS

Hi !

I can't make several function work in JS like setBright, scanByIp ...

here bellow a part of the code:

        const yeelight = new y.Yeelight({lightIp: req.params.lightIp, lightPort: lightPort});
        yeelight.connect().then((l) => {
            l.setBright(req.params.brightness, req.params.effect, req.params.duration).then(() => {
                l.disconnect();
                return res.status(200).send("Set Brightness command successful");
            });
        }).catch((e) => {
            return res.status(404).send(e);
        });

Can someone help me ? please

Thanks

nice.

learning an hour documents is not as good as npm your yeelight. nice~ nice so much~ you are my yeelight. i love you...

Set scene already created with phone

Hi,
is it possibile to set a scene already created with phone?
Example:
I created the scene "Watch Movie" with my phone. It sets 2 lights on blue color and powers off 1 other light.
Is it possibile to activate the scene via this npm module?

Thanks

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.