Skip to content

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

Open
@Joncy

Description

@Joncy
Member

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

Activity

abhiche

abhiche commented on Apr 4, 2016

@abhiche

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

jsdario

jsdario commented on Apr 4, 2016

@jsdario
Member

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

abhiche commented on Apr 4, 2016

@abhiche

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

jsdario commented on Apr 5, 2016

@jsdario
Member

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

Joncy commented on Apr 5, 2016

@Joncy
MemberAuthor

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jsdario@abhiche@Joncy

        Issue actions

          Temperature method in API should also allow other measurement systems · Issue #10 · netbeast/api