after my migration from OH2.5 to OH3.0 two rules arent working anymore and i dont really know, whats the reason.
Rule 1:
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
Rule 2:
Error message:
18:47:51.558 [ERROR] [.internal.handler.ScriptActionHandler] - Script execution of rule with UID 'heizung_calc_valvelevel-4' failed: cannot invoke method public abstract org.openhab.core.types.State org.openhab.core.items.Item.getState() on null in heizung_calc_valvelevel
Rule:
rule "Umrechnung Ventilstellung HM_WZ_Heizkoerper_K_Level"
when
Item HM_WZ_Heizkoerper_K_Level changed
then
var valvelevel_wz_k = triggeringItem.state as Number
HM_WZ_Heizkoerper_K_Valve.postUpdate(valvelevel_wz_k * 100)
end
Would be great, if someone could help me getting these rule running again.
Thanks for the hint. I guess this was one big change in OH3. Wouldn’t it be the best solution to use newState instead of triggeringItem.state, instead of looking up the item by its name string?