Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API - Color values can be set to a color name string #2072

Closed
flatsiedatsie opened this issue Aug 10, 2019 · 1 comment
Closed

API - Color values can be set to a color name string #2072

flatsiedatsie opened this issue Aug 10, 2019 · 1 comment

Comments

@flatsiedatsie
Copy link
Contributor

When you ask about the color of device (lamp) via the API you will receive a hexadecimal string.

By accident, I updated the API with normal color names instead of hex color codes. I was happy to see that actually worked as well. The color changed.

However, if you then query the same property for the color again, you will get the string of the color name back, and not a hexadecimal value.

It could be that this is 'working as intended', but it made the API a little unpredictable, so I wanted to make sure. I've since made sure my code always (and only) sends hex values to the API, so that I will only ever receive hex values when I query it.

@mrstegeman
Copy link
Contributor

This is really up to the adapter to handle, in the setValue()/set_value() method.

The W3C spec has support for a format member of a (string) property, which could be used to specify a regex, but we don't currently support that. I opened WebThingsIO/api#141 for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants