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

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.

When I’m trying to install Nano:

bash: apk: command not found
root@core-deconz:~# apt install nano
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package nano
root@core-deconz:~#

I can see the json file, but don’t know how to modify…

Hello

I’m trying to access over SSH plugin or even with Putty and I can’t execute the first command:

  1. docker container ls

image

Can you please let me know what I have to do in order to solve this ?

Thank you

Hello, perhaps Hassos docker command not found - Configuration - Home Assistant Community

But there is this comment

This section is not for end users. End users should use the SSH add-on to SSH into Home Assistant

Same result if you use the SSH addon ?

Hello

Yes same result, as you can check in the second Image that I shared in the last post, I’m using the SSH Addon over the Home Assistant

Thank you

And that Execute in Home Assistant Container Context - #5 by doubledutch - Home Assistant OS - Home Assistant Community ?

Else can try the procedure with playing with USB key described on the official link