Hello all,
I’ve just upgraded from OH3 to OH4 on a raspberry. And I have an error in my rules and it wasn’t the case in OH3 afaik.
Here is the rule:
rule "System Start"
when
System started
then
var DateTime vSunrise = new DateTime(Sunrise.state.toString)
var DateTime vSunset = new DateTime(Sunset.state.toString)
switch now
{
case now.isAfter(vSunrise) && now.isBefore(vSunset): isNight.postUpdate(OFF)
default: isNight.postUpdate(ON)
}
end
Sunrise, Sunset and IsNight are all declared in items:
Switch isNight "Night"
DateTime Sunrise "Lever du soleil [%1$tH:%1$tM]" {channel="astro:sun:local:rise#start"}
DateTime Sunset "Coucher du soleil [%1$tH:%1$tM]" {channel="astro:sun:local:set#end"}
The error displayed each time the rule is loaded:
2023-07-30 21:50:34.479 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'default.rules'
2023-07-30 21:50:42.596 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'default-6' failed: An error occurred during the script execution: Cannot invoke "org.eclipse.xtext.common.types.JvmType.eIsProxy()" because "type" is null in default
I suspect isNight is null ? But it’s not the case.
openhab> openhab:status isNight
ON
Anyone know what could cause that ?
Thank you.