Database issue

Hello guys,

i ran into an issue with my database. i do not really know when it happend, but all my mqtt devices lost there “configuration” (names etc). I was upon creating a template.yaml file and did reboot a couple of times via developer tools when i noticed it.

I am running HA in a docker environment on the current version.
As database i use influxdb which i integrated in my configuration.yaml like this:

influxdb:
  host: 192.168.178.10
  port: 8086
  api_version: 2
  ssl: false
  token: longToken
  organization: Home Assistant
  bucket: home_assistant

I am really no expert on databases, so is there a posibilty to get my old database values back? I really dont want to update all my sensors…

i run duplicati every night so there should be a backup of the database- would that help?

help would be much apprechiated.

regards,
Markus

The Home Assistant Database (Recorder) only supports SQL and variants:

You are using InfluDB as a second database that is separate to the one HA uses for its history.

There was a bug that corrupted the recorder database if a device was renamed. This has been fixed in the latest releases.

What is generating the mqtt devices?

Even if you restore a backup of Home Assistant your mqtt broker may still retain device discovery topics that do not match the backup.

Do you have a backup of the mqtt broker container?

That is probably what you have to restore then restart home assistant. You may also need to search the forum for Recorder database repair topics and you will need to go to Developer Tools → Statistics and fix the issues listed there.

This is assuming your mqtt devices are discovered (which is likely considering your issue) and not manually created in YAML .

Hi Tom,

thank you for replying.
I use Zigbee2Mqtt via Mosquitto to bring the data into Homeassitant.
I sat down last night and did everything by hand… it was the second time that happened to me.

Could you recommend a way i could backup this data in the future so i can restore it later? Or did i already do that with my duplicati backup (i have a backup from my mosquitto data and config)?

regards,
Markus