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

Temperature method in API should also allow other measurement systems #10

Open
Joncy opened this issue Apr 1, 2016 · 5 comments
Open

Comments

@Joncy
Copy link
Member

Joncy commented Apr 1, 2016

Considering that the whole US and UK use Farenheit degrees instead of Celsius, support for such system should be provided.

Example proposal:

temperature.get/set(value, "measuring system")

┆Issue is synchronized with this Asana task

@abhiche
Copy link

abhiche commented Apr 4, 2016

Just a slight enhancement to @Joncy suggestion.
How about setting it unit once rather than specifying it everytime:
temperature.setUnits(TEMP_UNIT.CELCIUS)

@jsdario
Copy link
Member

jsdario commented Apr 4, 2016

This is tricky: each device / plugin may announce the measured temperature in a different format. For that, what about implementing it through a JSON common format?

If temperature is a string, it can be interpreted as CELSIUS, but in JSON:

{ farenheit: 451 }

We do like this with colors. Then we can transform between different systems as you guys mentioned above.

@abhiche
Copy link

abhiche commented Apr 4, 2016

Hope I get your point.
But if you provide {fahrenheit : x} as result, and if at a later stage, to switch to celcius will need the developer to refactor the code.
Instead I would recommend to provide {temperature :x} as the result. Since the developer knows which unit he has set already.

@jsdario
Copy link
Member

jsdario commented Apr 5, 2016

The problem is that the data is shared across the plugin ecosystem, thus is not only matter of the developer only, and the rest of plugins must understand the data and the format. Having the netbeast npm package a suite of temperature functions to change scales is not big deal, but the scale must go beside the data.

So our best options are JSON { farenheit: 451 } or strings 451Fº which I do not really like... In any case this as you pointed @abhiche must be wrapped:

{ temperature: { celsius: 36 } }

@Joncy
Copy link
Member Author

Joncy commented Apr 5, 2016

I feel that doing it with JSON and with the implementation @jsdario last proposed would be the best way

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

3 participants