I am using the temperature card multi sensor marketplace widget in my main page
I have defined humidity, temperature and illuminance as the items to display. All three items are read from the modbus binding
Everything was working until I upgraded to 4.2.2
Now, humidity and temperature are displayed but illuminance shows NULL
I have tried removing all the units and made sure the item is of Number type, but no luck
Do you means has a null state or has the correct state but doesn’t show up on the widget? What makes you think this is a problem with the widget and not the modbus binding?
Initially I had the units (lx) added at the thing level. Then I removed those units and added the units with metadata, then I removed all units and just left a number item. Nothing seems to work
However if I replace illuminance with something like a blind level the value is displayed.
So the widget works but I cannot have it display this particular number type item
Which market place multi widget are you using (there are several, and some have multiple versions)? Instead of finding the marketplace topic, you can just post the widget code directly.
That widget code has a few small errors in it, but there is no way for it to produce NULL as a result at any point unless that is coming from the item. If you are really seeing NULL (caps) and not null lowercase the caps version is an OH state not a javascript result.
I suggest you go to the developer toolbar and select the widget expression tester (the
button).
In the text area put:
=items.your_lx_item_name
and see if the output actually includes proper item states or if the items is in fact returning a NULL state.
This is a pretty old widget. I suspect that the reason you saw it break is that this was made for OH3 and OH4 has more advanced information in the payload of number items. The illuminance line:
Was previously working when your item had a display state so that it didn’t get to the second half of the expression. In OH4 something changed about your item that meant it no longer had a correct displayState so the next test was checked to make sure that the item actually had a regular state. Your item does, and that’s where the error in the widget code comes in. After the item is found to have a legitimate state it attempts to display that state but the last call in that expression has a typo and uses items[props.illuminance].state when the property itself starts with a upper case I. So all you need to do is change that lowercase i to uppercase and it should work.
Note: When a widget expression calls an item that doesn’t exist, as in this case it returns -. That is not the same thing as NULL and it is not the same thing as null.
I deleted everything, downloaded the widget again and now everything works. The error you found is my own, trying to modify a widget without knowing exactly what I am doing. I don’t know why it worked before and it stopped working when I upgraded OH