Closed weisserd closed 8 months ago
Currently these are written to the homeassistant directory. I cannot find any documentation regarding how to write the backups but will do some more research.
In which directory exactly? Then I might assist - There are different backup solutions for Home Assistant?
It is the directory named homeassistant on my both my systems.
Is that somewhere underneath the standard directory structure?
It is in the same location as the log and the configuration.yaml on my production and dev systems. Note the two ESPSomfy RTS files. These are generated when the firmware is installed from HA. There is no guidance that I have found for persisting data to the platform outside of the config.
Ok, so this is the config folder - However I don't have any ESPSomfy file there. But I have not installed the firmware from HA and there was also no update (yet) triggered from HA.
So the folder is correct and will be included in backups.
Probably I have to wait for the first update triggered from within HA.
Yeah I have a pre-release of 2.3.1 so when I get this finalized it will show up as a firmware update. During this process it will write the file. Maybe I can figure out how to add a backup task to the device maybe I just need to add a service then you can do it from an automation.
That would probably be the best solution. To expose a service that triggers the backup of each ESPSomfy RTS device and stores it in the HomeAssistant folder.
I will add that service in the next release. All I need to figure out is how to target the device not the entity.
II think this falls under the category of a device action - https://developers.home-assistant.io/docs/device_automation_action
A simple example that I found would probably be here: https://github.com/home-assistant/core/blob/dev/homeassistant/components/adguard/__init__.py
Thanks I will have to take a deep dive into this. I suppose this might be the place to add reboot, restore, and backup.
As it turns out these device actions always resolve to an entity. All they appear to do is add the service for all entities on the device. I now understand what they are doing which is why I need to have an update entity to update the device.
So I will look at adding a backup entity to it but there is no base object in Home Assistant for a backup entity other than the one defined to backup the system. No chance of using that as it appears to be protected by dragons.
Ok so I got the backup and restore services working. I will post v2.3.1 of the integration in the next day or so. I also added button entities (because you really cannot have a service without an entity) for backup and reboot. I still cannot figure out how to create a restore entity.
I also moved the backup files to a location under the config directory for those folks that have more than one device (hub). That way when I figure out how to add a dropdown and button entity in one I can create the restore function. I can only imagine that it is probably a flow initiated by a button press.
v2.3.1 of the integration has been released. It contains the reboot and backup functions discussed.
Thank you very much. I'll check the coming weekend.
I was able to trigger the backup service but I was not able to then find a file (e.g. in the config
folder)
These are in a subdirectory under the config directory. You will find them in ESPSomfyRTS_<chipid for the esp>
in a file with the extension .backup
Also select the backup entity as selecting the device is not correct since HA requires an entity for operations such as this.
Thanks for implementation and clarification. That worked flawlessly:
It would be nice to easily integrate the backup of the configuration of the ESPSomfy RTS controllers in the central home assistant backup.
Currently I have to backup every controller on its own and it would be very convenient if this were integrated in the Home Assistant backup process.
I already tried to find the relevant information (e.g. remote address, timings, last rolling code) somewehere in Home Assistant (e.g. the home-assistant_v2.db), but I was not able to locate it. I was just able to see the according entities and eventes being sent/processed but no config values: