[INFO ] [ation.script.ui.rule_escootercharger] - XXX90900.408 kWh0.409 kWh0.28 kWh6.008 kWh
I would expect that the first 2 items are logged as 90%90% instead off 9090.
To be honest I don’t get along with these QTY blocks…
Any suggestions?
mr.airworthy:
The “[WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn’t exist: undefined” is added every single time I start the iOS openHAB app (iOS 17.0.2). So this has nothing to do with my f*cked up rule/script.
Agreed. It means you have a Widget or something open in MainUI that refers to an Item that doesn’t exist, or MainUI is asking for the state of an Item that has not yet loaded.
mr.airworthy:
I would expect that the first 2 items are logged as 90%90% instead off 9090.
Well, what type of Item are they? If they are just Number
then there are no units involved. If they are Number:Dimensionless
did you set the unit
metadata on the Item? If not they are being treated as a simple ratio ONE which doesn’t have a unit that shows up when logged (it’s the only unit that behaves this way).
But still, I’m not sure you got my original point. Interleave a log block in between each of the block that make up your script so we can tell exactly which block is throwing the exception. If we cannot narrow the problem down to a specific block/line of code .
mr.airworthy:
To be honest I don’t get along with these QTY blocks…
You have the option to not use units at all. Just set your Items to be Number instead of Number:Something and there will be no more units.
rlkoshak:
Well, what type of Item are they? If they are just Number
then there are no units involved. If they are Number:Dimensionless
did you set the unit
metadata on the Item? If not they are being treated as a simple ratio ONE which doesn’t have a unit that shows up when logged (it’s the only unit that behaves this way).
But still, I’m not sure you got my original point. Interleave a log block in between each of the block that make up your script so we can tell exactly which block is throwing the exception. If we cannot narrow the problem down to a specific block/line of code .
I defined them as Number:Dimensionless
and set the unit as Metadata (%d %%). After your post I changed them to Number
only without removing the Metadata
.
Unfortunately I have no idea how to connect the Logging & Output
blocks to all the other blocks I’m using already.
rlkoshak:
You have the option to not use units at all. Just set your Items to be Number instead of Number:Something and there will be no more units.
Is it still ok/possible to use Metadata
to set units for display purposes?
Thank you for your help!
That looks like a state desciption pattern. In OH 4 that only changes how the Item appears in the UI. The unit
metadata is required to define the unit you want the Item’s state to carry. They can be different and, when you don’t define the unit
metadata often they are different.
Is it still ok/possible to use Metadata
to set units for display purposes?
If you’ve not set the unit
metadata, your Item is carrying a unit of ONE
which is a simple ratio.
mr.airworthy:
Is it still ok/possible to use Metadata
to set units for display purposes?
You can set the state description pattern to what ever you want. But the unit part will not cause the state of the Item to be converted to that unit. It will just tack the “unit” as a string after the raw state of the Item.
When you use Number:Something and supply a unit in the state description, the state of the Item will actually be converted, where necessary, to that unit for display. For example, if the Item is carrying Wh and the state description says to use kWh, the state of the Item will be divided by 1000 before display. If not, it will just append “kWh” as a string to the Wh value.