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

Fix hanging issues (final) and deprecated messages, updated docs #1527

Open
wants to merge 2 commits into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions custom_components/ui_lovelace_minimalist/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from homeassistant.loader import async_get_integration

from .base import UlmBase
from .const import DOMAIN, NAME
from .const import DOMAIN, DOMAIN_DATA, NAME
from .enums import ConfigurationType, UlmDisabledReason

_LOGGER: logging.Logger = logging.getLogger(__package__)
Expand Down Expand Up @@ -113,13 +113,26 @@ async def async_startup():

async def async_setup(hass: HomeAssistant, config: dict):
"""Set up this integration using UI."""
return await async_initialize_integration(hass=hass, config=config)
if config.get(DOMAIN) is None:
# We get here if the integration is set up using config flow
return True

hass.data.setdefault(DOMAIN_DATA, config[DOMAIN])
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_IMPORT}, data=hass.data[DOMAIN_DATA]
)
)
# Return boolean to indicate that initialization was successful.
return True


async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""Set up this integration using UI."""

config_entry.add_update_listener(config_entry_update_listener)
config_entry.async_on_unload(
config_entry.add_update_listener(config_entry_update_listener)
)
return await async_initialize_integration(hass=hass, config_entry=config_entry)


Expand All @@ -133,13 +146,6 @@ async def async_remove_entry(hass: HomeAssistant, config_entry: ConfigEntry):
async_remove_panel(hass, "ui-lovelace-minimalist")


async def async_reload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> None:
"""Reload Integration."""
_LOGGER.debug("Reload the config entry")

await async_setup_entry(hass, config_entry)


async def config_entry_update_listener(
hass: HomeAssistant, config_entry: ConfigEntry
) -> None:
Expand Down
13 changes: 9 additions & 4 deletions custom_components/ui_lovelace_minimalist/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
GitHubRatelimitException,
)
from homeassistant.components.frontend import add_extra_js_url, async_remove_panel
from homeassistant.components.http import StaticPathConfig
from homeassistant.components.lovelace import _register_panel
from homeassistant.components.lovelace.dashboard import LovelaceYAML
from homeassistant.config_entries import ConfigEntry, ConfigEntryState
Expand Down Expand Up @@ -363,10 +364,14 @@ async def configure_plugins(self) -> bool:
)

# Register
self.hass.http.register_static_path(
"/ui_lovelace_minimalist/cards",
self.hass.config.path(f"{self.integration_dir}/cards"),
True,
await self.hass.http.async_register_static_paths(
[
StaticPathConfig(
"/ui_lovelace_minimalist/cards",
self.hass.config.path(f"{self.integration_dir}/cards"),
True,
)
]
)

except Exception as exception:
Expand Down
12 changes: 9 additions & 3 deletions docs/setup/download.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ title: Prepare & Download
hide:
- toc
---

<!-- markdownlint-disable MD046 -->

Before get started on anything, make sure you have created a backup of your home assistant configuration.

> In case you experience problems during installation please reach join the [Discord Server](https://discord.gg/TPXg9b7GfR).
Expand All @@ -15,7 +17,7 @@ You should have a HomeAssistant (HA) instance running, preferably with [HACS](ht
You have access to your `config` folder of HA. Doesn’t matter which way this is, but you need to be able to upload and change files in your config. If you’re running `HA-OS` or a `supervised install` of HA, we highly recommend the [Samba AddOn](https://www.home-assistant.io/common-tasks/supervised/#installing-and-using-the-samba-add-on) (see the AddOn page for instructions) and for editing the File editor AddOn or a good editor like [Notepad++](https://notepad-plus-plus.org/) or [SublimeText](https://www.sublimetext.com/) for your OS.

!!! danger "Breaking Changes"
This integration is still under heavy development and might cause breaking changes
This integration is still under heavy development and might cause breaking changes

## HACS Download

Expand Down Expand Up @@ -54,13 +56,17 @@ In order to function correctly, the UI Lovelace Mininmalist "Theme" requires som
- [card-mod](https://github.com/thomasloven/lovelace-card-mod) by Thomas Lovén
- [mini-graph-card](https://github.com/kalkih/mini-graph-card) by Karl Kihlström
- [Mini Media Player](https://github.com/kalkih/mini-media-player) by Karl Kihlström
- [My Cards Bundle](https://github.com/AnthonMS/my-cards) by AnthonMS**
- [My Cards Bundle](https://github.com/AnthonMS/my-cards) by AnthonMS\*\*
- [Light Entity Card](https://github.com/ljmerza/light-entity-card) by Leonardo Merza
- [auto-entities](https://github.com/thomasloven/lovelace-auto-entities) by Thomas Lovén
- [simple-weather-card](https://github.com/kalkih/simple-weather-card) by Karl Kihlström
- [weather-radar-card](https://github.com/Makin-Things/weather-radar-card) by Makin-Things
- [lovelace-layout-card](https://github.com/thomasloven/lovelace-layout-card) by Thomas Lovén
- [lovelace-state-swtch](https://github.com/thomasloven/lovelace-state-switch) by Thomas Lovén

You can install these via HACS or manually.

Some resources (as marked above with **) might not be available in HACS by default.
Some resources (as marked above with \*\*) might not be available in HACS by default.
To find and install these using HACS, first add them as [custom repositories](https://hacs.xyz/docs/faq/custom_repositories/).

### Download Release File
Expand Down
53 changes: 28 additions & 25 deletions docs/setup/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ Now you can configure the Integration, you can do this also after it's installed

![hacs_integration_config](../assets/img/setup/hacs_integration_config.png)

- *Language*: Will set the language for the Integration.
- *Enable creation of a Dashboard entry in the Side panel*: If you want to add an Entry in the Side Panel for the auto generated Dashboard. (Still under heavy development!)
- *Side panel title*: Will set the title for the Lovelace Dashboard in the Sidebar.
- *Side panel icon*: Which icon to put in front of the Title.
- *Enable adaptive Dashboard with popup splitview*: Creates an entry for the [adaptive dashboard](adaptive_dash.md)
- *Adaptive panel title*: Will set the title for the adaptive dashboard in the Sidebar.
- *Adaptive panel icon*: Which icon to put in front of the adaptive dashboard sidebar entry.
- *Theme*: Choose a theme of your choice (Note: Both themes will be installed anyway and can be customized later if needed.)
- _Language_: Will set the language for the Integration.
- _Enable creation of a Dashboard entry in the Side panel_: If you want to add an Entry in the Side Panel for the auto generated Dashboard. (Still under heavy development!)
- _Side panel title_: Will set the title for the Lovelace Dashboard in the Sidebar.
- _Side panel icon_: Which icon to put in front of the Title.
- _Enable adaptive Dashboard with popup splitview_: Creates an entry for the [adaptive dashboard](adaptive_dash.md)
- _Adaptive panel title_: Will set the title for the adaptive dashboard in the Sidebar.
- _Adaptive panel icon_: Which icon to put in front of the adaptive dashboard sidebar entry.
- _Theme_: Choose a theme of your choice (Note: Both themes will be installed anyway and can be customized later if needed.)

!!! note ""

Currently, it may happen that themes are not automatically selected correctly for you in all cases automatically. Please make sure that the minimalist theme is correctly selected in your Home Assistant settings (click on your profile picture in Home Assistant, bottom left).

- *Theme path*: Make sure this is set to the same path as is configured in your `configuration.yaml` (default: `themes/`)
- _Theme path_: Make sure this is set to the same path as is configured in your `configuration.yaml` (default: `themes/`)

!!! note ""

Expand All @@ -52,34 +52,37 @@ Now you can configure the Integration, you can do this also after it's installed

You will also need to change your user theme to the chosen theme or else no visual modifications will work.

- *Include Custom Cards*: This will make sure almost all dependency cards are included and configured for you.
- _Include Custom Cards_: This will make sure almost all dependency cards are included and configured for you.

!!! danger ""

Activate **"Include Custom Cards"** only if you have not already installed the required Lovelace resources yourself, or if you dont want to install them by yourself. Otherwise this can currently lead to a freeze of the frontend due to double loaded lovelace resources.

| Included lovelace resources |
| ----------------------------------------------------------------------- |
| [`button-card`](https://github.com/custom-cards/button-card) |
| [`lovelace-card-mod`](https://github.com/thomasloven/lovelace-card-mod) |
| [`mini-graph-card`](https://github.com/kalkih/mini-graph-card) |
| [`mini-media-player`](https://github.com/kalkih/mini-media-player) |
| [`my-cards-slider-card`](https://github.com/AnthonMS/my-cards) |
| [`light-entity-card`](https://github.com/ljmerza/light-entity-card) |
| [`auto-entities`](https://github.com/thomasloven/lovelace-auto-entities)|
| [`simple-weather-card`](https://github.com/kalkih/simple-weather-card) |

- *Select Community Cards you want to enable*: Selected [custom cards](custom_cards.md) will be downloaded automatically to enable usage. Requires a GitHub account. Restart or reload your configuration after toggling this setting. If needed, a notification will appear, indicating that GitHub needs to be set up. You will be prompted to go to your integrations and to reconfigure this integration. Selecting "reconfigure" on your Lovelace Minimalist UI integration, the GitHub-Login-flow will start. You might need to restart HomeAssistant, when your selected community cards change.
| Included lovelace resources |
| ------------------------------------------------------------------------------ |
| [`button-card`](https://github.com/custom-cards/button-card) |
| [`lovelace-card-mod`](https://github.com/thomasloven/lovelace-card-mod) |
| [`mini-graph-card`](https://github.com/kalkih/mini-graph-card) |
| [`mini-media-player`](https://github.com/kalkih/mini-media-player) |
| [`my-cards-slider-card`](https://github.com/AnthonMS/my-cards) |
| [`light-entity-card`](https://github.com/ljmerza/light-entity-card) |
| [`auto-entities`](https://github.com/thomasloven/lovelace-auto-entities) |
| [`simple-weather-card`](https://github.com/kalkih/simple-weather-card) |
| [`weather-radar-card`](https://github.com/Makin-Things/weather-radar-card) |
| [`lovelace-layout-card`](https://github.com/thomasloven/lovelace-layout-card) |
| [`lovelace-state-swtch`](https://github.com/thomasloven/lovelace-state-switch) |

- _Select Community Cards you want to enable_: Selected [custom cards](custom_cards.md) will be downloaded automatically to enable usage. Requires a GitHub account. Restart or reload your configuration after toggling this setting. If needed, a notification will appear, indicating that GitHub needs to be set up. You will be prompted to go to your integrations and to reconfigure this integration. Selecting "reconfigure" on your Lovelace Minimalist UI integration, the GitHub-Login-flow will start. You might need to restart HomeAssistant, when your selected community cards change.

Hit submit and in the Sidebar a new Dashboard entry should appear.
A new file for the dashboard configuration, with a small example, where you can generate your own layout should have been created under that location:

```yaml
config
└── ui_lovelace_minimalist
├── custom_cards
└── dashboard
└── ui-lovelace.yaml
├── custom_cards
└── dashboard
└── ui-lovelace.yaml
```

In case you want to use your own ui-lovelace files go to [Configuration](../configuration).
Loading