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

Add unit conversions to age, dimension, temperature #3037

Open
chrimc62 opened this issue Jan 20, 2021 · 0 comments
Open

Add unit conversions to age, dimension, temperature #3037

chrimc62 opened this issue Jan 20, 2021 · 0 comments
Assignees
Labels
feature-request A request for new functionality or an enhancement to an existing one. generated Generated dialogs related issues

Comments

@chrimc62
Copy link
Contributor

chrimc62 commented Jan 20, 2021

With $units we know enough to be able to automatically convert dimension units, i.e.
$units = feet, convert kilometer, hectometer, inches, etc. and vice versa.
We can also convert areas and perhaps as a bonus currency although that requires an API call to an exchange. I suspect the best way to do this is to create some custom LG functions to do the conversion, i.e.

# convert(entity, desiredUnits)
- SWITCH:
- CASE ${'Inches')
    - SWITCH ${entity.units}
    - CASE ${'Inches'}
  ...

and perhaps 
# canConvert(entity, desiredUnits)

Then we can use those in the generated dialogs to convert units automatically or complain about not being able to convert. For example if $units = Inches.

"3 feet" would automatically be converted to "36 inches"
"3 square meters" would complain "expected inches"
etc.

We also need to add combination logic, i.e. "6 foot 1 inches" results in this:

"dimension": [
        {
          "number": 6,
          "units": "Foot"
        },
        {
          "number": 1,
          "units": "Inch"
        }
      ]
@chrimc62 chrimc62 added generated Generated dialogs related issues feature-request A request for new functionality or an enhancement to an existing one. labels Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A request for new functionality or an enhancement to an existing one. generated Generated dialogs related issues
Projects
None yet
Development

No branches or pull requests

2 participants