Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend url configuration is overwritten by addon entrypoint #682

Open
mik-laj opened this issue Jan 3, 2025 · 3 comments
Open

Frontend url configuration is overwritten by addon entrypoint #682

mik-laj opened this issue Jan 3, 2025 · 3 comments

Comments

@mik-laj
Copy link

mik-laj commented Jan 3, 2025

Description of the issue

Hello,

I would like to have links in Z2M on the device details screen. Similar to what WLED integration provides:
Screenshot 2025-01-03 at 16 16 01 ("VISIT" button)

On the HA side, to do this, we need to set the configuration_url field in MQTT config. It is covered by: https://www.home-assistant.io/integrations/mqtt/
Zigbee2mqtt implements the appropriate code that sets this field.
https://github.com/Koenkk/zigbee2mqtt/blob/902db5ea5b12ddf7053faae32df4b6b4c48f269b/lib/extension/homeassistant.ts#L1962-L1983
This requires the frontend/url config to be set.
Unfortunately, this addon overwrites the entire frontend section configuration.

export ZIGBEE2MQTT_CONFIG_FRONTEND='{"enabled":true,"port": 8099}'

Environment variables have higher priority than the configuration file:
https://github.com/Koenkk/zigbee2mqtt/blob/master/lib/util/settings.ts#L387-L388

And if we configure an entire section, all section options are overwritten.
https://github.com/Koenkk/zigbee2mqtt/blob/902db5ea5b12ddf7053faae32df4b6b4c48f269b/lib/util/settings.ts#L459-L465

It would be great if the extension automatically set the frontend/url value, or at least allowed overriding the value in the configuration file.

Best regards,
Kamil Breguła

Addon version

1.42.0-2

Platform

N/A

Logs of the issue (if applicable)

No response

Copy link

github-actions bot commented Feb 3, 2025

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label Feb 3, 2025
@mik-laj
Copy link
Author

mik-laj commented Feb 4, 2025

@Koenkk Can you confirm my analysis of the problem? Is this something I can address?

It is seems to me that it is enough to partially address this problem

-export ZIGBEE2MQTT_CONFIG_FRONTEND='{"enabled":true,"port": 8099}'
+export ZIGBEE2MQTT_CONFIG_FRONTEND_ENABLED=true
+export ZIGBEE2MQTT_CONFIG_FRONTEND_PORT=8099

This will allow me to manually set the URL in the configuration

@Koenkk
Copy link
Contributor

Koenkk commented Feb 4, 2025

It is seems to me that it is enough to partially address this problem

That should fully fix the issue right? Would you mind making a PR?

@github-actions github-actions bot removed the Stale label Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants