Changes for custom XML file for ZWave device automatically overwritten

For Z-Wave related questions in Domoticz

Moderator: leecollings

Post Reply
User avatar
Dutchsea
Posts: 120
Joined: Tuesday 08 December 2015 13:22
Target OS: Raspberry Pi / ODroid
Domoticz version: v2023.2
Location: The Netherlands
Contact:

Changes for custom XML file for ZWave device automatically overwritten

Post by Dutchsea »

Hi,

I order to fix an issue I have added a custom XML file in the /domoticz/Config/[Manufacturer] directory for a Zwave device.
Next, I edited the manufacturer_specific.xml to include the info and path for my custom device (and removed the code for the file that is replaced by the custom file).

And I also deleted the "older" /domoticz/Config/[Manufacturer]/manufacturer.XML file that is replaced by my custom file.

Now the interesting part (for me anyway); including the ZWave device went very smooth. But to my surprise the device that Domoticz shows after the inclusion is the default "older" version. Inspecting the manufacturer_specific.xml shows that my changes in this file have been overwritten. (Actually a new file has replaced the my edited version of the manufacturer_specific.xml). Also the "older" manufacturer.XML file that I deleted from the /domoticz/Config/[Manufacturer] directory is copied back in this directory. Both changes have been done by user root.

So when including the device in the Zwave network a process was triggered that reversed my changes. This replaced my version of the manufacturer_specific.xml and placed the default file back in the /domoticz/Config/[Manufacturer] directory.

Is this expected behaviour and if yes, how can I stop this in order for Domoticz to use my version of the XML file?


Some additional details (probably not needed to answer my question)

The change concerns an Qubino Thermostat ZMNHIA1 model H1S1P1. The default version that is used in manufacturer_specific.xml (and by Domoticz) is named ZMNHIDx model H1S2P1. This model, and the associated XML file ZMNHIDxS2.xml, does not work for my model.

I received a custom XML file from another Domoticz user that has proven to work for my model.

I edited the manufacturer_specific.xml as below:

Removed lines

Code: Select all

<!--<Product type="0005" id="0051" name="ZMNHIDx Flush on/off thermostat (H1S1P1)" config="qubino/ZMNHIDxS1.xml"/>-->
<Product config="qubino/ZMNHIDxS2.xml" id="0051" name="ZMNHIDx Flush on/off thermostat (H1S2P1)" type="0005"/>
Added line

Code: Select all

<Product config="qubino/ZMNHID1.xml" id="0051" name="ZMNHID1 Flush on/off thermostat (H1S1P1)" type="0005"/> 
I copied the custom file, ZMNHID1.xml, to the /domoticz/Config/qubino directory
And I deleted the the original XML files ZMNHIDxS2.xml and ZMNHIDxS1.xml.
(The ZMNHIDxS1.xml is not used, it is commented out in the manufacturer_specific.xml, see above, but I removed it anyway to avoid problems)

As said, after including the Qubino ZMNHID1 model H1S1P1 in the ZWave network, file ZMNHIDxS2.xml was back in the /domoticz/Config/qubino directory (owner root, all other xml files are owned by user pi). And the original manufacturer_specific.xml has replaced my version.
And Domoticz lists the device as ZMHIDx H1S2P1 while I need model ZMNHIA1 model H1S1P1.....
Raspberry PI 3B on USB drive, Debian version: 12 (bookworm), Domoticz 2024.7
Aeon Z-Wave G5 stick, RFXCOM, Sonof Zigbee 3.0 Dongle plus E, Nefit Easy, Fritzbox, Buienradar, Sonos
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Changes for custom XML file for ZWave device automatically overwritten

Post by EddyG »

What I did is that I changed ALL files with

Code: Select all

sudo chown -R pi:pi /home/pi/domoticz/Config
Then change the right on the files you don't want to be overwritten with

Code: Select all

sudo chmod 444 /home/pi/domoticz/Config/<file>
Mostly Domoticz runs as root, so I update Domoticz by hand in a SSH session as user pi, there is a script.
You will get errors about those files that could not be updated, but just ignore those.
It seems that the OZW part in Domoticz wants to download files at every start of Domoticz.
I did not find out (yet) if that part succeeds.
I gave the ozwcache*.xml file 666 rights.
User avatar
Dutchsea
Posts: 120
Joined: Tuesday 08 December 2015 13:22
Target OS: Raspberry Pi / ODroid
Domoticz version: v2023.2
Location: The Netherlands
Contact:

Re: Changes for custom XML file for ZWave device automatically overwritten

Post by Dutchsea »

Thanks for your approach. Most of it is clear to me. It will probably result is some errors in the log when OZW triis to update files but is not able to do this anymore.

Some questions:
, so I update Domoticz by hand in a SSH session as user pi, there is a script.
Not sure what this means in relation to my issue. And what script?
I did not find out (yet) if that part succeeds.
What part? Do you mean if OZW still updates files despite the changes you made?

Next, good pointer on the different rights for ozwcache*.xml.

What I will try first is to substitute the content of the default XML file (ZMNHIDxS2.xml ) with the content of the custum file (ZMNHIA1.xml).
My assumption is that Domoticz is not smart enough to see that the content of the file is updated so it wont be replaced when OZW updates files at a reboot.

What do you think?
Raspberry PI 3B on USB drive, Debian version: 12 (bookworm), Domoticz 2024.7
Aeon Z-Wave G5 stick, RFXCOM, Sonof Zigbee 3.0 Dongle plus E, Nefit Easy, Fritzbox, Buienradar, Sonos
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Changes for custom XML file for ZWave device automatically overwritten

Post by EddyG »

Dutchsea wrote: Tuesday 03 November 2020 21:56 Not sure what this means in relation to my issue. And what script?
The update scripts is in the Domoticz directory and is called "updatebeta" or "updaterelease", depending on what version you want to update.
What part? Do you mean if OZW still updates files despite the changes you made?
No, I think that at the start of Domoticz the OZW part wants to download some files, at least "manufacturer_specific.xml"
I did not (yet) investigate if that is the case, so just work with rights and probably it will work.
What I still do is I use the updatexxx file to update domoticz, and I include in that file some commands
At the start of the file just before the update I copy every file I want to preserve to the same name with an extra ".save"
And the end of that update file I copy those ".save" file back to there original filenames.
Include the updatefile itself also, because otherwise that file will be overwritten by the update.
What I will try first is to substitute the content of the default XML file (ZMNHIDxS2.xml ) with the content of the custum file (ZMNHIA1.xml).
My assumption is that Domoticz is not smart enough to see that the content of the file is updated so it wont be replaced when OZW updates files at a reboot.
You have to try and may succeed, it might be that you first have to delete the ozwcache*.xml file, KEEP A COPY :!: .
That ozwcache*.xml file has to be rebuild by OZW.
User avatar
Dutchsea
Posts: 120
Joined: Tuesday 08 December 2015 13:22
Target OS: Raspberry Pi / ODroid
Domoticz version: v2023.2
Location: The Netherlands
Contact:

Re: Changes for custom XML file for ZWave device automatically overwritten

Post by Dutchsea »

Hi, thanks for all the explanations. The past days I have been trying to get this to work but still experience that the custom xml file is overwritten.

Is there someone with another idea? How does the Z-wave update process work and can it be deactivated? It is a big black box process for me now.

So even when I have changed ownership to pi:pi, and make it write only (chmod 444) the file gets overwritten by a root update process.
And it happens not only during a restart but also when a include a new node. And it also seems to depend on the content of the xml file.
When I use an older xml differnt version the file is not replaced and when I use a newer version with some modifications to the code the file is overwritten.

What is the logic here???

Thanks again.
Raspberry PI 3B on USB drive, Debian version: 12 (bookworm), Domoticz 2024.7
Aeon Z-Wave G5 stick, RFXCOM, Sonof Zigbee 3.0 Dongle plus E, Nefit Easy, Fritzbox, Buienradar, Sonos
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Changes for custom XML file for ZWave device automatically overwritten

Post by EddyG »

Then just go for the save "function"
Here is my updatebeta file

Code: Select all

#!/bin/sh

# This script can be used to upgrade to the latest beta version

lowercase(){
    echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
}

OS=`lowercase \`uname -s\``
MACH=`uname -m`
if [ ${MACH} = "armv6l" ]
then
 MACH="armv7l"
fi

echo "Updating to latest beta version..."
echo "Please Standby..."

#This is the part where files get saved
sudo cp /home/pi/domoticz/updatebeta /home/pi/domoticz/updatebeta.save
sudo cp /home/pi/domoticz/Config/xxx /home/pi/domoticz/Config/xxx.save

wget -4 -O domoticz_beta.tgz --no-check-certificate "https://www.domoticz.com/download.php?channel=beta&type=release&system=${OS}&mach$
tar xvfz domoticz_beta.tgz --exclude='update*'
rm domoticz_beta.tgz
echo "Restarting Domoticz... (please standby...)"

#This is the part where files get restored
sudo cp /home/pi/domoticz/updatebeta.save /home/pi/domoticz/updatebeta
sudo cp /home/pi/domoticz/Config/xxx.save /home/pi/domoticz/Config/xxx

sudo service domoticz.sh restart
Update domoticz in a terminal session by running the updatebeta file.
And it happens not only during a restart but also when a include a new node. And it also seems to depend on the content of the xml file.
When I use an older xml differnt version the file is not replaced and when I use a newer version with some modifications to the code the file is overwritten.
Currently I cannot explain this, it might have to do with the fact that the OZW part of Domoticz is trying to download files.
If you use the above "trick" you always have the saved copy.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest