How to create a switch item based on a number item with 0=OFF and 1=ON?

I have a read/write channel that sends/receives 0/1 for ON and OFF command, I’d like to create a switch based on the number channel. Obviously I can create another switch and two rules that sync the number → switch and vice versa. However I recall there was a way to do on-the-fly transformation so I tried the below:

Switch hue_colourloop_switch "Hue Colourloop [MAP(]" (gHue) {channel="hue:0840:xxxxxxxxxxxx:135:status"}

In I define the following:

However it doesn’t seems to work. In OH UI when I switch ON/OFF I see the value changes between 1 and 0, however the binding doesn’t seem to receive the number hence I cannot control the device.
Anything I did wrong? Also appreciate if you have better idea how to solve the problem?
Many thanks!

try this:

Number hue_colourloop_switch "Hue Colourloop [MAP(]" (gHue) {channel="hue:0840:xxxxxxxxxxxx:135:status"}




Switch item=hue_colourloop_switch mappings=[1="ON",0="OFF"]

Applying the map to the Item’s label will only change how it’s displayed. It won’t change the actual state of the Item nor the data sent/received by the Channel.

If your Channel doesn’t offer the option to transform the data (most do) you’ll want to use the transform Profile. Items | openHAB