ERROR: java.lang.String cannot be cast to java.sql.Timestamp

Raspberry 3 with openhabian and OH stable 2.4.

I get constantly the following error:
Error during the execution of rule 'Periodically check Presence': java.lang.String cannot be cast to java.sql.Timestamp

And my rule looks like this

rule "Periodically check Presence"
when
    Time cron "40 */4 * * * ?" or
    Item G_Mobiles changed
then
	if(Presence.state == ON) {
		if(!Abus_Motion.changedSince(now.minusMinutes(30),"jdbc") && Loc_Home_DNA.state == OFF && Loc_Home_NCO.state == OFF){
			if(G_Mobiles.state == 0 && !G_Mobiles.changedSince(now.minusMinutes(70),"jdbc")) {
				Presence.sendCommand(OFF)
				if(Abus_Status.state == "Unset") {
					logInfo("Presence.rules", "Nobody at home anymore!? / Abus NOT active!")
					if(Abus_OverR.state == OFF){
						sendTelegram("OH_TeleBot", "Niemand mehr zuhause!?\nAlarmanlage NICHT aktiv.\nLetzte Bewegung: " + Abus_Motion.state.format("%1$td.%1$tm. - %1$tH:%1$tM"))
					}
					else {
						sendTelegram("OH_TeleBot", "Niemand mehr zuhause!?\nAlarmanlage NICHT aktiv.\nAbus_OverR: " + Abus_OverR.state)
					}
				}
			}
		}
	}
	else {
		if(Abus_Mode.state == OFF && !Abus_Motion.changedSince(now.minusMinutes(15),"jdbc")) {
			if(Abus_OverR.state == OFF) {
				if(!G_Mobiles.changedSince(now.minusMinutes(60),"jdbc")) {
					if(G_Windows.members.filter(s | s.state == "ON").size > 0) {
					// set open windows to override / bypass
						if (Abus_Balkon.state == "ON") {
							Abus_BLK_OM.sendCommand(ON)
						}
						
						if (Abus_Oberlicht.state == "ON") {
							Abus_OBL_OM.sendCommand(ON)
						}
					}
					createTimer(now.plusSeconds(5)) [
						Abus_Mode.sendCommand(ON)
						logInfo("presence.rules", "Active Bypasses: " + Abus_BYPASS.state)
					]
				}
			}
			else {
				if(G_HmCmng.state == OFF && !Abus_Mode.changedSince(now.minusMinutes(30),"jdbc") && Abus_OverR.state != ON && !Abus_Motion.changedSince(now.minusMinutes(60),"jdbc") && G_Mobiles.state == 0 && !G_Mobiles.changedSince(now.minusMinutes(60),"jdbc")) { // klappt dies?, dann auch oben bei der langen liste !enzio_WLAN....
					logInfo("presence.rules", "No Motion since " + Abus_Motion.state.format("%1$td.%1$tm. - %1$tH:%1$tM") + " but Abus not active!")
					sendTelegram("OH_TeleBot", "Keine Bewegung seit " + Abus_Motion.state.format("%1$td.%1$tm. - %1$tH:%1$tM") + " aber Abus nicht aktiv!")
				}
			}
		}
	}
end

I don’t have any idea, what might be wrong.
Maybe i don’t see the obvious any more?

Any suggestion is greatly appreciated.

That’s a mystery. Mention of sql in the error does suggest it’s about the changedSince. Kind of expecting to find a n0w or 3o typo but cannot.

It’s not the message you’d expect, but make sure both Items are being persisted in that database - I’m guessing one may be a Group Item state.

That’s the hint - You are my hero!
Now I remember, that I have changed a few weeks ago the type of the Item Abus_Motion from String to DateTime.
I just did not check the logs since and di not see the error earlier.

So, this must be a mismatch in SQlite starting the history as String and then moved to DateTime.
I just need to delete the persistence history of that item and all should be fine.

Thanks again for pushing me into the right direction!:grinning::+1:

Ah, so the message is likely about successfuly retrieving data - but it doesn’t fit the Item type.

The error is gone after changing the name (and starting to persist with this name).
Thanks again for the brain trigger. :+1:

1 Like