Jython, extract a unit from an item

Tags: #<Tag:0x00007f61660c2c08> #<Tag:0x00007f61660c2a00> #<Tag:0x00007f61660c2820>


probably a simple matter, but I have not found a solution yet.
I would like to store the unit of an item in a variable and achieve this via a jython rule.

For example:

Number:Temperature		System_Temperature_CPU_num	"Temperatur CPU [%.1f %unit%]"		<temperature>

The result should be “°C”, stored in a variable. Thanks!

The unit would not be from the Item, but from the Item’s state. So, assuming the Item has a state that is a QuantityType…


In the DSL…

1 Like

Sure, that’s exactly what I was looking for, thought it worked right over the item… once again, thank you very much!