Hi all, I turned the wonderful psa car tool by flobz into a python library, and I’m trying to write an home assistant integration that uses it.
The config flow needs to download and store some files to establish the connection, so I would like to know if there are best practices in place to write and read files for ha integrations:
where should I store those files? Possibly in a place that persist a container reboot/upgrade
are there constants, or mehods in the ha code to use to access that path?
I feel loke an idiot because I looked around a lot without getting much info; the only path I’ve found is the .storage dir, but nothing more; should I just throw files there using python builtins?
I’d recommend joining the Discord server and asking in the #devs_core channel. They’ll be able to help you with that fairly easily (and the source for HACS may help you too, since it stores data in files under .storage/).
Thanks @Tinkerer, I’m not a fan of all these chats app, it’s hard to search for already answered problems and questions got swallowed in the torrent of posts…
Anyway, I both took a look at the source code and asked on discord, here’s the answer for posterity:
For binary data one can use hass.config.path("myfile"), it will build the path starting at the .storage folder, and this is what the Store class uses underneath.