Whenever I add a new item to my OH setup (2.5.5 Release Build) and make it available to the HomeKit binding by setting the correct tag, I need to set the room location again of all items in the Home app again.
Is there a technical reason for this or do I need to live with this?
Thanks for any answer
I think itâs part of it having to restart the homekit binding⊠It was one of the reasons I took control of homekit away from opehab and pushed mine into homebridge (which has a convienient openhab plugin). It means that if I restart openhab or add an item, then homekit is not affected generally. I can also operate in homebridge without affecting openhab.
@pverhoye do you still have issue with lost accessories?
there are relevant PRs
both are merged. so, if you upgrade to 2.5.6 released in the last day, then you should have both fixes. please let me know if you still experience issues
Well, I still have an issue where, if there is an error in the .items file (for example a } is not closed), and the fix it, all rooms are reset to Default Room again in homekit
ok. actually it should only reset the room for items which had an error in the config.
the process is like this:
when you save .items, openhab notify homemkit binding about change items. if there is mistake in config then homekit will get notification that that item was deleted
homekit binding notify home app about configuration change
home app requests a new list of accessories (accessories with an error will miss no that list)
home app compare the new list with internal db of accessories and add/delete accessories which are new or were removed
important, if you rename accessory then home app consider it as a new accessory.
ok. this is expected behaviour,
due an error in .items, none of items can be read correctly. basically, openhab reports - no correct items found. (ScreenLivingZuid is probably one of the first items in .items file). homekit binding reports to home app - all accessories are deleted. if home app requests the list of accessories then binding does not know what to reply. it does not keep the list of old accessories and the new one is empty due the error.
not sure how we could prevent this and protect from home app reset.
the only idea i have is to stop homekit binding, do all changes to .items, make sure all items are configured correctly, and then start homekit binding.
I donât know anything about the inner workings of OH but maybe something like this?
file gets changed
backup HomeKit data
check if config file is well formed
if NOK {
-> log error and restore HomeKit data backup
}
if OK {
-> process items item per item
-> if item OK
â> replace current entry in HomeKit config if exists or create new item in HomeKit config
-> if item NOK
â> log error
â> donât add item
}
set HomeKit config and start binding
@pverhoye yes, agree, this would the right approach. i.e. make processing of items configuration more robust, e.g. skip the line with the syntax error and continue with remaining configuration. currently, depending on the type of the syntax error it would mark the complete configuration as broken and hence remove all items.
making processing of the configure files more robust is not as easy as might sounds. and must be done in openhab core and not in homekit binding. maybe it will be improve openhab 3.
until then i can recommend to split bigger item configuration files in several small files. in this case you would lose only part of items in case of the syntax error.