Skip to content

Commit 9fe9eaa

Browse files
dreimer1986drc38
andauthored
Slugify fix for HA 2026.2.0 Beta (#1855)
* Slugify fix by drc38 (2nd try) * Enhance user form with documentation URL Add description placeholders for user form. * Update configuration description link format * Update configuration link format in en.json * Add documentation URL to user form in config flow --------- Co-authored-by: drc38 <20024196+drc38@users.noreply.github.com>
1 parent 891d709 commit 9fe9eaa

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

custom_components/ocpp/config_flow.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ async def async_step_user(self, user_input=None) -> ConfigFlowResult:
132132
return self.async_create_entry(title=self._data[CONF_CSID], data=self._data)
133133

134134
return self.async_show_form(
135-
step_id="user", data_schema=STEP_USER_CS_DATA_SCHEMA, errors=errors
135+
step_id="user",
136+
data_schema=STEP_USER_CS_DATA_SCHEMA,
137+
errors=errors,
138+
description_placeholders={"docs_url": "https://github.com/lbbrhzn/ocpp"},
136139
)
137140

138141
async def async_step_integration_discovery(
@@ -184,7 +187,10 @@ async def async_step_cp_user(
184187
return await self.async_step_measurands()
185188

186189
return self.async_show_form(
187-
step_id="cp_user", data_schema=STEP_USER_CP_DATA_SCHEMA, errors=errors
190+
step_id="cp_user",
191+
data_schema=STEP_USER_CP_DATA_SCHEMA,
192+
errors=errors,
193+
description_placeholders={"docs_url": "https://github.com/lbbrhzn/ocpp"},
188194
)
189195

190196
async def async_step_measurands(self, user_input=None):

custom_components/ocpp/sensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ async def async_setup_entry(hass, entry, async_add_devices):
105105
def _mk_desc(metric: str, *, cat_diag: bool = False) -> OcppSensorDescription:
106106
ms = str(metric).strip()
107107
return OcppSensorDescription(
108-
key=ms.lower(),
108+
key=ms.lower().replace(".", "_"),
109109
name=ms.replace(".", " "),
110110
metric=ms,
111111
entity_category=EntityCategory.DIAGNOSTIC if cat_diag else None,

custom_components/ocpp/translations/en.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"step": {
44
"user": {
55
"title": "OCPP Central System Configuration",
6-
"description": "If you need help with the configuration have a look here: https://github.com/lbbrhzn/ocpp",
6+
"description": "If you need help with the configuration have a look [here]({docs_url})",
77
"data": {
88
"host": "Central system host address",
99
"port": "Central system port number",
@@ -19,7 +19,7 @@
1919
},
2020
"cp_user": {
2121
"title": "OCPP Charger Configuration",
22-
"description": "If you need help with the configuration have a look here: https://github.com/lbbrhzn/ocpp",
22+
"description": "If you need help with the configuration have a look [here]({docs_url})",
2323
"data": {
2424
"cpid": "Charge point identity",
2525
"max_current": "Maximum charging current",
@@ -82,4 +82,4 @@
8282
"message": "Failed to set variable: {message}"
8383
}
8484
}
85-
}
85+
}

0 commit comments

Comments
 (0)