Jython, QuantityType, unexplained behaviour of a rule

I can also reproduce this and I think it would be a good idea to open an issue in OHC. Include the settings you have used in Paper UI under Configuration> System> Regional Settings. Specifically, Country/Region and Measurement System. In case it’s not clear, this has nothing to do with Jython or scripted automation and can be seen in the console.

1 Like

I don’t think it’s a bug:

Dimensionless does not have a default unit, though it has but only shown in sitemap
image

defining item:

Number:Pressure  Test_Item  "Test Item [%.1f %unit%]"

it works as it has default unit

Comment - Number:Dimensionless are a bit weird. If you postUpdate a simple number, “3.14” for example, the default “unit of one” will treat it as though it were a ratio, 3.14 to 1. That ratio, if you now express it as a percentage (by using [%.1f %%] for example), is 314%
You could have it as 4.97 dB if you like!

Most of the QuantityType Items will blow up if you post a simple number, e.g. linking a Number:Temperature to a binding channel posting only 22.5 will fail - is that C, F or K? It’s meaningless with no unit.

However, if you link a Number:Dimensionless to say some humidity sensor posting 66.0 … it will get accepted as valid for that type and handled as 6600%

I you do no formatting e.g. %.1f, then you have to be explicite and add the dimension you want.

In rules scalar values are king, if not other needed to accomplish the wanted result.

Yes. But in the special case of Number:Dimensionless, just a number 3.14 is treated as explicit and valid, as though it were 3.14:1