todbot / blink1

Official software for blink(1) USB RGB LED by ThingM
https://blink1.thingm.com/
Other
954 stars 237 forks source link

IFTTT blink1_id validation + multiple blink1_id's for the same IFTTT account? #324

Open UNIVAC-Colonel-Panic opened 6 years ago

UNIVAC-Colonel-Panic commented 6 years ago

Hi,

I would like to tie a blink1_id to the computer where the blink1 is connected and not to an individual blink1's serial#. It would be great if the blink1_id could have human-readable text vs. hex digits, but I'm looking for a way to assign the blink1_id within the current hex digit requirement, and to make it unique enough that there're won't be a collision with planet-wide blink1_id's assigned the "normal" way by the Blink1Control GUI.

I've read http://api.thingm.com/blink1/web-api.txt so I know the blink1_id is a 16-digit hex string.

I know from this comment that one way to form the blink1_id is by doubling the serial#.

Most of the time I expect to have only one blink1 attached to a computer so I would like to use the computer's MAC address as the 12 most significant digits of the blink1_id. Expanding the blink1_id from 16-hex digits to 20 to accommodate the MAC + blink1 serial# does not seem like it would be practical or trivial, so I would use the last four digits as a numerical count of which blink1 out of multiple that might be connected to the same computer:

 <aabbccddeeff><0001>  would represent the first blink1 on computer with MAC aa:bb:cc:dd:ee:ff

Then on each computer, I'd have a Perl version of blink1-ifttt-simple.py running that could be the same on all the computers, because I won't have to hardcode the blink1_id (a.k.a. IFTTT key) -- I'll just use the computer's MAC + "0001":

 http://api.thingm.com/blink1/events/aabbccddeeff0001

If I got to the stage where I did connect multiple blink1's to the same computer, I would likely map the 0001, 0002, 0003, etc. after sorting the blink1 serial#'s in order. 0001 would be the lowest serial#, 0002 the next highest, etc. This way I don't have to hardcode serial#'s to the four digit sequence#.

1) Does http://api.thingm.com do any validation of the hex digits? For example, are there certain hex digit sequences that it might reject altogether?

2) Is there any flaw in my reasoning? Anything I'm missing?

3) Are there any plans to allow the IFTTT blink1 service (channel) to be able to connect multiple blink1_id's to the same IFTTT account? Currently it appears I'll need a different IFTTT account for each blink1_id -- it's manageable for the number of computers I'll be setting up, though a bit of a pain. (I did notice I'm allowed to set up the same blink1_id across multiple IFTTT accounts. I don't see an advantage to doing this; it's just something I tested to see how much validation might be in place already.)