Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
TipicoDev opened this issue Apr 11, 2021 · 2 comments
Open

Comments

@TipicoDev
Copy link

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.

@samuraitruong
Copy link
Owner

can you share your code snipet?

@TipicoDev
Copy link
Author

@samuraitruong here's a simple test I made using net:
Starting the TCP Server

const server = net.createServer();
server.listen(port, host, () => {
    console.log('TCP Server is running');
});
server.on('connection', function(sock) {
    console.log('CONNECTED: ' + sock.remoteAddress + ':' + sock.remotePort);

    sock.on('data', function(data) {
        console.log('DATA ' + sock.remoteAddress + ': ' + data);
    });
});

Starting the music mode

discover.on("deviceAdded", async (device: IDevice) => {
    console.log(`new yeelight device found: ${device.host}:${device.port}`);
    let yeelight = new Yeelight({
        lightIp: device.host,
        lightPort: device.port
    });

    await yeelight.connect();
    await yeelight.setMusic(1, host, port);
});
discover.start();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants