[QuantityType] Time does not accept y as unit
Closed this issue · 3 comments
Expected Behavior
If setting up an Item of type Number:Time
, it should be possible to use y
as unit.
Number:Time bsP1Age "Alter" (gScale) ["Duration"] {channel="mqtt:topic:mosquitto:bs444:age", unit="y"}
should result in an Item state with years and fractions of years, e.g. 50 y
or 50.83 y
Current Behavior
when defining the Item as above, this results in a warning:
[WARN ] [penhab.core.library.items.NumberItem] - Unit 'y' could not be parsed to a known unit. Keeping old unit 's' for item 'bsP1Age'.
Environment
- Version used: openHAB4.1.0 (but also true for older versions)
- Operating System and version: debian bookworm (amd64 in proxmox lxc)
Interestingly, the corresponding channel is also of type number with unit y
and openHAB does not complain about (but the value isn't calculated correctly from y
to s
)
Type number : age "Alter" [ stateTopic="bs444/udo/", transformationPattern="JSONPATH:$.age", unit="y" ]
All other units (s
, min
, d
, h
, week
) seem to work as intended.
This issue has been mentioned on openHAB Community. There might be relevant details there:
https://community.openhab.org/t/number-time-doesnt-accept-y-as-unit/152273/4
I just had a quick look at the underlying code from indriya and our code, it looks like y
should be supported. Can you please define a Number:Time
item with unit s
and update it from the console openhab:update MyItem "1 y"
and check if that works?
This is a bug in indriya. While the symbols are added for hour, minute, day, they are missing for week, month, year (even though they are declared).