-
Notifications
You must be signed in to change notification settings - Fork 12
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
Create a database recovery tool #12
Conversation
I receive an error No such file or directory: 'sqlite3' |
What platform are you running this on? SQLite should be pre-installed just about everywhere except Windows. |
I’m using home assistant os with SSH & Web Terminal addon |
Looks like it doesn't come with apk add sqlite |
Everything is working fine now. Thanks for your support and time. |
bbfbfa6
to
8ae2a90
Compare
For months now I've been seeing the error below in my HA startup logs:
Everything works well, or at least appears to. I've attempted to run the database recovery script above on a recent copy of my zigbee database, and get a runtime error logged to the console:
Any ideas on what is going wrong and possibly how to troubleshoot? I can share my zigbee database directly. Thanks! |
Can you email it to me? I can try to take a look. |
8ae2a90
to
fc76a0c
Compare
Thanks. The generated database is correct, you can ignore the warning. I've excluded those tables from the backup and have added validation. All 61 devices are present in the recovered database and it loads properly. |
Thank you @puddly |
Just posting to update that after running the db recovery tool, replacing my home assistant zigbee database with the fixed database, I am no longer seeing the error:
at startup. Thanks again! |
home-assistant/core#71351
@DeadlySin2 @Frank3501 @wolfgangpurrer I've created a tool to recover your
zigbee.db
and skip the broken rows that are preventing ZHA from properly migrating your database.You will need a Python environment to install this package, along with access to
sqlite3
. macOS and Linux are preferable but you can probably find a pre-compiled SQLite binary for Windows if that's all you have available.Here are some installation instructions for getting a Python virtual environment set up on every common platform: /~https://github.com/zigpy/zigpy-znp/blob/dev/TOOLS.md#table-of-contents. Ignore the
pip install zigpy-znp
part and instead substitute the command below:$ pip install git+/~https://github.com/zigpy/zigpy-cli.git
If you're running Home Assistant OS, you will have to run
apk add sqlite
to install thesqlite3
utility.You can then try recovering it:
$ zigpy -v db recover /path/to/your/zigbee.db fixed.db
Please post your corrupted
zigbee.db
in this issue as well, I'd like to keep track of what exactly is breaking and possibly include this functionality into zigpy in the future. Thanks!