OH2: ideas to help advanced users to create config files

Speaking strictly for myself, I would simply switch over and be done with it. People trying to have something similar to “stable” should be using the last beta (4 I seem to remember), and anyone using SNAPSHOT artifacts in production deserves a little pain every now and then :smiling_imp:

Then again, my opinion might be slightly colored by the fact that I removed and recreated my mapdata 20 times in the last two weeks to debug Thing creation and my HUE / Netatmo setup :smile:

For everyone else, maybe we could provide a small offline program to read mapdb and write json? Would I need the ESH / OH2 classes in the classpath for this to work?

:+1:

Nope - I’m all for just swapping over…

For me there is no problem to start once again from scratch with a new database.

I hope with JsonDB storage service there is way to backup the configuration und the possibility to read my database.

The JsonDB does two things that will help you - firstly, it stores data in text files, so you can read the configuration very easily. It also keeps backups of the text files automatically - it keeps the last 5 (by default) updates to the database, but it would be relatively simple to copy a version into a completely different directory.

From the benchmark tests I did during development, it’s also a LOT faster than mapdb.

3 Likes

I was wandering about the memory foot print. Does it need a lot of more RAM or is it about the same?

It’s not something I’ve looked at, but I can’t see why it would be significantly different. It uses the gson library, but on the other hand doesn’t use the mapdb library. Fundamentally it’s still storing the data in a Map so it’s other than these libraries, it should be similar.

Hey @chris, that sounds great. Are these text files managed in a way that would also allow a git based versioning? I’m mainly concerned about constantly changing data or element sorting…

I’m also voting for a simple switch. We are in snapshot state after all.
The anouncement should be done some days before to reach as many as possible though

Ok, I’ll go for it tonight and change mapdb to json in the distro. I have it running on my system since a few days now and don’t have any issue with it.

2 Likes

Perfect timing!!

I have just moved into my new house and am about to start implementing my production system over the next few days.

Cheers,
Mike

Well, they are structured text files so I don’t see why not. I don’t know if the elements maintain order though, so if you are wanting to track changes it may or may not be optimum. Maybe it’s possible to improve this by changing the map type.

Exactly my point. If elements are ordered by ID/name/alphabetically I do not see problems here. If elements are ordered by the time of last change or something comparably random - that’s a problem. Another problem could be constantly changing data fields (e.g. last access timestamp).

I’ll take a look at the ordering. In general, these tables don’t change - I don’t think there are ‘last update’ fields, or if there are, these files don’t change very often at all - ie only when you change the configuration in the UI.

Once again, great job of you and @chris :thumbsup:

Over the time with oH1 & oH2 i now own a lot of “Things”, with more and more “Channels” that now borns more and more “Items”.

My 1st look with an avmfritz:FRITZ_DECT_200 and JSON looks good :smile:

After adding all my AVM-“Things” i’ll switch to the next Binding, maybe Hue or Z-Wave. So it need some time to give you a full feedback how it works.

Meanwhile i was very happy to see what goes on in the log and in /oH2/userdata/jsondb :wink:

