Coder Social home page Coder Social logo

Comments (8)

markg85 avatar markg85 commented on August 23, 2024 1

Sure, done.
I will report back in about 12 hours or so :)

from node-milight-promise.

mwittig avatar mwittig commented on August 23, 2024

Regarding issue 1), this may be a session timeout indeed. Perhaps, the current iBox2 uses a shorter session timeout than the older makes. Session keep-alive would certainly solve the issue.

One thing you can try:
There is hard coded time for sessions, i.e. session will be reset if not used for 300 seconds. You can change that to a more aggressive timing, say 30 seconds. For this you need to change the timeout value to 30000 in line 67: https://github.com/mwittig/node-milight-promise/blob/master/src/milight-v6-mixin.js#L67

I'll make that configurable with the next release and possibly change the default.

Regarding issue 2) I am not sure. At a first glance your code only seems to handle either rgbww or cct or fullColor depending on the response of the '/gateways/:addr/:type/:group' post request. Does a group switch trigger multiple post requests? Did you trace the post responses?

from node-milight-promise.

markg85 avatar markg85 commented on August 23, 2024

Hi Marcus,

I've just set that at 30 seconds (30000) as advised. However, i'm a bit skeptical if this will work.
After a couple of hours (before changing it) the commands simply didn't work anymore. Here's a debug output of that time.

...
2017-12-16T12:57:29.474Z Milight: bytesSent=27, buffer=[0x20,0x00,0x00,0x00,0x16,0x02,0x62,0x3A,0xD5,0xED,0xA3,0x01,0xAE,0x08,0x2D,0x46,0x61,0x41,0xA7,0xF6,0xDC,0xAF,0xD3,0xE6,0x00,0x00,0x1E]
2017-12-16T12:57:29.587Z Milight: bytesReceived=22, buffer=[0x28,0x00,0x00,0x00,0x11,0x00,0x02,0xF0,0xFE,0x6B,0x26,0x15,0x6A,0x5F,0xB8,0x80,0x30,0x00,0x01,0x67,0x00,0x00], remote=10.0.3.101
2017-12-16T12:57:29.687Z Milight: ready for next command
2017-12-16T12:57:29.687Z Milight: Session Id: 0x67,0x00
specific post
{ status: 'off' }
2017-12-16T12:58:42.257Z Milight: bytesSent=22, buffer=[0x80,0x00,0x00,0x00,0x11,0x67,0x00,0x00,0x93,0x00,0x31,0x00,0x00,0x08,0x04,0x02,0x00,0x00,0x00,0x02,0x00,0x41]
2017-12-16T12:58:42.380Z Milight: bytesReceived=8, buffer=[0x88,0x00,0x00,0x00,0x03,0x00,0x93,0x01], remote=10.0.3.101
2017-12-16T12:58:42.480Z Milight: ready for next command
specific post
{ status: 'on' }
2017-12-16T12:58:58.317Z Milight: bytesSent=22, buffer=[0x80,0x00,0x00,0x00,0x11,0x67,0x00,0x00,0x94,0x00,0x31,0x00,0x00,0x08,0x04,0x01,0x00,0x00,0x00,0x02,0x00,0x40]
2017-12-16T12:58:58.497Z Milight: bytesReceived=8, buffer=[0x88,0x00,0x00,0x00,0x03,0x00,0x94,0x01], remote=10.0.3.101
2017-12-16T12:58:58.598Z Milight: ready for next command
specific post
{ status: 'off' }
2017-12-16T12:59:09.598Z Milight: bytesSent=22, buffer=[0x80,0x00,0x00,0x00,0x11,0x67,0x00,0x00,0x95,0x00,0x31,0x00,0x00,0x08,0x04,0x02,0x00,0x00,0x00,0x02,0x00,0x41]
2017-12-16T12:59:09.707Z Milight: bytesReceived=8, buffer=[0x88,0x00,0x00,0x00,0x03,0x00,0x95,0x01], remote=10.0.3.101
2017-12-16T12:59:09.807Z Milight: ready for next command
...

As you can see, right after a reconnect (the 27 bytes buffer) the commands still don't work at all.
I really have to turn off the app and start it up again.

We'll see if the 30 second reconnect solves it, i will report back about that one.

Regarding the group switch. As far as i can tell it's only doing one post per command.

from node-milight-promise.

markg85 avatar markg85 commented on August 23, 2024

To get back on the 30 second part. It works!
I've had that since the last post (for about 10 hours now) and no problems at all.

The fact that it works doesn't mean that it's the right fix in this case ;)
I think the keep alive packets are the solution. What i think happens now is probably a connection every 30 seconds so the device probably never went to sleep (neither will it do with keep alive) and that probably makes it work. It 'feels' fragile though.

from node-milight-promise.

mwittig avatar mwittig commented on August 23, 2024

Sounds great.

Note, there is no connection as the protocol is based on UDP. "Session start" and "Session keep-alive" are just datagrams sent to the bridge. I doubt the bridge can handle keep-alive datagrams in sleep mode. Most likely there is no sleep mode at all. Unfortunately, I don't have a USB power meter to check that.

from node-milight-promise.

mwittig avatar mwittig commented on August 23, 2024

Can you please do me a favor and check the same with 150 secs (150000)?

from node-milight-promise.

markg85 avatar markg85 commented on August 23, 2024

150 seconds is a no-go.
It works for - say - the first 10 minutes (i didn't measure this!) or so, after that nothing works anymore.

I'm back to 30 seconds as that seems to work really well.

from node-milight-promise.

mwittig avatar mwittig commented on August 23, 2024

Thanks for the update! I'll change the default value to 30000 then and I'll look into implementing keep-alive soon which is fairly easy to do.

from node-milight-promise.

Related Issues (20)

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.