Configuration gets lost after docker container restart
Closed this issue · 7 comments
I'm using homebridge as a docker container.
When I stop and start the container my fhem devices are gone.
But when I then use the restart feature from the homebridge gui the fhem devices are back again, but they are not bound to their respective rooms anymore. I always have to rename them again and put them into their rooms.
This is reproducible and appeared during the last 2 or 3 weeks after using the docker container and this plugin for more than 2 years.
i have absolutely no idea how this can happen. i'm also pretty sure it is not related to the fhem plugin.
please verify in the logs:
- do device serial numbers stay the same?
- are there any other messages that look strange?
was there any update ?
Serial numbers do not change.
I regularly update homebridge and the plugins, so yes, there were updates.
Today I updated the homebridge docker version to 1.3.4 and will check the behavior the next few days.
If it's still not working I will have to disable some other plugins to check the mutual influence.
It happened again. After container restart all the fhem devices are gone. I restarted homebridge from the webgui and everything is back now.
Seems to be a difference if one restarts the whole docker container or just restart from inside homebridge.
I disabled the plugin "homebridge-fritz" because it's the only plugin which gives me errors in the log to see if this helps.
Disabling the plugin "homebridge-fritz" didn't make any difference. After restarting the homebridge container my fhem devices are gone again.
But I think I now narrowed it down now.
My backupscript stops all docker containers to enable a consistent backup.
It seem like there passes too much time between starting homebridge and FHEM.
The homebridge log states:
[4/18/2021, 4:38:21 AM] [FHEM] longpoll error: Error: connect ECONNREFUSED 192.168.178.222:8083, retrys exhausted
And after this entry it doesn't try to connect to FHEM again.
I changed the order in which the containers will be restarted, positioning the start auf homebridge after FHEM.
This should do the trick.
@justme-1968 What is your timeout setting until the plugin stops to connect to FHEM? In my case the FHEM container is stopped at 4:30 and obviously after 8:21 minutes the plugin stops to retry the connection.
good that you found it. there is no timeout if the connection had been established once. then the plugin will try indefinitely again. this woks without blocking homebridge.
but i had to make a change to the first connection attempt after startup as the homebridge config gut requirements say that a plugin is not allowed to block the homebridge startup. as the first gathering of fhem devices can not be done in the background as the fhem plugin uses the non dynamic api. so i had to limit the retries to a 20 second timeout. this applies only to the first connection after a restart.
if you keep the order so that fhem is started before homebridge this should never be a problem.
@LightningRhino: also i have just added a "neverTimeout": true option to the config file that you can set. but keep in mind that this will block homebridge.
Great. Thank you. When now everything is working I don't think I will need this. But good to know.