Number channel to switch item - how to map 0/1 to on/off

I would like to create switch item from a number channel. Number channel is either 0 or 1 to represent OFF/ON.

I know I read somewhere how to do this but cannot find it this morning :frowning:

Assign a number type item and use this in sitemap:
Switch item=Szene mappings=[1="früh",2="Tag",3="Spät",4="Nacht"]

Create a switch item and use a rule to change it from on to off according to your number item

Markus, was hoping I could do that in the .items definition - I need the value to be correct, not just displaying text.

I would like to translate the channel value to a switch value in the .items definition. Guessing it is not doable.

I believe you’re somewhat misunderstanding the concept ?
Any item is of a type, that has to be Number in your case if the channel you assign it to is of Number type.
You can also use transformations to display text instead of the number but you cannot change types.
Define that via sitemap:
Switch item=Szene label="Szene [MAP(scene.map):%s]"
or in .items:
Number Szene "Szene [MAP(scene.map):%s]"

EDIT: scene.map needs to be in transformation subdirectory, see there for examples.

If you really want to have an item of different type, you must create another one of String type and use rules to change that second item whenever the original Number item changes.