Experimental Rules Engine - How to delete or recover rules from OH2.3 (stable) within OH2.4 (stable)

After updating my OpenHAB setup from 2.3 (stable) to 2.4 (stable), all my rules inside the experimental ruled engine seems to be deleted.

I found out that there was a change that caused this behaviour.
(see https://github.com/eclipse/smarthome/issues/5884)

Is there any chance to recover my old rules?

And if not (what I assume): How can I delete my old rules?
I see that they are still somewhere inside OpenHAB (due to error messages during startup) …

1 Like

In. /var/lib/openhab2/jsondb/backup there are automatically generated backups of the jsondb files. Rules are stored in the file that has rules in the name. Copy the most recent version of that file back to the main folder and that should recover your Rules. If not, try an older backup from that folder.

2 Likes

Thx for this hint.

Will this really solve my problem with older rules. I have the following error message during the start of openhab:

2018-12-25 11:22:20.554 [ERROR] [me.storage.json.internal.JsonStorage] - Couldn't deserialize value 'org.eclipse.smarthome.storage.json.internal.StorageEntry@e62c0'. Root cause is: Unable to invoke no-args constructor for interface org.eclipse.smarthome.automation.Rule. Register an InstanceCreator with Gson for this type may fix this problem.

If I want to get rid of my old rules … can I simply delete this file: /var/lib/openhab2/jsondb/automation_rules.json and restart openhab?
Or just empty the file …

I believe there was a format change. There was a related issue in the ESH GH repo… I’ll look for it. There may be a way to reformat them to work.

I’m not sure if deleting the jsondb files will be enough… you may need to clear the cache too.

Thx in advance.
No need to recover my rules … I need only a way to delete my old rules …

Hi there,

I have the same problem after upgrading to 2.4. It seems, that all my rules were deleted. They are not shown in the PaperUI anymore. Nervertheless they are still in the /var/lib/openhab2/jsondb folder but are not executed nor they are shown up in the PaperUI. PaperUI says only “No rules defined yet.”. :frowning:
Any hints to get them up and running again? Thank you in Advance.

All I can recommend is to stop oh, restore a backup from the backups folder, restart, and seder if that brings them back.

I’ve no idea otherwise. Paperui rules are still experimental, hence the name.

Not sure why this should work.
There was a change in the way how the rules are stored in the json (at least this is my understanding).
Why should a restore solve this problem?

Hi,
I tried cd /var/lib/openhab2/jsondb/backup and this is the result
So,Can you please tell me what should i do?

1541623535642--automation_rules_disabled.json                  1545725727123--org.eclipse.smarthome.core.items.Metadata.json
1541626652024--automation_rules_disabled.json                  1545725744139--StorageHandler.For.OAuthClientService.json
1541684597722--automation_rules_disabled.json                  1545725744160--org.eclipse.smarthome.core.items.Item.json
1541686325749--automation_rules_disabled.json                  1545725744165--org.eclipse.smarthome.core.items.Metadata.json
1541704871054--automation_rules_disabled.json                  1545725760380--org.eclipse.smarthome.core.items.Item.json
1541805743527--automation_rules.json                           1545725760382--org.eclipse.smarthome.core.items.Metadata.json
1541805887105--automation_rules.json                           1545725776742--org.eclipse.smarthome.core.items.Item.json
1541806119535--automation_rules.json                           1545725776744--org.eclipse.smarthome.core.items.Metadata.json
1541806162907--automation_rules.json                           1545725793906--org.eclipse.smarthome.core.items.Item.json
1541806192543--automation_rules.json                           1545725793914--org.eclipse.smarthome.core.items.Metadata.json
1542169269780--automation_rules.json                           1545725809984--org.eclipse.smarthome.core.items.Item.json
1542169269807--automation_rules_disabled.json                  1545725809992--org.eclipse.smarthome.core.items.Metadata.json
1542389717151--automation_rules.json                           1545725826280--org.eclipse.smarthome.core.items.Item.json
1542389717178--automation_rules_disabled.json                  1545725826283--org.eclipse.smarthome.core.items.Metadata.json
1543766754426--automation_rules.json                           1545725843036--org.eclipse.smarthome.core.items.Item.json
1543766754472--automation_rules_disabled.json                  1545725843046--org.eclipse.smarthome.core.items.Metadata.json
1544483089942--automation_rules.json                           1545725860712--org.eclipse.smarthome.core.items.Item.json
1544483089969--automation_rules_disabled.json                  1545725860721--org.eclipse.smarthome.core.items.Metadata.json
1544489604823--automation_rules.json                           1545725876781--org.eclipse.smarthome.core.items.Item.json
1544489604845--automation_rules_disabled.json                  1545725876790--org.eclipse.smarthome.core.items.Metadata.json
1545416306857--automation_rules.json                           1545725922269--org.eclipse.smarthome.core.items.Item.json
1545416306879--automation_rules_disabled.json                  1545725922271--org.eclipse.smarthome.core.items.Metadata.json
1545422998879--automation_rules.json                           1545725951622--automation_rules.json
1545422998909--automation_rules_disabled.json                  1545725966150--automation_rules.json
1545539512830--automation_rules.json                           1545725966168--org.eclipse.smarthome.core.items.Item.json
1545539512863--org.eclipse.smarthome.core.items.Item.json      1545725966177--automation_rules_disabled.json
1545539512865--automation_rules_disabled.json                  1545725966179--org.eclipse.smarthome.core.items.Metadata.json
1545539568723--org.eclipse.smarthome.core.items.Metadata.json  1545725988618--automation_rules.json
1545539568729--org.eclipse.smarthome.core.items.Metadata.json  1545726002083--automation_rules.json
1545539568734--org.eclipse.smarthome.core.items.Metadata.json  1545726002113--org.eclipse.smarthome.core.items.Item.json
1545539568740--org.eclipse.smarthome.core.items.Metadata.json  1545726002114--automation_rules_disabled.json
1545539569242--org.eclipse.smarthome.core.items.Metadata.json  1545726002116--org.eclipse.smarthome.core.items.Metadata.json
1545540371621--automation_rules.json                           1545726029828--automation_rules.json
1545540371641--org.eclipse.smarthome.core.items.Item.json      1545726052521--StorageHandler.For.OAuthClientService.json
1545540371649--automation_rules_disabled.json                  1545726052522--automation_rules.json
1545540371652--org.eclipse.smarthome.core.items.Metadata.json  1545726052538--org.eclipse.smarthome.core.items.Item.json
1545540432463--StorageHandler.For.OAuthClientService.json      1545726052545--automation_rules_disabled.json
1545540493669--StorageHandler.For.OAuthClientService.json      1545726052547--org.eclipse.smarthome.core.items.Metadata.json
1545540493703--org.eclipse.smarthome.core.items.Item.json      1545726070510--automation_rules.json
1545540493707--org.eclipse.smarthome.core.items.Metadata.json  1545726092226--StorageHandler.For.OAuthClientService.json
1545540542413--StorageHandler.For.OAuthClientService.json      1545726092228--automation_rules.json
1545540543602--automation_rules.json                           1545726092248--org.eclipse.smarthome.core.items.Item.json
1545542700465--org.eclipse.smarthome.core.items.Item.json      1545726092256--automation_rules_disabled.json
1545542728119--org.eclipse.smarthome.core.items.Item.json      1545726092260--org.eclipse.smarthome.core.items.Metadata.json
1545667160832--StorageHandler.For.OAuthClientService.json      1545726109692--automation_rules.json
1545667160838--automation_rules.json                           1545726131295--StorageHandler.For.OAuthClientService.json
1545667160866--org.eclipse.smarthome.core.items.Item.json      1545726131296--automation_rules.json
1545667160867--automation_rules_disabled.json                  1545726131323--org.eclipse.smarthome.core.items.Item.json
1545667160870--org.eclipse.smarthome.core.items.Metadata.json  1545726131324--automation_rules_disabled.json
1545667204675--StorageHandler.For.OAuthClientService.json      1545726131327--org.eclipse.smarthome.core.items.Metadata.json
1545667205423--automation_rules.json                           1545726150606--automation_rules.json
1545724585513--StorageHandler.For.OAuthClientService.json      1545726172337--StorageHandler.For.OAuthClientService.json
1545724585516--automation_rules.json                           1545726172339--automation_rules.json
1545724585534--automation_rules_disabled.json                  1545726172359--org.eclipse.smarthome.core.items.Item.json
1545724585534--org.eclipse.smarthome.core.items.Item.json      1545726172368--automation_rules_disabled.json
1545724585537--org.eclipse.smarthome.core.items.Metadata.json  1545726172371--org.eclipse.smarthome.core.items.Metadata.json
1545724637858--StorageHandler.For.OAuthClientService.json      1545726225455--StorageHandler.For.OAuthClientService.json
1545724646804--automation_rules.json                           1545752405688--automation_rules.json
1545725420227--StorageHandler.For.OAuthClientService.json      1545752405690--StorageHandler.For.OAuthClientService.json
1545725420229--automation_rules.json                           1545752405713--automation_rules_disabled.json
1545725420253--org.eclipse.smarthome.core.items.Item.json      1545752405722--org.eclipse.smarthome.core.items.Item.json
1545725420254--automation_rules_disabled.json                  1545752405725--org.eclipse.smarthome.core.items.Metadata.json
1545725420256--org.eclipse.smarthome.core.items.Metadata.json  1545752443965--StorageHandler.For.OAuthClientService.json
1545725443645--automation_rules.json                           1545752445468--automation_rules.json
1545725465800--StorageHandler.For.OAuthClientService.json      1545775567948--StorageHandler.For.OAuthClientService.json
1545725465802--automation_rules.json                           1545775567951--automation_rules.json
1545725465826--org.eclipse.smarthome.core.items.Item.json      1545775568030--org.eclipse.smarthome.core.items.Item.json
1545725465827--automation_rules_disabled.json                  1545775568032--automation_rules_disabled.json
1545725465829--org.eclipse.smarthome.core.items.Metadata.json  1545775568037--org.eclipse.smarthome.core.items.Metadata.json
1545725483913--automation_rules.json                           1545776953111--StorageHandler.For.OAuthClientService.json
1545725505447--StorageHandler.For.OAuthClientService.json      1545776953115--automation_rules.json
1545725505449--automation_rules.json                           1545776953139--automation_rules_disabled.json
1545725505467--org.eclipse.smarthome.core.items.Item.json      1545776953141--org.eclipse.smarthome.core.items.Item.json
1545725505475--automation_rules_disabled.json                  1545776953151--org.eclipse.smarthome.core.items.Metadata.json
1545725505478--org.eclipse.smarthome.core.items.Metadata.json  1545777486682--automation_rules.json
1545725524532--StorageHandler.For.OAuthClientService.json      1545777698834--StorageHandler.For.OAuthClientService.json
1545725526136--automation_rules.json                           1545777698838--automation_rules.json
1545725547339--StorageHandler.For.OAuthClientService.json      1545777698864--org.eclipse.smarthome.core.items.Item.json
1545725547342--automation_rules.json                           1545777698874--automation_rules_disabled.json
1545725547364--org.eclipse.smarthome.core.items.Item.json      1545777698876--org.eclipse.smarthome.core.items.Metadata.json
1545725547365--automation_rules_disabled.json                  1545777730180--automation_rules.json
1545725547369--org.eclipse.smarthome.core.items.Metadata.json  1545777730384--StorageHandler.For.OAuthClientService.json
1545725562335--automation_rules.json                           1545779090913--automation_rules.json
1545725573226--StorageHandler.For.OAuthClientService.json      1545779090914--StorageHandler.For.OAuthClientService.json
1545725573229--automation_rules.json                           1545779090935--automation_rules_disabled.json
1545725573254--org.eclipse.smarthome.core.items.Item.json      1545779090937--org.eclipse.smarthome.core.items.Item.json
1545725573255--automation_rules_disabled.json                  1545779090940--org.eclipse.smarthome.core.items.Metadata.json
1545725573258--org.eclipse.smarthome.core.items.Metadata.json  1545779164906--StorageHandler.For.OAuthClientService.json
1545725580394--automation_rules.json                           1545779241971--automation_rules.json
1545725594473--StorageHandler.For.OAuthClientService.json      1546038079298--StorageHandler.For.OAuthClientService.json
1545725594474--automation_rules.json                           1546038079300--automation_rules.json
1545725594505--org.eclipse.smarthome.core.items.Item.json      1546038079322--org.eclipse.smarthome.core.items.Item.json
1545725594507--automation_rules_disabled.json                  1546038079323--automation_rules_disabled.json
1545725594516--org.eclipse.smarthome.core.items.Metadata.json  1546038079325--org.eclipse.smarthome.core.items.Metadata.json
1545725600439--automation_rules.json                           1546038134913--StorageHandler.For.OAuthClientService.json
1545725614543--StorageHandler.For.OAuthClientService.json      1546038135156--automation_rules.json
1545725614545--automation_rules.json                           1546045139748--org.eclipse.smarthome.core.thing.link.ItemChannelLink.json
1545725614564--org.eclipse.smarthome.core.items.Item.json      1546052007241--thing_status_storage.json
1545725614571--automation_rules_disabled.json                  1546052007242--thing_status_storage.json
1545725614575--org.eclipse.smarthome.core.items.Metadata.json  1546052007243--thing_status_storage.json
1545725619545--automation_rules.json                           1546052007601--thing_status_storage.json
1545725633379--StorageHandler.For.OAuthClientService.json      1546052007611--StorageHandler.For.OAuthClientService.json
1545725633381--automation_rules.json                           1546052007613--automation_rules.json
1545725633402--org.eclipse.smarthome.core.items.Item.json      1546052007634--org.eclipse.smarthome.core.thing.Thing.json
1545725633409--automation_rules_disabled.json                  1546052007642--org.eclipse.smarthome.core.thing.link.ItemChannelLink.json
1545725633413--org.eclipse.smarthome.core.items.Metadata.json  1546052007644--automation_rules_disabled.json
1545725638990--automation_rules.json                           1546052007647--org.eclipse.smarthome.core.items.Item.json
1545725652917--StorageHandler.For.OAuthClientService.json      1546052007650--org.eclipse.smarthome.core.items.Metadata.json
1545725652918--automation_rules.json                           1546052007746--thing_status_storage.json
1545725652934--org.eclipse.smarthome.core.items.Item.json      1546052049084--automation_rules.json
1545725652941--automation_rules_disabled.json                  1546052055445--org.eclipse.smarthome.core.thing.Thing.json
1545725652945--org.eclipse.smarthome.core.items.Metadata.json  1546052055961--org.eclipse.smarthome.core.thing.Thing.json
1545725672154--StorageHandler.For.OAuthClientService.json      1546083249059--org.eclipse.smarthome.core.thing.Thing.json
1545725672171--org.eclipse.smarthome.core.items.Item.json      1546097829309--org.eclipse.smarthome.core.thing.link.ItemChannelLink.json
1545725672182--org.eclipse.smarthome.core.items.Metadata.json  1546100732688--org.eclipse.smarthome.core.thing.Thing.json
1545725691423--StorageHandler.For.OAuthClientService.json      1546101126259--org.eclipse.smarthome.core.thing.link.ItemChannelLink.json
1545725691453--org.eclipse.smarthome.core.items.Item.json      1546101170679--org.eclipse.smarthome.core.thing.link.ItemChannelLink.json
1545725691457--org.eclipse.smarthome.core.items.Metadata.json  1546105675047--org.eclipse.smarthome.config.discovery.DiscoveryResult.json
1545725709481--StorageHandler.For.OAuthClientService.json      1546106999391--org.eclipse.smarthome.config.discovery.DiscoveryResult.json
1545725709505--org.eclipse.smarthome.core.items.Item.json      1546113539604--org.eclipse.smarthome.config.discovery.DiscoveryResult.json
1545725709510--org.eclipse.smarthome.core.items.Metadata.json  1546113969802--org.eclipse.smarthome.config.discovery.DiscoveryResult.json
1545725727098--StorageHandler.For.OAuthClientService.json      1546114545174--org.eclipse.smarthome.config.discovery.DiscoveryResult.json
1545725727119--org.eclipse.smarthome.core.items.Item.json

I have no idea but if the format changed then the files need to be reformatted. I don’t know anything about it right now.

Any solution so far? Updated to 2.4 some hours ago… just an absolute nightmare to lose all the rules is a real pain in the ass…

You can try to recreate one of the Rules and compare the new format with the same Rule in the old format. Then edit the old ones to include those changes.

I realize it is a pain, but you really shouldn’t be using this for production. It is named “experimental” for a reason. It’s not complete. It is full of bugs. It has no documentation.

Yes, was my same idea, but where is the new file? The old one is automation_rules.json and it’s in /var/lib/openhab2/jsondb, but I’m not able to find the other…

there is no new file. it’s the same fike. it just always the format charged so that OH can no longer read in the old format.