Skip to content

Commit c4079cc

Browse files
authored
Merge pull request #1515 from UI-Lovelace-Minimalist/release
Release
2 parents 2c3581a + 4613c7f commit c4079cc

File tree

21 files changed

+1063
-7782
lines changed

21 files changed

+1063
-7782
lines changed

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ repos:
7373
- id: "pyupgrade"
7474
args: ["--py39-plus"]
7575

76-
- repo: "https://github.com/pre-commit/mirrors-isort"
77-
rev: "v5.10.1"
76+
- repo: https://github.com/pycqa/isort
77+
rev: 5.12.0
7878
hooks:
79-
- id: "isort"
79+
- id: isort
8080

8181
- repo: "https://github.com/psf/black"
8282
rev: "22.3.0"

custom_components/ui_lovelace_minimalist/__init__.py

+26-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
"""Custom Integration to setup UI Lovelace Minimalist."""
2+
23
from __future__ import annotations
34

45
import logging
56
from typing import Any
67

78
from aiogithubapi import AIOGitHubAPIException, GitHubAPI
8-
from homeassistant.components import frontend
9+
from homeassistant.components.frontend import async_remove_panel
910
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
10-
from homeassistant.core import Config, HomeAssistant
11+
from homeassistant.core import HomeAssistant
1112
from homeassistant.helpers.aiohttp_client import async_get_clientsession
1213
from homeassistant.loader import async_get_integration
1314

@@ -64,7 +65,6 @@ async def async_initialize_integration(
6465

6566
ulm.integration = integration
6667
ulm.version = integration.version
67-
ulm.session = clientsession
6868
ulm.hass = hass
6969
ulm.system.running = True
7070
ulm.githubapi = GitHubAPI(
@@ -89,11 +89,10 @@ async def async_startup():
8989
await ulm.fetch_cards()
9090
await ulm.configure_community_cards()
9191

92-
if (
93-
not await ulm.configure_ulm()
94-
or not await ulm.configure_plugins()
95-
or not await ulm.configure_dashboard()
96-
):
92+
ResponseConfigure = await ulm.configure_ulm()
93+
ResponsePlugins = await ulm.configure_plugins()
94+
ResponseDashboard = await ulm.configure_dashboard()
95+
if not ResponseConfigure or not ResponsePlugins or not ResponseDashboard:
9796
return False
9897

9998
ulm.enable_ulm()
@@ -112,15 +111,15 @@ async def async_startup():
112111
return True
113112

114113

115-
async def async_setup(hass: HomeAssistant, config: Config):
114+
async def async_setup(hass: HomeAssistant, config: dict):
116115
"""Set up this integration using UI."""
117116
return await async_initialize_integration(hass=hass, config=config)
118117

119118

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

123-
config_entry.add_update_listener(async_reload_entry)
122+
config_entry.add_update_listener(config_entry_update_listener)
124123
return await async_initialize_integration(hass=hass, config_entry=config_entry)
125124

126125

@@ -131,11 +130,27 @@ async def async_remove_entry(hass: HomeAssistant, config_entry: ConfigEntry):
131130
# TODO cleanup:
132131
# - themes
133132
# - blueprints
134-
frontend.async_remove_panel(hass, "ui-lovelace-minimalist")
133+
async_remove_panel(hass, "ui-lovelace-minimalist")
135134

136135

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

141140
await async_setup_entry(hass, config_entry)
141+
142+
143+
async def config_entry_update_listener(
144+
hass: HomeAssistant, config_entry: ConfigEntry
145+
) -> None:
146+
"""Update listener, called when the config entry options are changed."""
147+
_LOGGER.debug("Start config_entry_update async_reload")
148+
149+
await hass.config_entries.async_reload(config_entry.entry_id)
150+
151+
152+
async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry):
153+
"""Unload Integration."""
154+
_LOGGER.debug("Unload the config entry")
155+
156+
return await async_initialize_integration(hass=hass, config_entry=config_entry)

0 commit comments

Comments
 (0)