19:24:26.533 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'avmfritz:fritzbox:192_168_178_1' to inbox.
19:24:26.534 [INFO ] [smarthome.event.InboxAddedEvent     ] - Discovery Result with UID 'avmfritz:fritzbox:192_168_178_1' has been added.
19:24:26.594 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'avmfritz:FRITZ_Powerline_546E_Solo:192_168_178_100' to inbox.
19:24:26.594 [INFO ] [smarthome.event.InboxAddedEvent     ] - Discovery Result with UID 'avmfritz:FRITZ_Powerline_546E_Solo:192_168_178_100' has been added.
19:24:26.636 [INFO ] [core.karaf.internal.FeatureInstaller] - Installed 'openhab-binding-avmfritz'
19:24:26.638 [INFO ] [smarthome.event.ExtensionEvent      ] - Extension 'binding-avmfritz' has been installed.
19:24:42.899 [INFO ] [smarthome.event.InboxRemovedEvent   ] - Discovery Result with UID 'avmfritz:fritzbox:192_168_178_1' has been removed.
19:24:42.907 [INFO ] [smarthome.event.ThingAddedEvent     ] - Thing 'avmfritz:fritzbox:192_168_178_1' has been added.
19:24:42.941 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'avmfritz:fritzbox:192_168_178_1' changed from UNINITIALIZED to INITIALIZING
19:24:42.992 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'avmfritz:fritzbox:192_168_178_1' changed from INITIALIZING to OFFLINE (CONFIGURATION_ERROR): please configure password first
19:24:43.105 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'avmfritz:fritzbox:192_168_178_1' changed from OFFLINE (CONFIGURATION_ERROR): no password set to OFFLINE (CONFIGURATION_ERROR): please configure password first
19:26:00.972 [INFO ] [smarthome.event.ThingUpdatedEvent   ] - Thing 'avmfritz:fritzbox:192_168_178_1' has been updated.
19:26:01.439 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'avmfritz:fritzbox:192_168_178_1' changed from OFFLINE (CONFIGURATION_ERROR): please configure password first to OFFLINE (CONFIGURATION_ERROR): User null has no access to FritzBox home automation functions
19:26:01.566 [INFO ] [smarthome.event.ThingUpdatedEvent   ] - Thing 'avmfritz:fritzbox:192_168_178_1' has been updated.
19:26:02.782 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'avmfritz:fritzbox:192_168_178_1' changed from OFFLINE (CONFIGURATION_ERROR): User null has no access to FritzBox home automation functions to ONLINE: FritzBox online
19:26:40.310 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '60_Corridor' has been added.
19:27:14.262 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '10_OfficeArea' has been added.
19:27:36.245 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '20_LvingArea' has been added.
19:27:48.232 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'avmfritz:FRITZ_DECT_200:192_168_178_1:087610073758' to inbox.
19:27:48.234 [INFO ] [smarthome.event.InboxAddedEvent     ] - Discovery Result with UID 'avmfritz:FRITZ_DECT_200:192_168_178_1:087610073758' has been added.
19:27:48.236 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'avmfritz:FRITZ_Powerline_546E:192_168_178_1:08_96_D7_F7_3E_40' to inbox.
19:27:48.238 [INFO ] [smarthome.event.InboxAddedEvent     ] - Discovery Result with UID 'avmfritz:FRITZ_Powerline_546E:192_168_178_1:08_96_D7_F7_3E_40' has been added.
19:27:48.239 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'avmfritz:FRITZ_DECT_200:192_168_178_1:087610044306' to inbox.
19:27:48.241 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'avmfritz:FRITZ_DECT_200:192_168_178_1:087610207830' to inbox.
19:27:48.247 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'avmfritz:FRITZ_DECT_200:192_168_178_1:087610216689' to inbox.
19:27:48.249 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'avmfritz:FRITZ_DECT_200:192_168_178_1:087610152179' to inbox.
19:27:48.255 [INFO ] [smarthome.event.InboxAddedEvent     ] - Discovery Result with UID 'avmfritz:FRITZ_DECT_200:192_168_178_1:087610044306' has been added.
19:27:48.261 [INFO ] [smarthome.event.InboxAddedEvent     ] - Discovery Result with UID 'avmfritz:FRITZ_DECT_200:192_168_178_1:087610207830' has been added.
19:27:48.263 [INFO ] [smarthome.event.InboxAddedEvent     ] - Discovery Result with UID 'avmfritz:FRITZ_DECT_200:192_168_178_1:087610216689' has been added.
19:27:48.266 [INFO ] [smarthome.event.InboxAddedEvent     ] - Discovery Result with UID 'avmfritz:FRITZ_DECT_200:192_168_178_1:087610152179' has been added.
19:27:55.656 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '30_Kitchen' has been added.
19:28:23.503 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '40_Bedroom' has been added.
19:29:02.302 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '50_Terrace' has been added.
19:30:06.831 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '70_Bath' has been added.
19:39:34.766 [INFO ] [smarthome.event.InboxRemovedEvent   ] - Discovery Result with UID 'avmfritz:FRITZ_DECT_200:192_168_178_1:087610073758' has been removed.
19:39:34.773 [INFO ] [smarthome.event.ThingAddedEvent     ] - Thing 'avmfritz:FRITZ_DECT_200:192_168_178_1:087610073758' has been added.
19:39:34.778 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'avmfritz:FRITZ_DECT_200:192_168_178_1:087610073758' changed from UNINITIALIZED to INITIALIZING
19:39:56.682 [INFO ] [smarthome.event.ThingUpdatedEvent   ] - Thing 'avmfritz:FRITZ_DECT_200:192_168_178_1:087610073758' has been updated.
19:40:54.089 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '00_Temperature' has been added.
19:42:03.590 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '10_Temperature' has been added.
19:42:58.118 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '20_Temperature' has been added.
19:43:45.986 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '30_Temperature' has been added.
19:44:55.951 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '40_Temperature' has been added.
19:45:58.639 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '70_Temperature' has been added.
19:51:33.911 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '00_AccumulatedEnergyConsumption' has been added.
19:52:06.745 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '10_AccumulatedEnergyConsumption' has been added.
19:52:30.390 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '20_AccumulatedEnergyConsumption' has been added.
19:52:57.416 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '30_AccumulatedEnergyConsumption' has been added.
19:53:28.167 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '40_AccumulatedEnergyConsumption' has been added.
19:53:53.643 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '50_AccumulatedEnergyConsumption' has been added.
19:54:18.675 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '70_AccumulatedEnergyConsumption' has been added.
19:55:08.890 [INFO ] [smarthome.event.InboxRemovedEvent   ] - Discovery Result with UID 'avmfritz:FRITZ_Powerline_546E_Solo:192_168_178_100' has been removed.
19:55:53.314 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '00_CurrentPowerConsumption' has been added.
19:56:36.590 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '10_CurrentPowerConsumption' has been added.
19:57:01.702 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '20_CurrentPowerConsumption' has been added.
19:57:58.176 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '30_CurrentPowerConsumption' has been added.
19:58:32.536 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '40_CurrentPowerConsumption' has been added.
19:58:54.425 [INFO ] [smarthome.event.ItemUpdatedEvent    ] - Item '30_CurrentPowerConsumption' has been updated.
19:59:34.437 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '50_CurrentPowerConsumption' has been added.
20:00:06.668 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '70_CurrentPowerConsumption' has been added.
20:02:47.169 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '11_Temperature' has been added.
20:02:47.756 [ERROR] [nding.avmfritz.handler.DeviceHandler] - unknown channel uid avmfritz:FRITZ_DECT_200:192_168_178_1:087610073758:temperature
20:02:47.759 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link '11_Temperature-avmfritz:FRITZ_DECT_200:192_168_178_1:087610073758:temperature' has been added.
20:02:48.378 [INFO ] [marthome.event.ItemStateChangedEvent] - 11_Temperature changed from NULL to 24.5
20:03:47.804 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '11_AccumulatedEnergyConsumption' has been added.
20:03:48.368 [ERROR] [nding.avmfritz.handler.DeviceHandler] - unknown channel uid avmfritz:FRITZ_DECT_200:192_168_178_1:087610073758:energy
20:03:48.374 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link '11_AccumulatedEnergyConsumption-avmfritz:FRITZ_DECT_200:192_168_178_1:087610073758:energy' has been added.
20:03:48.417 [INFO ] [marthome.event.ItemStateChangedEvent] - 11_AccumulatedEnergyConsumption changed from NULL to 265.219
20:04:26.694 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item '11_CurrentPowerConsumption' has been added.
20:04:27.286 [ERROR] [nding.avmfritz.handler.DeviceHandler] - unknown channel uid avmfritz:FRITZ_DECT_200:192_168_178_1:087610073758:power
20:04:27.287 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link '11_CurrentPowerConsumption-avmfritz:FRITZ_DECT_200:192_168_178_1:087610073758:power' has been added.
20:04:33.404 [INFO ] [marthome.event.ItemStateChangedEvent] - 11_CurrentPowerConsumption changed from NULL to 46.990
20:04:48.415 [INFO ] [marthome.event.ItemStateChangedEvent] - 11_AccumulatedEnergyConsumption changed from 265.219 to 265.221
20:04:48.419 [INFO ] [marthome.event.ItemStateChangedEvent] - 11_CurrentPowerConsumption changed from 46.990 to 47.060
20:06:48.531 [INFO ] [marthome.event.ItemStateChangedEvent] - 11_AccumulatedEnergyConsumption changed from 265.221 to 265.223
20:06:48.536 [INFO ] [marthome.event.ItemStateChangedEvent] - 11_CurrentPowerConsumption changed from 47.060 to 46.990
20:07:02.119 [INFO ] [smarthome.event.ItemUpdatedEvent    ] - Item '11_CurrentPowerConsumption' has been updated.
20:07:03.497 [INFO ] [ome.event.GroupItemStateChangedEvent] - 10_CurrentPowerConsumption changed from NULL to 46.990 through 11_CurrentPowerConsumption
20:07:03.497 [INFO ] [ome.event.GroupItemStateChangedEvent] - 00_CurrentPowerConsumption changed from NULL to 46.990 through 10_CurrentPowerConsumption
20:07:33.256 [INFO ] [smarthome.event.ItemUpdatedEvent    ] - Item '11_AccumulatedEnergyConsumption' has been updated.
20:07:33.496 [INFO ] [ome.event.GroupItemStateChangedEvent] - 10_AccumulatedEnergyConsumption changed from NULL to 265.223 through 11_AccumulatedEnergyConsumption
20:07:33.500 [INFO ] [ome.event.GroupItemStateChangedEvent] - 00_AccumulatedEnergyConsumption changed from NULL to 265.223 through 10_AccumulatedEnergyConsumption
20:07:49.149 [INFO ] [smarthome.event.ItemUpdatedEvent    ] - Item '11_Temperature' has been updated.
20:08:03.493 [INFO ] [ome.event.GroupItemStateChangedEvent] - 10_Temperature changed from NULL to 24.5 through 11_Temperature
20:08:03.498 [INFO ] [ome.event.GroupItemStateChangedEvent] - 00_Temperature changed from NULL to 24.5 through 10_Temperature
20:08:48.549 [INFO ] [ome.event.GroupItemStateChangedEvent] - 10_AccumulatedEnergyConsumption changed from 265.223 to 265.224 through 11_AccumulatedEnergyConsumption
20:08:48.551 [INFO ] [ome.event.GroupItemStateChangedEvent] - 00_AccumulatedEnergyConsumption changed from 265.223 to 265.224 through 10_AccumulatedEnergyConsumption

Thank you, I just re-created my system and everything seems to be as good as it was with build 616. At long last, I feel in control of my system again :smiling_imp:

I still have to hunt for a few bugs with the netatmo binding (the NullPointerExceptions were already reported elsewhere), but apart from that things feel nice.

Argh! No more excuses not to upgrade … ;), since @rlkoshak has written the excellent tutorial to switch from OH1 to OH2 and now this “I will wait 'till the backend changed…” is gone as well…

THANKS!

Working perfectly - thanks @chris!

I just checked and I used LinkedTreeMap in the implementation which is naturally sorted, so entries shouldn’t move around and it should work well with git to track changes.

2 Likes

Awesome :slight_smile: Thanks for getting back to me, Chris!

Great stuff @chris.
Thanks for this contribution!