Skip to content

Commit 83b937f

Browse files
authored
Merge pull request #15 from TJPoorman/feature/12-add-config-title
Add config option to set title in sidebar #12
2 parents a57a0f9 + 4a9c03e commit 83b937f

4 files changed

Lines changed: 18 additions & 5 deletions

File tree

custom_components/home_maintenance/config_flow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class HomeMaintenanceConfigFlow(ConfigFlow, domain=DOMAIN):
2424
"""Config flow for Home Maintenenance."""
2525

26-
VERSION = "1.0.0"
26+
VERSION = "1.1.0"
2727
CONNECTION_CLASS = CONN_CLASS_LOCAL_POLL
2828

2929
async def async_step_user(

custom_components/home_maintenance/const.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from homeassistant.config_entries import ConfigEntry
55
from homeassistant.helpers import config_validation as cv
66

7-
VERSION = "1.0.0"
7+
VERSION = "1.3.0"
88
NAME = "Home Maintenance"
99
MANUFACTURER = "@TJPoorman"
1010

@@ -32,6 +32,7 @@
3232
CONFIG_STEP_USER_DATA_SCHEMA = vol.Schema(
3333
{
3434
vol.Optional("admin_only", default=True): cv.boolean,
35+
vol.Optional("sidebar_title", default=PANEL_TITLE): cv.string,
3536
}
3637
)
3738

@@ -46,5 +47,12 @@ def get_options_schema(config_entry: ConfigEntry) -> vol.Schema:
4647
"admin_only", config_entry.data.get("admin_only", True)
4748
),
4849
): cv.boolean,
50+
vol.Optional(
51+
"sidebar_title",
52+
default=config_entry.options.get(
53+
"sidebar_title",
54+
config_entry.data.get("sidebar_title", PANEL_TITLE),
55+
),
56+
): cv.string,
4957
}
5058
)

custom_components/home_maintenance/panel.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@ async def async_register_panel(hass: HomeAssistant, entry: ConfigEntry) -> None:
3232
hass.data["home_maintenance_static_path_registered"] = True
3333

3434
admin_only = entry.options.get("admin_only", entry.data.get("admin_only", True))
35+
sidebar_title = entry.options.get(
36+
"sidebar_title", entry.data.get("sidebar_title", PANEL_TITLE)
37+
)
3538

3639
await panel_custom.async_register_panel(
3740
hass,
3841
webcomponent_name=PANEL_NAME,
3942
frontend_url_path=PANEL_URL,
4043
module_url=PANEL_API_URL,
41-
sidebar_title=PANEL_TITLE,
44+
sidebar_title=sidebar_title,
4245
sidebar_icon=PANEL_ICON,
4346
require_admin=admin_only,
4447
config={},

custom_components/home_maintenance/translations/en.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"title": "Configure Home Maintenance",
77
"description": "Set up the Home Maintenance integration.",
88
"data": {
9-
"admin_only": "Restrict panel to admins only"
9+
"admin_only": "Restrict panel to admins only",
10+
"sidebar_title": "The name shown in the sidebar for this integration."
1011
}
1112
}
1213
},
@@ -18,7 +19,8 @@
1819
"step": {
1920
"init": {
2021
"data": {
21-
"admin_only": "Restrict panel to admins only"
22+
"admin_only": "Restrict panel to admins only",
23+
"sidebar_title": "The name shown in the sidebar for this integration."
2224
}
2325
}
2426
}

0 commit comments

Comments
 (0)