Skip to content

Allow specifying custom html urls to load.#9150

Merged
balloob merged 2 commits into
home-assistant:devfrom
andrey-git:frontend
Aug 27, 2017
Merged

Allow specifying custom html urls to load.#9150
balloob merged 2 commits into
home-assistant:devfrom
andrey-git:frontend

Conversation

@andrey-git
Copy link
Copy Markdown
Contributor

@andrey-git andrey-git commented Aug 26, 2017

Description:

Allow specifying custom html urls to load.

Proposed release text:

The frontend component now supports loading custom html files when Home Assistant front end starts.
It could be Javascript, CSS or custom Web Components.
Along there was a breaking change in the way Custom UI is used:

  • custom_ui_state_card now specifies the exact element name and not a suffix after state-card. So if you had state_card_custom_ui: custom-ui in your config, you should change it to state_card_custom_ui: state-card-custom-ui
  • custom_ui_state_card no longer makes the html fetch, you should make it separately:
frontend:
  extra_html_url:
    - /local/custom_ui/state-card-custom-ui.html

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#3260

Example entry for configuration.yaml (if applicable):

frontend:
  extra_html_url:
    - https://example.com/file1.html
    - /icons.html

Checklist:

If user exposed functionality or configuration variables are added/changed:

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@mention-bot
Copy link
Copy Markdown

@andrey-git, thanks for your PR! By analyzing the history of the files in this pull request, we identified @balloob, @JshWright and @fabaff to be potential reviewers.



@bind_hass
def add_extra_html_urls(hass, urls):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just take in 1 url.

I'm actually not too convinced that we need this method just yet. What would be a usecase that we want to programmatically add these?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to take 1 url

@andrey-git
Copy link
Copy Markdown
Contributor Author

The reason for add_extra_html_url method is to allow custom backend+frontend work.

For example I have a custom component that registers my custom panel and will add this extra url.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants