I have a couple of Siemens devices connected via the Home-Connect binding. As soon as you turn the device off, a bunch of items return to the ‘UNDEF’ status. As far as I can tell, this is expected behavior.
But not really a nice sight in the UI…
Looking for a way to replace 'UNDEF with something nicer in the UI, I am trying to solve this with a ‘State Description’ pattern, hoping the following transformation would do the trick, but it does absolutely nothing. JS(| input == 'UNDEF' ? '-' : input):%s
I have a feeling I am approaching this the wrong way.
Usually I do this within the item definition, using a MAP file. Works well. In have no experience with the script version. Maybe the documentation can help.
Is there anything in the openhab.log? I assume you installed the Map Transformation Add-on.
You may check the real items value that needs to be transformed with a logInfo statement in a rule so the entry in the MAP file matches exactly.
Just to confirm. In the openHAB 3 UI, that would be done with the ‘State Description’ metadata, right?
I just tried mapping NULL and/or UNDEF, but still no change to what I see in the item’s representation. It feels like I am missing something really obvious
In OH2, internal “preprocessing” for the equivalent of displayState presented a “-” for display, when actual state is NULL or UNDEF.
This will still be present in OH3, i.e.if you look at a sitemap-using UI you will see - not NULL, with no other formatting.
Where are you looking? The Item state will still be UNDEF, so an “administrators” view of the Item should still show UNDEF.
Fpr prettifying a “user” view, you’ll need to identify what UI and widget you are trying to use.
I’m not sure that 0 is going to work well with datetime formatters.
Even when It had some value, stateDescription did not work and I spotted something wired related to default profile in F12 Developers tool, I had to delete this item and re-create it.
After this when value exist it started showing value like xx:xx:xx.