Display more Values on Page Cells

Hi,

I have two items: One to measure measure energy consumption and one to measure temperature and humidity. I want to display two values in the page cells and used the footer for this purpose. With my energy consumption it worked without problems. The result looks like this:

result

What i made was to place the following code

=items.Hausverbrauch_TagesverbrauchdesHauses.displayState

in the footer:

Doing the same for the humidity does not work:

=items.HMGartenTemperatursensor_Humidity.displayState

humidity

The item definition for both items are:

What can be the reason for that?

  1. Humidity is dimentionless?
  2. I didn’t need to place a state description for the humidity?

Thank you for your help!
Timo

Your humidity sensor does not have state description metadata. I don’t know if your item has a displayState without that!? But you could give it a try.

Okay, I added the following meta description in the pattern of the humidity idem:

%.1f %%

…and it worked!

Why does it need a meta description, if it displayed correctly in the item definition without this pattern?
(see above)

…and one more question: Why does “Aussentemp.” cell show three dots in the top right and “Hausverbrauch” not?

…and one more question: Why does “Aussentemp.” cell show three dots in the top right and “Hausverbrauch” not?

Okay, to avoid the three dots you have to place

expandable: false

in the YAML by editing the code. I did not find other solutions.

This is the correct solution.

1 Like

Okay, I added the following meta description in the pattern of the humidity idem:

%.1f %%

…and it worked!

…and by changing the meta description to:

%.0f %%

…it doesn’t work anymore. I think this is strange behavior. I do not need the last digit. Why does it break just because I changed the decimal places to zero?

Hi,

try .state instead of .displayState!

1 Like

This is an important point. If you don’t have the State Description metadata, displayState is undefined. Yannick suggests using an expression:

=(items.MyItem.displayState === undefine) ? items.MyItem.state : items.MyItem.displayState

If displayState is defined that is used. If not it falls back to state which is always defined.

2 Likes