Giter Site home page Giter Site logo

lifxjs's People

Contributors

benkitzelman avatar elliots avatar imrehg avatar jtdevos avatar lucymhdavies avatar magicmonkey avatar mauricebutler avatar mrose17 avatar riverar avatar sjcliffe avatar ssteve avatar stormboy avatar torosian avatar yonilevy 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  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  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

lifxjs's Issues

Documentation for fade_time

I spent a while working with the fade_time parameter today, trying to figure out its quirkiness (because it certainly is not milliseconds or seconds). At least on the two kickstarter bulbs I received a few weeks ago, the following formula seems to apply:

(fade_time parameter) = ((seconds)*225)^2

I have tested this, and it seems to work appropriately for all fade times large and small (less than a second up to several minutes). The 225 value is estimated based on testing, but the formula definitely seem to be quadratic.

See this graph for my test results: http://i.imgur.com/sbUEkGi.png

It may be worth including this formula in the docs, or even accepting "seconds" as the parameter in code, and converting it with this formula before sending it to the bulb. Additional testing is probably required to make sure this works on other shipments of the bulb as well.

More natural color values

I saw that the official API uses int16 numbers for the colours, but it feels unnatural to me.
Would be nice to make abstraction of that at let us use a more natural writing style. something like: lx.lightsColour(170, '50%', '45%', .6, '1000ms') or maybe just provide a helper function that will do the math.

I think it would make it dramatically easier to use lifxjs for anyone likes me who comes from the frontend side of JS.

For me this is an issue, but please consider it as a suggestion.

Question - LightStatus Dim vs SetDim<Abs/Rel>

Just checking - has anyone played with the Dim value? It seems odd that it's a UInt on the reporting and an Int on the setting.

I'm digging into it, but thought I'd ask if others have any experience with that value.

Bulb goes to sleep.

If my bulbs haven't been used for a while, they go to sleep (seemingly). The Android code will wake them up, but the lifxjs code won't.

lightsd: a daemon with a JSON-RPC API to control your bulbs

Hello, I'm here to say a couple things. First, I'd like to say thanks for all the initial reverse engineering work that was done here. Second, and I'm sorry if it feels a bit aggressive done this way, but it feels appropriate given how this project is lagging behind and popular:

I'm very pleased to announce the first release of another LIFX project which took about a year to complete:

https://github.com/lopter/lightsd

It is a near-complete implementation of the original LIFX LAN protocol. Read-on the full announcement on the LIFX forum:

https://community.lifx.com/t/lightsd-a-daemon-with-a-json-rpc-api-to-control-your-bulbs/446

Wireshark dissector: Range is out of bounds

I've been trying I use the dissector provided by the project, but in some packets marked with LIFX as description i get the following error:

Lua Error: [string "/path/to/lua/script/l..."]:436: Range is out of bounds

Packet's content:

0000   00 00 20 00 2a 48 18 00 00 00 6c 09 80 04 d1 01  .. .*H....l.....
0010   00 00 0f 00 07 00 00 00 9c 50 04 00 00 00 00 00  .........P......
0020   88 01 2c 00 d0 73 d5 00 5b 73 78 d6 f0 05 7d 17  ..,..s..[sx...}.
0030   d0 73 d5 00 5b 73 20 05 00 00 aa aa 03 00 00 00  .s..[s .........
0040   08 00 45 00 00 cd 95 2f 40 00 40 06 4c d8 ac 10  ..E..../@[email protected]...
0050   00 02 ac 10 00 01 85 ba dd 7c 41 1b 2e 03 d8 e8  .........|A.....
0060   78 e9 50 18 58 74 5c 07 00 00 17 03 01 00 a0 1f  x.P.Xt\.........
0070   fe 5d 72 15 ac 5f 1f 1a bc 22 fb 6f d1 27 48 6f  .]r.._...".o.'Ho
0080   5a 88 54 3f 85 a7 4c 8b 0c e9 62 ce 18 b8 b0 ed  Z.T?..L...b.....
0090   12 1a 42 db 80 1f 61 63 70 ad fc 2b 62 71 c1 2a  ..B...acp..+bq.*
00a0   16 0b 34 65 4c e6 30 ee b3 6d a9 53 29 23 8b a9  ..4eL.0..m.S)#..
00b0   a1 38 5b 8c 72 cf 0b 4d 97 6b 58 40 07 89 20 c3  .8[.r..M.kX@.. .
00c0   0b 5d 19 70 b2 72 25 51 d1 88 e2 cf 5b 42 ee ff  .].p.r%Q....[B..
00d0   6a cc 05 98 62 0b 10 9f 36 f1 d8 29 83 cd 5d ac  j...b...6..)..].
00e0   7d d2 e9 2e 2e 23 d7 b6 ea 46 7b 35 6c 99 3f c7  }....#...F{5l.?.
00f0   3b 12 dd 76 2c 69 ac f6 df 1a 79 22 df c3 79 53  ;..v,i....y"..yS
0100   ea a7 95 bd 70 3b 47 9e c8 2c 7a 0a 6e f7 f1     ....p;G..,z.n..

