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

Use module variables in __init__.py for static values #78

Merged
merged 1 commit into from
Jun 23, 2023
Merged

Conversation

farmio
Copy link
Member

@farmio farmio commented Jun 12, 2023

These are marked Final now and don't need to be called (entrypoint_js instead of entrypoint_js()) which looks cleaner and is less error prone.

Also added webcomponent_name as this should live in the panel package instead of the integration.

closes #77

example use:

import knx_frontend as knx_panel

    if DOMAIN not in hass.data.get("frontend_panels", {}):
        hass.http.register_static_path(
            URL_BASE,
            path=knx_panel.locate_dir(),
            cache_headers=knx_panel.is_prod_build,
        )
        await panel_custom.async_register_panel(
            hass=hass,
            frontend_url_path=DOMAIN,
            webcomponent_name=knx_panel.webcomponent_name,
            sidebar_title=DOMAIN.upper(),
            sidebar_icon="mdi:bus-electric",
            module_url=f"{URL_BASE}/{knx_panel.entrypoint_js}",
            embed_iframe=True,
            require_admin=True,
        )

@farmio farmio merged commit adf7c9f into main Jun 23, 2023
2 checks passed
@farmio farmio deleted the init-py branch June 23, 2023 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Find proper way to store panel module properties
1 participant