I am trying to create a switch for alert to create a Alert badge in location UI if temperature goes under 15 degres with profile transform:js
Switch BedRoom_Sensor_TempWarn "Temperatur Varning" <temperature> (geBedRoom_Sensor, gpC) ["Alarm"] {channel="rfxcom:temperaturehumidity:usb0:42752:temperature" [profile="transform:JS", function="warnTemp.js"]}
warnTemp.js
(function(inputData) {
var out = inputData ; // allow Undefined to pass through
if (inputData < 15 || inputData > 25) {
out = 'ON' ;
} else {
out = 'OFF' ;
}
return out ; // return a string
})(input)
but i get this error:
2021-01-27 20:51:26.902 [WARN ] [e.internal.SseItemStatesEventBuilder] - Exception while formatting value 'OFF' of item BedRoom_Sensor_TempWarn with format '%.1f °C': f != java.lang.String
what am i doing wrong?