I tries to make postUpdate with QuantityType object in “new” JS rule and can’t. Can somebody point me - what I’m doing wrong?
const QuantityType = Java.type('org.openhab.core.library.types.QuantityType');
...
item.postUpdate(new QuantityType("220 V"));
I’m got next error
[ERROR] [org.openhab.automation.script.rules ] - Failed to execute rule Update-Shelly_EM3_2_AVoltage----Equipment_ElectricityHomeVA-73a71a70-0be8-4670-870f-53171000c542: TypeError: invokeMember (postUpdate) on org.openhab.core.automation.module.script.internal.defaultscope.ScriptBusEvent@7cc1bcd7 failed due to: Multiple applicable overloads found for method name postUpdate (
candidates:
[Method[public java.lang.Object org.openhab.core.automation.module.script.internal.defaultscope.ScriptBusEvent.postUpdate (org.openhab.core.items.Item,org.openhab.core.types.State)
],
Method[public java.lang.Object org.openhab.core.automation.module.script.internal.defaultscope.ScriptBusEvent.postUpdate
(org.openhab.core.items.Item,java.lang.Number)]
],
I found that QuantityType implemented org.openhab.core.types.State and extends java.lang.Number so Java does not know which method should use.
Sure, I can convert QuantityType to number and its working BUT item lost related QuantityType info