Search:

Type: Posts; User: Ron; Keyword(s):

Search: Search took 0.10 seconds.

  1. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    Correct. Endianess is reversing the bytes, not...

    Correct. Endianess is reversing the bytes, not sorting them! (Strictly your examples are not correct but I think you got the idea).

    To manually do the endianess go via hexadecimal representation....
  2. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    Unfortunately update_at isn't documented so I...

    Unfortunately update_at isn't documented so I can't tell, but I'm guessing it milliseconds since epoch. Do you need to decode this information? If so you could probably drop some accuracy before ...
  3. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    Yeah that doesn't look entirely right. I don't...

    Yeah that doesn't look entirely right. I don't think sort is the right approach there. Did your unpack8,16,32 and 64 functions not work?

    Also yes Lua doesn't do 64 bit integers. It uses doubles if...
  4. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    Yes there is some confusion about what parts are...

    Yes there is some confusion about what parts are little and what parts are big. The MAC address is not reversed, you can check by taking the first 6 characters and looking up the OUI:...
  5. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    print("val: ", unpack16(data, 1)) This takes...

    print("val: ", unpack16(data, 1))

    This takes the first two bytes of the data and gives you the numerical value of that. The first two bytes are 29 and 00, this is big endian. In Little endian...
  6. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    Cheers, Happy New Year!

    Cheers, Happy New Year!
  7. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    correct you should feed it the data variable...

    correct you should feed it the data variable directly. It's definitely not nil, you printed it in the example above.
  8. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    tonumber is not defined inside the module, You...

    tonumber is not defined inside the module, You have to explicitly include it (see local print = print at the top). That data is not unexpected. Again remember now you are printing the byte string as...
  9. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    you must feed unpack the raw binary not the hex...

    you must feed unpack the raw binary not the hex decoded string.
  10. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    You cannot run that file outside of Girder. It...

    You cannot run that file outside of Girder. It requires Girder's transport module, which is a binary not a lua file.
  11. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    On second thought here it is: ...

    On second thought here it is:



    require('lifx')

    lifx.setLight(120,100,100,3500,1000)
  12. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    already done, see next message.

    already done, see next message.
  13. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    Your going the wrong way :) -- LIFX...

    Your going the wrong way :)



    -- LIFX encoder -- https://lan.developer.lifx.com/docs/introduction


    local function pack32( value )

    local b1 = bit.band( bit.rshift( value , 24),...
  14. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    Yes or transport.udp ( see manual under...

    Yes or transport.udp ( see manual under scripting, transport, UDP connections)
  15. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    OK. Let me know how it goes!

    OK. Let me know how it goes!
  16. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    The one thing I am worried about it that you are...

    The one thing I am worried about it that you are assuming that you will get the data in a base-2 string. You will most likely not. They are using that representation in the documentation for clarity...
  17. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    "\52\00" -- equal to 00110100 00000000 ...

    "\52\00" -- equal to 00110100 00000000

    00110100 = 52 in decimal or 34 in hexadecimal
    00000000 = 0 in decimal or 0 in hexadecimal
    I'm just feeding the algorithm what you would get from Lifx.
    ...
  18. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    See attached, don't confuse the binary in the...

    See attached, don't confuse the binary in the math functions with base2 numbers. It's meant to indicate that the string is treated as a opaque sequence of bytes without treating it as ascii. I just...
  19. Thread: LIFX bulbs

    by Ron
    Replies
    44
    Views
    4,994

    There are a bunch of hex to binary functions...

    There are a bunch of hex to binary functions under math. For example math.binaryToHexString and hexStringToBinary. There is no big-to-little or vice verse built in but that should be too hard. What...
Results 1 to 19 of 19