Skip to content

Commit ad8f7fd

Browse files
elupusfrenck
authored andcommitted
Move url like strings to placeholders for nibe (home-assistant#154249)
1 parent f82ec81 commit ad8f7fd

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

homeassistant/components/nibe_heatpump/config_flow.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@
7373
)
7474

7575

76+
STEP_MODBUS_PLACEHOLDERS = {
77+
"tcp": "tcp://[HOST]:[PORT]",
78+
"serial": "serial://[LOCAL DEVICE]",
79+
"rfc2217": "rfc2217://[HOST]:[PORT]",
80+
}
81+
82+
7683
class FieldError(Exception):
7784
"""Field with invalid data."""
7885

@@ -183,7 +190,9 @@ async def async_step_modbus(
183190
"""Handle the modbus step."""
184191
if user_input is None:
185192
return self.async_show_form(
186-
step_id="modbus", data_schema=STEP_MODBUS_DATA_SCHEMA
193+
step_id="modbus",
194+
data_schema=STEP_MODBUS_DATA_SCHEMA,
195+
description_placeholders=STEP_MODBUS_PLACEHOLDERS,
187196
)
188197

189198
errors = {}
@@ -200,7 +209,10 @@ async def async_step_modbus(
200209
return self.async_create_entry(title=title, data=data)
201210

202211
return self.async_show_form(
203-
step_id="modbus", data_schema=STEP_MODBUS_DATA_SCHEMA, errors=errors
212+
step_id="modbus",
213+
data_schema=STEP_MODBUS_DATA_SCHEMA,
214+
errors=errors,
215+
description_placeholders=STEP_MODBUS_PLACEHOLDERS,
204216
)
205217

206218
async def async_step_nibegw(

homeassistant/components/nibe_heatpump/strings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"modbus_unit": "Modbus unit identifier"
1616
},
1717
"data_description": {
18-
"modbus_url": "Modbus URL that describes the connection to your heat pump or MODBUS40 unit. It should be in the form:\n - `tcp://[HOST]:[PORT]` for Modbus TCP connection\n - `serial://[LOCAL DEVICE]` for a local Modbus RTU connection\n - `rfc2217://[HOST]:[PORT]` for a remote Telnet-based Modbus RTU connection.",
18+
"modbus_url": "Modbus URL that describes the connection to your heat pump or MODBUS40 unit. It should be in the form:\n - `{tcp}` for Modbus TCP connection\n - `{serial}` for a local Modbus RTU connection\n - `{rfc2217}` for a remote Telnet-based Modbus RTU connection.",
1919
"modbus_unit": "Unit identification for your heat pump. Can usually be left at 0."
2020
}
2121
},

0 commit comments

Comments
 (0)