Rainsensor from json to sitemap

Hi,

I read a json file with my Rainsensor’s value (ON or OFF):
at the moment I get:
{
Rainsensor: “off”
}

therefore my item file:
String RainSensor_OutValue { http="<[beckhoff:2000:JSONPATH($.Rainsensor)]" }

in my sitemap:

    Frame label="Wetter"{
        Text item=WindValue label="Wind: [%.0f km/h]" icon="wind"
        Text item=MaxWindValue label="Wind max: [%.0f km/h]" icon="wind"
        Text item=OutTempValue label="Aussen Temperatur: [%.1f °C]" icon="temperature"
        Text item=OutNiederschlagValue label="Niederschlag heute: [%.1f mm]" icon="rain"
        Text item=RainSensor label="Aktueller Niederschlag: [%.0f]" icon="rain"
    }

I just want to write: “Aktueller Niederschlag” if my json value receives the value “ON”.
I think a boolean would be better for that kind ? But JSON is String.

I have no rule defined (maybe for converting ON/ OFF to boolean?

Anyone some help for me?
Thanks,
Klaus

For display, use a MAP transformation

Text item=RainSensor_OutValue label="Aktueller Niederschlag: [MAP(mytransform.map):%s]”  icon="rain"

thanks, it works! And how can I show in my sitemap the whole text/item only if value is ON ?

visibility=

many thanks!
Tryed to write log file if raining started, and stopped, but only if log has not been written for 30minutes before.
getting an:

2019-07-07 18:58:35.678 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'RainAlert': An error occurred during the script execution: index=1, size=1
error

events.log shows:

2019-07-07 18:56:34.370 [vent.ItemStateChangedEvent] - RainSensor_OutValue changed from off to on
2019-07-07 18:58:35.681 [vent.ItemStateChangedEvent] - RainSensor_OutValue changed from on to off

var lastAlertTime = now.minusMinutes(30) // set the lastAlertTime to ten minutes ago so we get alerts immeidately

rule "RainAlert"
when
    Item RainSensor_OutValue changed 
then
if(now.minusMinutes(10).isAfter(lastAlertTime) && RainSensor_OutValue.state == 'on'){
    logInfo("Rain detected")
    lastAlertTime = now
}
if(now.minusMinutes(10).isAfter(lastAlertTime) && RainSensor_OutValue.state == 'off'){
    logInfo("Rain stopped detected")
    lastAlertTime = now
}
end

logInfo() has always required two strings
logInfo("myRule", "Rain detected")