mak-gitdev / HA_enoceanmqtt

Home Assistant wrapper for enocean-mqtt (https://github.com/embyt/enocean-mqtt)
GNU General Public License v3.0
54 stars 14 forks source link

Cannot use custom EEP.xml #109

Open OlwinFroon opened 7 months ago

OlwinFroon commented 7 months ago

The problem

As depicted here, HA_enoceanmqtt stops working as soon as I edit a custom EEP file into the configuration.

Perhaps it is because of my configuraition setup. I didn´t want to clutter up my config root directory, so I added a directory /config/enoceanmqtt to hold device file, custom mappin and EEP and the log.

Insights so far: a) adding a custom EEP.xml will cause E2M to stop right after the start. There are no log entries. b) adding a copy of the same custom EEP.xml to the /config directory (without removing the one in the subdirectory or changing the configuration) will cause E2M to run, but it will ignore the custom EEP. c) the reason for this issue lies in the run.py script of HA_enoceanmqtt-addon.

What type of installation are you running?

Addon

What version of HA_enoceanmqtt has the issue?

0.1.28-1

What was the last working version of HA_enoceanmqtt?

0.1.28

What type of Home Assitant installation are you running?

Home Assistant OS

Anything in the logs that might be useful to solve the issue? (Strongly recommended if applicable)

No response

Additional information

No response

mak-gitdev commented 7 months ago

Hi @OlwinFroon,

TL;DR

This will be fixed by 0.1.29.

Collapse to see the detailed explanation The issue comes from the `run.sh` file. The custom EEP is installed by overwriting the default EEP.xml file. As it stands, the location of the default EEP.xml is retrieved using this command: ```sh EEP_FILE_LOCATION=$(find / -name "EEP.xml" -print -quit 2>/dev/null) ``` This will look for a file named EEP.xml in the whole Docker container (yes, an addon is a Docker container) and select the first one encountered as there should always be only one. This issue was a latent bug as this command will look into the `/config` as well. Since 0.1.28-1, without going into further details, the first file will always be found in `/config`. Hence we end up trying to overwrite the custom EEP file with ... the custom EEP file, hence the error. This can be fixed by excluding the `/config` directory from the search. ```sh EEP_FILE_LOCATION=$(find / -path /config -prune -o -name 'EEP.xml' -print -quit 2>/dev/null) ``` Version 0.1.29 will fix this issue.
OlwinFroon commented 7 months ago

Oh. So the issue wouldn't have occured if I just renamed the custom to anything else but EEP.xml.

Gotta try that ...

OlwinFroon commented 7 months ago

Woo hoo, renamed it to myEEP.xml and it works :D

mak-gitdev commented 7 months ago

As simple as that :sweat_smile:

OlwinFroon commented 7 months ago

Okay, the workaround works, the fix will come with the next version. I guess this can be closed. Happy new year, btw :)

mak-gitdev commented 7 months ago

Reopened for tracking