I seem to remember being in a similar situation before, and as I remember, the solution was to move “the last part of the string” inside the square brackets like this:
Number consumableSensorT "Sensor [JS(mins2hours.js):%.1f Hours]"
I don’t think it makes much sense, and it is certainly not intutive, however, it was the only way I could make it work…
Hi what I thought I posted was in the square brackets unfortunately I was trying everything and the after bracket was the last thing I tried and that’s what I posted
Inside the brackets gives me a NaN. To the right gives me an Err and based on @Udo_Hartmann comment the Err makes sense as it isn’t valid syntax.
It’s almost as if the transform is trying to transform everything after it
Ah! That piece of information makes it a whole lot more sensible, indeed! I have always thought the square brackets were a special way to indicate something to be replaced when rendering the sitemap. Understanding that it simply means to right-adjust whatever text is inside clears it us nicely. Thanks!!
The floor() method rounds a number downwards to the nearest integer, and returns the result.
And if you want to show minutes also here’s a script that i use to transform daylight lenght to minutes + hrs. It’s a number item but use “%s” as shown.
Number astroDaylight "Daylight [JS(daylight.js):%s]" { channel="astroblahblah..." }