Is there a way to “request” and item state in a specific unit in a widget, similar to toUnit()
?
I haven’t managed to find anything, and I get that normally the widget should work with whatever unit the Item provides. There are however situations where you want to apply formulas or other calculations where you need to know that you work with a specific unit. I guess you could make something by splitting the state to get the unit string and then use ternary operations to provide a different calculation for all possible units, but doing all this in widget expressions quickly gets very ugly and error-prone.
Ideally you could convert it to a unit of your choice, do your calculation, and then convert the end result back to the unit provided by the Item - but I get that this probably is far from what’s currently possible.