Platform & System Information:
Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-213-generic x86_64)
Openhab Version: 4.1.1 (Build)
OpenJDK Runtime Environment (build 17.0.7+7-Ubuntu-0ubuntu118.04)
I have some javascript integrated into a rule to regularly poll information from my photovoltaic inverter via HTTP. This worked fine since yesterday 03:58am when the token needed to be refreshed. The actual token refresh was fine, token is fine, all good. But I store the expiry date and time of the token and then check in the rule every 10 seconds if the token is expired. This check was also working fine up to now. Below you can find the check:
if (now.isAfter((SigenergyTokenExpiry.state as DateTimeType).zonedDateTime)) {
return SigenergyAuthenticate.apply("grant_type=refresh_token&refresh_token=" + SigenergyRefreshToken.state.toString())
} else {
return SigenergyAccessToken.state.toString()
}
The check in the if-statement suddenly shows an error. It say:
2025-02-05 21:41:00.350 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'Photovoltaik-1' failed: Could not cast 2025-02-04 09:22:39.741+0000 to org.openhab.core.library.types.DateTimeType; line 66, column 21, length 42 in Photovoltaik
The content of the SigenergyTokenExpiry item state is “2025-02-04T09:22:39.741+0000”. Seems totally fine for me. And it was working up to now. I also tried to modify the date/time manually, nothing helped.
At the top of my rule fileI have set import java.time.format.DateTimeFormatter
.
I am a little desperate and I am not sure where to look to get this back to work.
Thanks for your support in advance!
Best regards,
Matthias