You did not tell us whether you configured a persistence service. For persistence to work, you have to define which database you would like to store your values in. The easiest is to use mapDB for restore on backup, but watch out, it only stores the last value, but then it is fast and easy, which you want for your purpose.
second try?
Your test rule is flawed - postUpdate is asynchronous and your rule will not stop and wait for it to take effect before carrying to do the logInfo().
In short, the logInfo will tell you old state from before the postUpdate.
More useful would be the actual events.log
The other potential problem with your test rule is that you allow historicState() to go to the default database. Are you sure that is mySQL ?
Hi,
Iâve the same behaviour with release 2.5.1 and mysql.
On restart, no button is red although the number of the switch retrieves the good value.
My item file:
Number clim_cmd âChauffage [%d]â (gClim, gTEST)
My sitemap file:
Switch item=clim_cmd label=âChauffageâ mappings=[1=âONâ,3=â19°â,4=â20°â,6=âOFFâ,7=âAUTOâ]
My mysql.persist:
clim_cmd : strategy = everyChange, restoreOnStartup
Like milo I use a reference number for the switch item.
I donât know if it is bug but this behaviour doesnât exist on the previous release I used which was 2.0.0 and which was working correctly with the same code.
As I add â%dâ on my item, I am able to check that clim_cmd is correctly retrieve after a restart but no button is red.
@sac Did you find a solution?
I have the same issue: I can see that the value is restored, but the button on sitemap is not highlighted.
Item type is Number as I need several heating modes.
My config:
items:
Number AI_GR_HeatingMode (g_room_heat)
mapdb.persist:
g_room_heat* : strategy = everyChange, restoreOnStartup
sitemap:
Switch item=AI_GR_HeatingMode label="Mode" mappings=[0="Auto",1="Manual"]
Text item=AI_GR_HeatingMode label="Mode [%s]"
I can see the value is set to 1 on sitemap, but the button âManualâ is not highlighted. When I press âManualâ - it becomes highlighted, and text value âModeâ does not change (remains 1 as it was). Any ideas why button is not synchronized with the value?
This mapping worked: Switch item=AI_GR_HeatingMode label="Mode" mappings=[0="Auto",1.0="Manual"]
Is it safe to leave it like this or there is another solution to get rid of the extra decimal?
All my rules check for âitem.state==1â - donât think there can be a problem.
@rossko57
I am already using mapdb for storing this particular value.
I need Number as example above is just a simplified example. Actually there are more options like: Auto, Manual, Override, NoOneThere.
Thanks for the tip. I found (via REST API) that a lot of values were stored in rrd4j service (I forgot it was running by default for OH3). It interfered with my mapdb settings. Thus the issue.
I have created a new file rrd4j.persist with the text:
Donât forget rrd4j provides the default charting,you may want to put some Items back there.
You can actually setup with * to persist all like the default setup; but you donât have to restore, unlike default.