Map transformation for Number item, how to ensure the number is integer?

I have a simple map transformation like below:

0=OFF
1=ON

I configure an Number item and transform to OFF/ON as following:

Number                  Outdoor_sensor           "Outdoor Sensor [MAP(OnOff.map):%s]"                        (gHue)    {channel="........."}

However for some reason some times the number item return a double number 0.0 or 1.0 which makes the transformation fail. I thought I could format the number to an integer before passing to map transformation like below:

Number                  Outdoor_sensor           "Outdoor Sensor [MAP(OnOff.map):%d]"                        (gHue)    {channel="........."}

However it complains that it needs a string for map to work.
Is there any way to format a number with number of decimals before passing to a map function?

Many thanks in advance!

Only through a rule or a profile. In short, you need to ensure that the value is an integer before it gets to the Item.

It’s probably a lot easier to just add entries for 0.0 and 1,0 to your map.

Thanks that’s what I did. Not sure why sometime it returns integer and sometimes it returns double though

I believe I had the same behaviour using the Knox binding. What is that item linked to ?