Error in Web module?

Hi,
I can start node app in the /lifx/web folder.
On the browser http://ip:3000/test.html, I get the color chart.
but when I click on the Choose button, an error shows up in the terminal window (and lamp does not change anything). I am new in node and cant find the source of this problem. help? PS: the cli2 and others do work!

Kas

pi@raspberrypi:~/node_modules/lifx/web$ node app
Listening on port 3000
New bulb found: 01
TypeError: value is out of bounds
at TypeError ()
at checkInt (buffer.js:781:11)
at Buffer.writeUInt16LE (buffer.js:809:5)
at Object.type.uint16_le.unparse (/home/pi/node_modules/lifx/packet.js:140:13)
at Object.packet.fromParams (/home/pi/node_modules/lifx/packet.js:69:26)
at Object.setLightColour (/home/pi/node_modules/lifx/packet.js:13:19)
at Lifx.lightsColour (/home/pi/node_modules/lifx/lifx.js:272:23)
at /home/pi/node_modules/lifx/web/app.js:14:5
at callbacks (/home/pi/node_modules/lifx/web/node_modules/express/lib/router/index.js:164:37)
at param (/home/pi/node_modules/lifx/web/node_modules/express/lib/router/index.js:138:11)

Color seems over-specified?

The color seems over-specified for an RGBW bulb:
{name:"hue" , type:type.uint16_le},
{name:"saturation", type:type.uint16_le},
{name:"brightness", type:type.uint16_le},
{name:"kelvin" , type:type.uint16_le},
hue and saturation specify color one way, but kelvin sets the color another way. Has anybody figured out what color you get for various combinations of these parameters?

LiFX 2.0 Protocol

LiFX 2.0 firmware upgrade broke the protocol.
The On/Off command changes to: proto=0x14, packettype=0x75 with the same payload, The SetColor command changes to proto=0x14, same packettype and payload.

Registration?!?

The protocol doc says:

Configuration of a bulb involves connecting to the bulb's hosted network and sending a "set access point" message to the bulb. This message contains the information it needs to join your existing wireless network infrastructure (such as SSID and password). Networks using WEP security are not supported.

But how does one do this?!?

Can't target single bulb to change hue

Using lightsColour to set a bulb on or off works, when the last parameter is a bulb object. However, when changing the hue, it does not change. Omitting the bulb parameter (thus targeting all), the color changes.

INFO: Re: Discovery responses

I have 10 bulbs connected to my network right now, and I also only receive 2 copies of type 0x03 with byte 36 varying between 1 and 2. Although I don't have an explanation as to why there are the duplicate messages, its not bound to the number of bulbs.

Slow response time

Recently been having trouble with slow response time. I'm playing with multiple LIFXs. Sometimes one will trigger, then the other 1 second later.

Has anyone encountered that. I'm wondering if there's anything I can do to prevent it. I didn't notice any problem before, but my code seems to be triggering at the right time and the app works perfectly too.

Any tips to help me track down the problem?

Demo web app gives 404 error

Following the instructions for the demo web app results in a 404 error with the message The requested URL /static/test.html:3000/ was not found on this server. Sorry, but I don't know enough about express yet to identify the cause.

Bulb times in nanoseconds, not microseconds?

I've been playing with the bulb get\set time packets, and I think that the bulb sends back a time in nanoseconds, not microseconds as the defined in Protocol.md.

Unpacking the uint64, I get:

1394436731665018000

Which is a valid unix timestamp if we divide by 1e+9 (nanoseconds), not 1e+6 (microseconds).

1394436731665018000 / 1e+9 = 1394436731.665018

Which would be:

2014-03-10 18:02:11

Any thoughts on this? First time playing around with TCP\UDP packets, so could have easily messed up the unpacking.

(Admittedly, these tests were performed on the liftx-python package https://github.com/sharph/lifx-python)

Protocol.md has misleading comments on reserved bits

the comments on the reserved bits are misleading, 0x0000 aren't 32bits and 0x00 aren't 16bits

Fixed:

packet
{
  uint16 size;              // LE
  uint16 protocol;
  uint32 reserved1;         // Always 0x00000000
  byte   target_mac_address[6];
  uint16 reserved2;         // Always 0x0000
  byte   site[6];           // MAC address of gateway PAN controller bulb
  uint16 reserved3;         // Always 0x0000
  uint64 timestamp;
  uint16 packet_type;       // LE
  uint16 reserved4;         // Always 0x0000

  varies payload;           // Documented below per packet type
}

Unknown Packet Type

When I try running my code, it outputs:

"Unknown Packet Type 51"
"Unknown Packet Type 48"
"Unknown Packet Type 54"

I'm relatively new to node js, so I wasn't able to understand why the issue occurred. Any ideas why?

My code is as follows:

var five = require("johnny-five");
var lif = require("lifx");
var board = new five.Board();
var lx = lif.init();

lx.lightsOn();
lx.lightsOff();
lx.lightsOn();

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.