Multiple Selector Annoyance / Bug

Just letting you know this is and isn’t a bug, but could be a major annoyance especially when trying to sanitise code.

When sending multiple selectors and you need to seperate the selectors by a comma. Your API breaks if you have a comma then a space. It throws an error saying unknown selector ‘group’. Which is obviously the beginning of the selector.

Once you take the space away from after the comma it seems to work fine. I can just see problems if you are trying to write automated code or make it so that the data is readable in a database…

Probably not a major concern, but I thought I’d make note of it.

The error you received wouldn’t have made it obvious there was an extraneous space in front of the selector, so we’ve deployed a change that adds quotes around the invalid selector type so it’s more obvious.

Given the selectors are also used in the URL, we’re trying to avoid having whitespace in any selector definition at all. The label based selector types (label, group, location) are convenience selectors for personal-level projects as they’re fragile (won’t work if the user renames the device, group or location) and should be avoided where possible.

The safest way to compose the selector string is to use a string join method. For example, in Ruby: ["id:xxxxx", "id:xxxxxx"].join(",")

And similarly, I assume the label-based selectors won’t work if the labels contain commas. That had been bothering me, but I guess the answer is that an application that wants to be bulletproof should use ids instead of labels.

Indeed. It’s useful for quick scripts or just toying around with the API, but it’s always worth using ID-based selectors wherever possible.

Yeah… I opted out for that mostly because I’m basically making a lifx HUB on a Pi and to do it that way I’d need to reference name versus ID in each pull and place them inseperate tables in a database every time I wanted to refer to them. And I’m not validating it every time

I basically made this for myself… didn’t think anyone would want my software :stuck_out_tongue: – essentially a hub with a web interface that fpings devices for a geofence all written in PHP and uses a CSS template to manipulate the lights on a touch screen through a Raspberry Pi and gives you functionality for using say Tasker on an Android mobile for things like Flic buttons and icons on your phone screen.

That sounds a bit like my next job, I have the 7 inch touch screen for the pi and am going to make a smart switch with it. If you ever get around to posting the code let us know, I would appreciate it.

I just need help with the UI… I hate CSS… my CSS doesn’t seem to want to play fair… Then I can start value adding to it… who knows… if I can get that to work… I might be able to start getting it to release.