How to add/edit a DDF on Home assistant using text editor?

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,

Thx.

1 Like

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

  1. docker container ls
  2. look for container id of the Deconz instance
  3. docker exec -it {id} /bin/bash
  4. Navigate to the folder /usr/share/deCONZ/ for exemple using cd /usr/share/deCONZ/devices/

You will see inside others DDF

Method updated here How to add/edit a DDF on Home assistant using text editor? - #18 by bcutter?

4 Likes

Hi,

I don’t have any Docker container running Deconz instance.

I have installed Deconz using the official plugin in HomeAssistant store.

I’m trying to acces filesystem of it but it’s quite not easy at all.

I just want to push a file in the FS

Hello, what is the result of the command (HA is docker based by defaut).
docker container ls

Got any results :confused:

My HA is raspberry based

From that I have read here Hassos docker command not found - Configuration - Home Assistant Community

You need to be logged in as user hassio

Are you sure haven’t skipped this part ?

Either SSH & Web Terminal or some similar plugin, or just ssh root@{ip_address} -p 22222

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.

If I m right some user just use the cat command to create a file, perhaps this command is native on docker ?

cat >file.json

An other user, put the file on an external device and use

docker cp /mnt/data/supervisor/share/lixee_zlinky_historique_mono.json 26abed96b08c:/data/.local/share/dresden-elektronik/deCONZ/devices

To copy the file ( 26abed96b08c is the ID)

Another method to test (don’t forget the ')

touch file.json
printf 'file_contain'

Any news on this?

Someone EVER managed to permanently (survives addon updates or even addon restarts) store DDF file changes in the deCONZ addon in Home Assistant?

Doing the same manual changes using horrible VNC interface after every addon restart is just… so annoying and not that smart :frowning:

Best to ask the HA addon developers. This is not maintained by this community or Dresden.

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:

  1. How does deCONZ (or the appropriate devices) find its corresponding DDF files?
  2. 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.

Here you have a working mode for a normal docker Update frequency Blitzwolf BW-SHP13 (TZ3000_g5xawfcq) - #5 by jjansen85

Change the container mount point for your existing deCONZ volume from /root/.local/share/dresden-elektronik/deCONZ to /opt/deCONZ

If you have the method for HA, I m interested too …

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.

Thanks for describing what I did.

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:

  1. Original file will be overwritten, content set back to default
  2. 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:

  1. Original file (/usr/share/deCONZ/devices/blitzwolf/bw_shp13_smart_plug.json) is overwritten/reset to default :white_check_mark:
  2. Custom file (/data/.local/share/dresden-elektronik/deCONZ/devices/bw_shp13_smart_plug_MyCustomConfig.json) still exists and is untouched (timestamp unchanged) :white_check_mark:

Additional confirmation:

  1. Selecting “Edit DDF” in deCONZ VNC GUI (right click) opens my custom config DDF file. :white_check_mark:
  2. Changes applied in custom config are (still/again) active (update interval is roughly 1 minute instead of default 5 to 8 minutes) :white_check_mark:

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):

  1. Login via SSH to HA
  2. Login deCONZ docker container: docker exec -it addon_core_deconz bash
  3. 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)
  4. Edit your DDF file with e. g. nano /usr/share/deCONZ/devices/blitzwolf/bw_shp13_smart_plug.json
  5. Don’t forget to “hot reload” the DDF changes using deCONZ (VNC GUI)

See also Permanent changes in deCONZ addon/container (survive restart / update) - Home Assistant OS - Home Assistant Community with a lot of additional/detailed information.

2 Likes

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 ?

Hello.

Deconz use 2 folders, one reserved to it, updated at every deconz update, and one for the user, untouched.

Someone know where to find the “user” one ?

We are trying with

But this folder is not persistant.

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.