I’m looking to create a absence simulation in OH3. Since the precense add on is not available anymore, I just tried by running a rule every 2 minutes, accessing the data of certain items and update the item.
This works perfectly for dimmer, switch and player items. But for color items, no way:
This is may definition:
logInfo(myRuleName,"Abwesenheitssimulation: Das Item <" + myitem.name.toString + "> wurde auf den Wert <" + myitem.historicState(now.minusDays(7)).state.toString + "> gesetzt")
The group contains ColorItems where every state change is persisted in a MariaDB.
When running this query, I get the follow error in the logs:
Error: class java.lang.String cannot be cast to class java.lang.Integer (java.lang.String and java.lang.Integer are in module java.base of loader 'bootstrap')
Any idea what to do to make the absence simulation working also for ColorItems?
The MariaDB is the default one, and even if I explicitly specify the persistence service, this does not work.
And as it works for all the other items where I defined it the same way, I bet it is related to the type ColorItem and the way the values are persisted.
I have the feeling that this could be a bug, as the values are save as string in the database. Looking to the error message it seems that the service tries to do an automatic type conversation to number, because the value starts with somewhat like 20,100,100 and crash once the comma occurs.
But this is just a feeling, I cannot prove it.
Might well be. The (fairly recently introduced) code that recovers brightness-only value from rrd4j might be accidentally invoked here too.
Well, you seem to have shown the color state gets persisted in full “20,100,100” ?
If myitem.historicState(now.minusDays(7), "jdbc").state.toString
either breaks or does not return a color state in 20,100,100 format, then it’s broke.