openhab / openhab-vscode

VS Code extension for openHAB configuration files
https://marketplace.visualstudio.com/items?itemName=openhab.openhab
Eclipse Public License 2.0
159 stars 47 forks source link

Add units of measurement #103

Closed Confectrician closed 6 years ago

Confectrician commented 6 years ago

Fixes #102

I have startet with the number types. @kubawolanin i have not used SI units or something else yet. Are there other useful snippets to implement in an initial version?

I have also again adjusted the naming from item-in-items to item-snippet and so on. I think its a bit more clear for users, when they read "snippet" while typing in something in the editor window.

Signed-off-by: Jerome Luckenbach github@luckenba.ch

Confectrician commented 6 years ago

Another thing to discuss:

Should we provide the %unit% selector within the label directly?

kubawolanin commented 6 years ago

Awesome you've picked that one up @Confectrician, many thanks! I was thinking of the %unit% too, since we're already targeting Temperature and such, why not having Celsius and Fahrenheit in place? Just a thought.

BTW. Have you seen the new stuff coming? 😎 https://twitter.com/johannesrieken/status/1009473137434681344

Confectrician commented 6 years ago

Ok i had a though about it and addedd all SI types, expect of time. I have no idea if it conflicts withour DateTime type and don't konw if that one shoulb be preferred.

I was thinking of the %unit% too, since we're already targeting Temperature and such, why not having Celsius and Fahrenheit in place? Just a thought.

So what about adding the %unit%label to everything we already have imperial and metric support. Seems to be Length, Temperature, Speed and Pressure.

BTW. Have you seen the new stuff coming? 😎

That looks really nice. I can already imagine some cool sitemap or rule stuff with this.

Confectrician commented 6 years ago

According to eclipse/smarthome#5770 i would wait with the unit statement until there is a solution. I am not comfortable with probably breaking the persistence because one uses our snippets.

Confectrician commented 6 years ago

Found a usecase for number:time and changed my mind. I will add these too directly. https://community.openhab.org/t/easiest-way-to-convert-seconds-to-minutes/47057