LukasGrebe / ha-addons

Addons for Home Assistant
GNU General Public License v3.0
37 stars 42 forks source link

Allow Logging to file; fixes #102 #108

Closed pvyleta closed 2 months ago

pvyleta commented 4 months ago

Since ebusd is running in foregraound, the --logfile option does not work. There is however a fairly easy workaround of redirecting the output to s6-log that can maintain the output to stdout as well as sending it to a defined folder. The default setting of s6-log is up to 5files, 1MB each. This can be changed through the configuration.

This option is especially useful for debugging.

See the option:

image

And the result:

Snímek obrazovky 2024-03-01 194911
pvyleta commented 3 months ago

cc @LukasGrebe @tim-devel would you consider this one good to be merged?

LukasGrebe commented 3 months ago

Hi @pvyleta Thanks for the pull request! I don't know a lot about s6. If you've tested this and it works as expected, feel free to add an increment to the version number and document the change in the release notes and the readme. Otherwise this change won't be loaded in existing ebusd installations.

pvyleta commented 3 months ago

@LukasGrebe thanks for fast response.

I figured out that s6-log is already present on the system, and that it does the job reliably. I have been testing this deployment over past few weeks running locally (with removed line image: "ghcr.io/lukasgrebe/ha-addon-ebusd-{arch}" from the config) and I did not observe any issues. the file current can be easily inspected through e.g. the VSCode Add-on while s6-log is incrementally writing new lines to it.

From the configuration perspective, I tested all the options of having the fields empty or having them filled in, and it works for all reasonable combinations. I did not test the translations (only English), but I am not expecting problems there.

I updated the version in changelog.md and config.yaml - hope those were the only two places necessary.

I am not sure if it is worth describing this option in more detail in the readme - though I can do that if you believe it is worth it.

pvyleta commented 3 months ago

@LukasGrebe can I ask you to help me with the failing builds? I am a bit lost, and it almost seems like something out of my control:

Error: getting Rekor public keys: unable to initialize client, local cache may be corrupt: invalid key
pvyleta commented 2 months ago

@LukasGrebe So I figured that the problem was on the HomeAssistant builder, and was fixed by using upgraded builder, see https://github.com/home-assistant/builder/issues/195. All checks pass now, I believe the PR is good to be merged.