Problem with widget temperature card multi sensor

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

Has anyone seen this?

Thanks

What version did you upgrade from?

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?

I think I upgrade from 4.1

The item has the correct value,

This is the graph during the day

the widget shows NULL

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

Ok, that’s all helpful.

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.

uid: temperature_card_multi_sensor
tags:
  - marketplace:136158
props:
  parameters:
    - description: Label for Items
      name: label
      required: false
      type: TEXT
    - context: item
      description: Temperature Item
      label: Item
      name: temperature
      required: true
      type: TEXT
    - context: item
      description: Humidity Item
      label: Item
      name: humidity
      required: false
      type: TEXT
    - context: item
      description: Illuminance Item
      label: Item
      name: Illuminance
      required: false
      type: TEXT
    - description: Custom Icon (follows standard openhab format)
      name: icon
      required: false
      type: TEXT
  parameterGroups: []
timestamp: Nov 12, 2024, 9:09:36 PM
component: oh-label-cell
config:
  action: analyzer
  actionAnalyzerItems: =[props.temperature, props.humidity]
  footer: '= (items[props.Illuminance].displayState != undefined) ? "Illuminance "
    + items[props.Illuminance].displayState + " lx" :
    (items[props.Illuminance].state != "-") ? "Illuminance " +
    items[props.illuminance].state + "lx": ""'
  header: = props.label
  icon: '= (props.icon != undefined) ? props.icon :
    "iconify:mdi:home-thermometer-outline"'
  label: '= (items[props.temperature].displayState != undefined) ? "Temperature "
    + items[props.temperature].displayState : "Temperature " +
    items[props.temperature].state'
  style:
    background: '= (Number.parseFloat(items[props.temperature].state)) >= 93.0 ?
      "red" : (Number.parseFloat(items[props.temperature].state)) >= 87.0 ?
      "orange" : (Number.parseFloat(items[props.temperature].state)) >= 75.0 ?
      "yellow" : "lightblue"'
  subtitle: '= (items[props.humidity].displayState != undefined) ? "Humidity " +
    items[props.humidity].displayState + "%" : (items[props.humidity].state !=
    "-") ? "Humidity " + items[props.humidity].state + "%": ""'
  trendGradient:
    - gray
  trendItem: = props.temperature

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
image
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.

It should look something like this:
image

Yes, that is what I get

{ “state”: “0”, “numericState”: 0, “type”: “Decimal” }

I am going to delete the widget and start from scratch. See if that helps

Thank you

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:

footer: '= (items[props.Illuminance].displayState != undefined) ? "Illuminance "
    + items[props.Illuminance].displayState + " lx" :
    (items[props.Illuminance].state != "-") ? "Illuminance " +
    items[props.illuminance].state + "lx": ""'

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

It’s working now.

Thanks for your help