after my migration from OH2.5 to OH3.0 two rules arent working anymore and i dont really know, whats the reason.
I already posted this question on another post, which is already closed so i tried it again here:
Error message:
18:06:11.127 [ERROR] [.internal.handler.ScriptActionHandler] - Script execution of rule with UID 'notifications_luftfeuchtigkeit-1' failed: Conversion = ')' in notifications_luftfeuchtigkeit
Rule:
rule "Luftfeuchtigkeit_Wohnzimmer_zu_hoch"
when
Item HM_WZ_Heizung_Humidity changed
then
if ((HM_WZ_Heizung_Humidity.state >= 60 && previousState < 60) && (Notification_High_Humidity.state == ON)) {
val telegramAction = getActions("telegram","telegram:telegramBot:Telegram_Bot1_Alexander")
telegramAction.sendTelegram(1234567890,"Im Wohnzimmer ist die Luftfeuchtigkeit zu hoch ("+HM_WZ_Heizung_Humidity.state+"%).")
}
end
rule "Luftfeuchtigkeit_Wohnzimmer_wieder_ok"
when
Item HM_WZ_Heizung_Humidity changed
then
if ((HM_WZ_Heizung_Humidity.state < 60 && previousState >= 60) && (Notification_High_Humidity.state == ON)) {
val telegramAction = getActions("telegram","telegram:telegramBot:Telegram_Bot1_Alexander")
telegramAction.sendTelegram(1234567890,"Im Wohnzimmer ist die Luftfeuchtigkeit wieder ok ("+HM_WZ_Heizung_Humidity.state+"%).")
}
end
If it is a Number:Dimensionless, it’s probably already got a unit as part of its state - 33.0 % or suchlike.
You might need to get that as a string in order to put it in another string HM_WZ_Heizung_Humidity.state.toString
and you may find that you don’t need to add the % character yourself.
I think maybe you’ll need to escape the % in the last string fragment, \%. I don’t know how the Action is handling the string but it looks like it’s complaining about it.
Looking at the binding docs, the Action example in particular, it looks like sendTelegram() uses the java parameterised formatter on the string you give it - similar to [state presentation].
So to get a % in text, use double %%