Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to preserve Homekit Scenes, Automations, Rooms and Associations for knx accessories #183

Open
migabc opened this issue Nov 6, 2020 · 12 comments

Comments

@migabc
Copy link

migabc commented Nov 6, 2020

Is there an easy way to preserve my Homekit configuration (scenes, automations, rooms, associations, etc) for my knx accessories?

Every time I try to upgrade this plugin and something goes wrong (for whatever reason) even if I later rollback the plugin, along with all the knx_config.json, persist and accessories files I still end up losing all my Homekit scenes, automations, rooms and associations related to these knx devices

A a simple backup and restore of files (or even the whole image) will not preserve my Homekit configs

This quite frustrating as I have spent several hours tweeking all my Homekit configs :-(

This problem only only happens with this homebridge-knx plugin
This does not happen with my other homebridge plugins

@snowdd1
Copy link
Owner

snowdd1 commented Nov 11, 2020

It should. The knx_config.json file gets modified during runtime (first start), so you need to backup that one after the first start, otherwise all devices get new IDs after the restore.

@migabc
Copy link
Author

migabc commented Nov 11, 2020

Nope. It doesn't.
Please see what I wrote above:

ven if I later rollback the plugin, along with all the knx_config.json, persist and accessories files I still end up losing all my Homekit scenes, automations, rooms and associations related to these knx devices

A a simple backup and restore of files (or even restoring the whole image) will not restore my lost/removed Homekit configs caused by homebridge-knx failed to start up properly

@snowdd1
Copy link
Owner

snowdd1 commented Nov 11, 2020

That is strange though. I just moved my whole homebridge instance to a raspberry without loosing anything, even with a new IP address and hardware address on the new hardware. The homebridge instance was immediately recognized by HomeKit.

@migabc
Copy link
Author

migabc commented Nov 12, 2020

Yes, that's true.
But if for some reason the knx plugin does not get registered when homebridge starts up, all the knx accessories, scenes, automations, etc will be completely wiped out from Homekit

Even if you rollback (recover your initial config), you will only recover the knx accessories themselves (which will now stay in the default room) - all your previous configurations (Rooms, scenes, automations, etc) related to those accessories will be completely lost

Is there some way of backing up/restoring your Homekit config?

@snowdd1
Copy link
Owner

snowdd1 commented Nov 12, 2020

That is right and can't be changed AFAIK. Because that is HomeKit clearing its database in the iCloud.

@migabc
Copy link
Author

migabc commented Nov 12, 2020

This problem happend to me when I tried to upgrade homebridge to the lastest version 1.0.6 (needed for someother plugin) - However, this latest version of homebridge (in fact any version >= 1.0) does not support the knx plugin - so it just started up without registering the knx plugin

So, boom - all my 200+ knx accessories were lost
Damn :-(

@migabc
Copy link
Author

migabc commented Nov 12, 2020

P.S: You should put a note stating not to upgrade to latest homebridge version (or at least the necessary configs updates before doing so)

@migabc
Copy link
Author

migabc commented Nov 12, 2020

Anyway, so there's no way of backing up/restoring the HomeKit database in the iCloud?
It would be good if we could do some sort of TimeMachine to get things back to the way they were, say "Yessterday"
I'm sure I'm not the only one having this issue

@giase82
Copy link
Contributor

giase82 commented Nov 13, 2020

I am using the “Controller for Home” App, which allows to backup and restore to some extent. It is not flawless but works for most of the things and can safe some work when restoring...
https://apps.apple.com/de/app/controller-for-homekit/id1198176727?l=en

//Christof

@fred925
Copy link

fred925 commented Jan 7, 2021

ref. migabc's comment Nov 12, 2020
"However, this latest version of homebridge (in fact any version >= 1.0) does not support the knx plugin "

I'm using homebridge v. 1.0.7 and have been struggling with the knx plugin [email protected].
I can see in the homebridge log that the plugin is loaded, however I can not see any reference to the knx_config.json containing a simple device; "ServiceType": "Lightbulb".
No accessories appear in homebridge, also when inspecting the knx_config.json after "first start" i see no UID added.
(knxd is working; I can switch on/off the "Lightbulb"from command line w. knxtool)

What is the latest homebridge version to support knx plugin, and which knx plugin should be used?

OK, fake news :-), it works with the above versions....

I found the solution, when adding platform in homebridge.config, from: #163
As I have understood it, it has been a bit back and forth weather changing homebridge.config was required or not in the newer versions, and when trying i listed an additional "platform" section, instead of adding the knx platform to the existing platform section......

Anyway, thanks a lot the first Accessory is in place and working like a charm!!!

@snowdd1
Copy link
Owner

snowdd1 commented Jan 11, 2021

@fred925 :

Sorry I cannot support any forks like homebridge-knx-easy.
You might:

  • talk to @mariomaurer to create pull requests with his improvements
  • revert to the original

image

@migabc
Copy link
Author

migabc commented Dec 4, 2022

This happens because if homebridge starts without registering the homebridge-knx plugin it will remove all knx accessories from the cachedAccessories file

I found a workaorund.
To prevent this you need to remove the write access on the root user for this file:

sudo find / -name cachedAccessories
sudo chmod 444 /var/lib/homebridge/accessories/cachedAccessories

So now whenever an upgrade (example nodejs, etc) is done on the system that prevents homebridge from registering homebridge-knx, the homebridge when starting up will not remove the knx accessories from cachedAccessories and this way we have enough time to troubleshoot the issue and eventually rollback that upgrade that prevented the homebridge-knx plugin from registering without losing all our knx accessories

Note:
Whenever you need to reconfigure/update either the config.json or knx_config.json you must re-enable write access on that file by:

sudo chmod 644 /var/lib/homebridge/accessories/cachedAccessories

After that the config.json or knx_config.json will get modified during runtime (only during the first start after the config change), so after that first start after you modified your config, you can then remove the write access on the cachedAccessories file again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants