Hello, my question concern more advanced users that want to make try than a final solution.
I know it’s possible using the editor, but I want to edit the text file itslef.
I have found some explanations on the github, but don’t ask me why (I don’t use docker) but some users can’t succed, so if someone can explain shortly a way to do that why all command line,
I have some return from discord from Filipko anf Mimixx
Ssh to the hassio on Raspberry. You need to use a ADDON or something for this
Either SSH & Web Terminal or some similar plugin, or just ssh root@{ip_address} -p 22222
docker container ls
look for container id of the Deconz instance
docker exec -it {id} /bin/bash
Navigate to the folder /usr/share/deCONZ/ for exemple using cd /usr/share/deCONZ/devices/
I followed these steps to successfully enter the deconz container, and managed to find files in /usr/share/deCONZ/devices/
It took me a while to find a good way to upload changes to the .json files (the host filesystem is readonly). Finally I settled on: I checked them in into my github fork, then used wget from the container to download them from my github (using the raw files urls).
The next problem is how to make the plugin accept the update? Restarting the add-on from home assistant is not the way to go: the container is recreated and any file changes are lost.
I tried restarting the container with docker restart {id}. According to logs the app really rebooted, but the “fix” I tried does not work. I do not know if it is because the changes weren’t registered or whether the fix is insufficient.
I asked the community. Not very promising answer. Possible approach: store the DDF outside the deCONZ addon/container so it won’t be overwritten during updates or restarts.
But what you can answer for sure is:
How does deCONZ (or the appropriate devices) find its corresponding DDF files?
Based on the answer to that my second question would be if it would find a DDF outside the default storage (/usr/share/deCONZ/devices/) e. g. on a mount point?
So if I manage to create a mount point e. g. /usr/share/deCONZ/devices/custom_ddf which redirects to a permanent storage - only thing I need to do after updating (too when restarting?) is to recreate the mount point (and delete the original DDF so only one for the particular device can be found), right?
Is there potentially another way to make DDF file changes permanent? Next to adjusting the default shipped one of course (which naturally would be my favorite solution).
1 - it use the model id + the manufacture name.
2- on a normal OS this is sure
All DDF provided directly with deCONZ typically reside in /usr/share/deCONZ/devices/ on a Linux system and are loaded first. However, files residing in the home directory of the user running deCONZ (e.g. /home/<DECONZUSER>/.local/share/dresden-elektronik/deCONZ/devices) will override the pre-packaged files to allow users to amend and keep their own files if desired.
So one folder is reseted at every new deconz version, the second one is persistent. Just need to use a folder outside the docker for this one.
Changed the DDF using deCONZ (VNC), SSH to HA, login to deCONZ docker container, did a cp /usr/share/deCONZ/devices/blitzwolf/bw_shp13_smart_plug.json /data/.local/share/dresden-elektronik/deCONZ/devices/bw_shp13_smart_plug_MyCustomConfig.json.
Could not restart deCONZ yet (because of… productive reasons) to test if that storage is really persistent and the DDF stored in that location really overrides the default storage one.
One last question for now is related to the DDF content. I posted it in this other topic even it is a generic one, independently of specific devices. If that path line thing is sorted out I’ll try to restart the deCONZ Home Assistant addon asap and turn back with the results.
With your command you have copied the bw_shp13_smart_plug.json on a new path and rename it bw_shp13_smart_plug_MyCustomConfig.json.
The first folder is the deconz one (updated a every deconz update), the second one is the user one (not impacted by deconz update).
But have you set a mount or all folders are still “docker folder”, remember dockers are not persistant, all stuff present on docker image are virtual.
No, for the moment I did not play with mount points. In the /data path I found more data (like the VNC config or VNC session logs or bash history) where some of them date back months ago. No evidence, but indicators that storage is persistent, meaning it survives updates and restarts. Proof will follow once I can restart deCONZ addon.
For me they will survive to a deconz restart, but not sure for a docker update/restart.
And you want to edit the file ? because I don’t understand why you just make a copy ?
Of course I edited the original file before in the DDF editor. This way I can double test addon restarts. Expected outcome:
Original file will be overwritten, content set back to default
Custom file will still exist and stay untouched (persistent)
Surviving an dddon restart would already be very good. Addon update is a manual process (no HA addon auto updates) and making that change (maybe by a one-liner CLI command) again after every update would only be one additional step on my update check list.
Assumptions confirmed after doing a HA deCONZ addon restart:
Original file (/usr/share/deCONZ/devices/blitzwolf/bw_shp13_smart_plug.json) is overwritten/reset to default
Custom file (/data/.local/share/dresden-elektronik/deCONZ/devices/bw_shp13_smart_plug_MyCustomConfig.json) still exists and is untouched (timestamp unchanged)
Additional confirmation:
Selecting “Edit DDF” in deCONZ VNC GUI (right click) opens my custom config DDF file.
Changes applied in custom config are (still/again) active (update interval is roughly 1 minute instead of default 5 to 8 minutes)
Therefore I’m fine for the moment, will test/check if all this behaves the same when updating the deCONZ addon.
Another final information regarding the initial question (how to edit a DDF on Home Assistant):
Install a text editor e. g. nano for editing files on the CLI: apt update; apt install nano (note: this will be undone once the container is restarted or updated)
Edit your DDF file with e. g. nano /usr/share/deCONZ/devices/blitzwolf/bw_shp13_smart_plug.json
Don’t forget to “hot reload” the DDF changes using deCONZ (VNC GUI)
And you are using the basic configuration (not the external docker config), without mount ?
So it mean if you update the deconz plugin, you loose all your custom files ?
I know how to find it on docker but on the “HA docker” …
Edit:
Ok so the folder is /.local/share/dresden-elektronik/deCONZ/devices in root@core-deconz but no persistent.
It seem the only persistent folder created by HA is the “data” folder, but there is inside only options.json and the folder “OTAU”
Edit:
Ok so I have my answer from WhoTheHeck
The persistent path is /data/.local/share/dresden-elektronik/deCONZ/devices/
The path is not visible but working.