A couple of simple oh-repeater examples

The displayState for an item only exists in the widget context only when two conditions are both met: 1) the item has properly defined stateDescription metadata and 2) the result of that formatting is different than the raw state.

It is usually the second condition that trips people up. If you are going to rely on displayState in your widget you must either make sure that the state description always results in a value that is different than the state, or provide a fallback to the state value when there is no display state. The fallback is easily achieved using the @ shortcut described here:

Thanks, that was indeed the issue why I could not get the displayState

Anyhow, it seems like I need to solve what I want to do with two group (Switch, and count): I want to show the switch for lights and as label the number of the lights that are turned on, but I only get on/off in the displaystate

There are sneaky ways of doing this purely in the widget expression system, but it involves some tricks with two repeaters. In most cases, I do this with two groups myself. One basic OnOff group and one Number group with a Count aggregation function.