Transform range of numbers to one string value using map or scale file

i am trying to use map file where i want

1-10 = ON

how can i make it work ? mapping range of numbers to one string value… I tried SCALE also but didnt work.

So far i tried the following

// Sitemap

String Lamp1 "Lamp Light is [SCALE(range.scale):%s]"


[0] = OFF
[1-10] = ON

// alternate

[0,0] = OFF
[1-10] = ON

none worked so far …

What about using JS ?

I did not test it, but something like:

(function(i) {
    var result = "undefined"
    var int num = parseInt(i)
    if (num == 0)              result = "OFF"
    if (num >= 1 && num <= 10) result = "ON"

    return result;

@gdhiraj Have you been able to get this to work? I am experiencing similar issues. According to the docs, you should use .. as a separator, but that doesn’t work either for me.

[0..0] = OFF
[1..10] = ON