Skip to content

Commit f10fcde

Browse files
authored
Remove the deprecated interface paramater for velbus (home-assistant#147868)
1 parent a7002e3 commit f10fcde

File tree

5 files changed

+39
-171
lines changed

5 files changed

+39
-171
lines changed

homeassistant/components/velbus/const.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
DOMAIN: Final = "velbus"
1313

1414
CONF_CONFIG_ENTRY: Final = "config_entry"
15-
CONF_INTERFACE: Final = "interface"
1615
CONF_MEMO_TEXT: Final = "memo_text"
1716
CONF_TLS: Final = "tls"
1817

homeassistant/components/velbus/services.py

Lines changed: 39 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@
1414
from homeassistant.core import HomeAssistant, ServiceCall, callback
1515
from homeassistant.exceptions import ServiceValidationError
1616
from homeassistant.helpers import config_validation as cv, selector
17-
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
1817
from homeassistant.helpers.storage import STORAGE_DIR
1918

2019
if TYPE_CHECKING:
2120
from . import VelbusConfigEntry
2221

2322
from .const import (
2423
CONF_CONFIG_ENTRY,
25-
CONF_INTERFACE,
2624
CONF_MEMO_TEXT,
2725
DOMAIN,
2826
SERVICE_CLEAR_CACHE,
@@ -49,18 +47,6 @@ async def get_config_entry(call: ServiceCall) -> VelbusConfigEntry:
4947
"""Get the config entry for this service call."""
5048
if CONF_CONFIG_ENTRY in call.data:
5149
entry_id = call.data[CONF_CONFIG_ENTRY]
52-
elif CONF_INTERFACE in call.data:
53-
# Deprecated in 2025.2, to remove in 2025.8
54-
async_create_issue(
55-
hass,
56-
DOMAIN,
57-
"deprecated_interface_parameter",
58-
breaks_in_ha_version="2025.8.0",
59-
is_fixable=False,
60-
severity=IssueSeverity.WARNING,
61-
translation_key="deprecated_interface_parameter",
62-
)
63-
entry_id = call.data[CONF_INTERFACE]
6450
if not (entry := hass.config_entries.async_get_entry(entry_id)):
6551
raise ServiceValidationError(
6652
translation_domain=DOMAIN,
@@ -118,100 +104,65 @@ async def clear_cache(call: ServiceCall) -> None:
118104
DOMAIN,
119105
SERVICE_SCAN,
120106
scan,
121-
vol.Any(
122-
vol.Schema(
123-
{
124-
vol.Required(CONF_INTERFACE): vol.All(cv.string, check_entry_id),
125-
}
126-
),
127-
vol.Schema(
128-
{
129-
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
130-
{
131-
"integration": DOMAIN,
132-
}
133-
)
134-
}
135-
),
107+
vol.Schema(
108+
{
109+
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
110+
{
111+
"integration": DOMAIN,
112+
}
113+
)
114+
}
136115
),
137116
)
138117

139118
hass.services.async_register(
140119
DOMAIN,
141120
SERVICE_SYNC,
142121
syn_clock,
143-
vol.Any(
144-
vol.Schema(
145-
{
146-
vol.Required(CONF_INTERFACE): vol.All(cv.string, check_entry_id),
147-
}
148-
),
149-
vol.Schema(
150-
{
151-
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
152-
{
153-
"integration": DOMAIN,
154-
}
155-
)
156-
}
157-
),
122+
vol.Schema(
123+
{
124+
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
125+
{
126+
"integration": DOMAIN,
127+
}
128+
)
129+
}
158130
),
159131
)
160132

161133
hass.services.async_register(
162134
DOMAIN,
163135
SERVICE_SET_MEMO_TEXT,
164136
set_memo_text,
165-
vol.Any(
166-
vol.Schema(
167-
{
168-
vol.Required(CONF_INTERFACE): vol.All(cv.string, check_entry_id),
169-
vol.Required(CONF_ADDRESS): vol.All(
170-
vol.Coerce(int), vol.Range(min=0, max=255)
171-
),
172-
vol.Optional(CONF_MEMO_TEXT, default=""): cv.template,
173-
}
174-
),
175-
vol.Schema(
176-
{
177-
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
178-
{
179-
"integration": DOMAIN,
180-
}
181-
),
182-
vol.Required(CONF_ADDRESS): vol.All(
183-
vol.Coerce(int), vol.Range(min=0, max=255)
184-
),
185-
vol.Optional(CONF_MEMO_TEXT, default=""): cv.template,
186-
}
187-
),
137+
vol.Schema(
138+
{
139+
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
140+
{
141+
"integration": DOMAIN,
142+
}
143+
),
144+
vol.Required(CONF_ADDRESS): vol.All(
145+
vol.Coerce(int), vol.Range(min=0, max=255)
146+
),
147+
vol.Optional(CONF_MEMO_TEXT, default=""): cv.template,
148+
}
188149
),
189150
)
190151

191152
hass.services.async_register(
192153
DOMAIN,
193154
SERVICE_CLEAR_CACHE,
194155
clear_cache,
195-
vol.Any(
196-
vol.Schema(
197-
{
198-
vol.Required(CONF_INTERFACE): vol.All(cv.string, check_entry_id),
199-
vol.Optional(CONF_ADDRESS): vol.All(
200-
vol.Coerce(int), vol.Range(min=0, max=255)
201-
),
202-
}
203-
),
204-
vol.Schema(
205-
{
206-
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
207-
{
208-
"integration": DOMAIN,
209-
}
210-
),
211-
vol.Optional(CONF_ADDRESS): vol.All(
212-
vol.Coerce(int), vol.Range(min=0, max=255)
213-
),
214-
}
215-
),
156+
vol.Schema(
157+
{
158+
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
159+
{
160+
"integration": DOMAIN,
161+
}
162+
),
163+
vol.Optional(CONF_ADDRESS): vol.All(
164+
vol.Coerce(int), vol.Range(min=0, max=255)
165+
),
166+
}
216167
),
217168
)

homeassistant/components/velbus/services.yaml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,19 @@
11
sync_clock:
22
fields:
3-
interface:
4-
example: "192.168.1.5:27015"
5-
default: ""
6-
selector:
7-
text:
83
config_entry:
94
selector:
105
config_entry:
116
integration: velbus
127

138
scan:
149
fields:
15-
interface:
16-
example: "192.168.1.5:27015"
17-
default: ""
18-
selector:
19-
text:
2010
config_entry:
2111
selector:
2212
config_entry:
2313
integration: velbus
2414

2515
clear_cache:
2616
fields:
27-
interface:
28-
example: "192.168.1.5:27015"
29-
default: ""
30-
selector:
31-
text:
3217
config_entry:
3318
selector:
3419
config_entry:
@@ -42,11 +27,6 @@ clear_cache:
4227

4328
set_memo_text:
4429
fields:
45-
interface:
46-
example: "192.168.1.5:27015"
47-
default: ""
48-
selector:
49-
text:
5030
config_entry:
5131
selector:
5232
config_entry:

homeassistant/components/velbus/strings.json

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@
6060
"name": "Sync clock",
6161
"description": "Syncs the clock of the Velbus modules to the Home Assistant clock, this is the same as the 'sync clock' from VelbusLink.",
6262
"fields": {
63-
"interface": {
64-
"name": "Interface",
65-
"description": "The Velbus interface to send the command to, this will be the same value as used during configuration."
66-
},
6763
"config_entry": {
6864
"name": "Config entry",
6965
"description": "The config entry of the Velbus integration"
@@ -74,10 +70,6 @@
7470
"name": "Scan",
7571
"description": "Scans the Velbus modules, this will be needed if you see unknown module warnings in the logs, or when you added new modules.",
7672
"fields": {
77-
"interface": {
78-
"name": "[%key:component::velbus::services::sync_clock::fields::interface::name%]",
79-
"description": "[%key:component::velbus::services::sync_clock::fields::interface::description%]"
80-
},
8173
"config_entry": {
8274
"name": "[%key:component::velbus::services::sync_clock::fields::config_entry::name%]",
8375
"description": "[%key:component::velbus::services::sync_clock::fields::config_entry::description%]"
@@ -88,10 +80,6 @@
8880
"name": "Clear cache",
8981
"description": "Clears the Velbus cache and then starts a new scan.",
9082
"fields": {
91-
"interface": {
92-
"name": "[%key:component::velbus::services::sync_clock::fields::interface::name%]",
93-
"description": "[%key:component::velbus::services::sync_clock::fields::interface::description%]"
94-
},
9583
"config_entry": {
9684
"name": "[%key:component::velbus::services::sync_clock::fields::config_entry::name%]",
9785
"description": "[%key:component::velbus::services::sync_clock::fields::config_entry::description%]"
@@ -106,10 +94,6 @@
10694
"name": "Set memo text",
10795
"description": "Sets the memo text to the display of modules like VMBGPO, VMBGPOD. Be sure the pages of the modules are configured to display the memo text.",
10896
"fields": {
109-
"interface": {
110-
"name": "[%key:component::velbus::services::sync_clock::fields::interface::name%]",
111-
"description": "[%key:component::velbus::services::sync_clock::fields::interface::description%]"
112-
},
11397
"config_entry": {
11498
"name": "[%key:component::velbus::services::sync_clock::fields::config_entry::name%]",
11599
"description": "[%key:component::velbus::services::sync_clock::fields::config_entry::description%]"

tests/components/velbus/test_services.py

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from homeassistant.components.velbus.const import (
99
CONF_CONFIG_ENTRY,
10-
CONF_INTERFACE,
1110
CONF_MEMO_TEXT,
1211
DOMAIN,
1312
SERVICE_CLEAR_CACHE,
@@ -18,57 +17,12 @@
1817
from homeassistant.const import CONF_ADDRESS
1918
from homeassistant.core import HomeAssistant
2019
from homeassistant.exceptions import ServiceValidationError
21-
from homeassistant.helpers import issue_registry as ir
2220

2321
from . import init_integration
2422

2523
from tests.common import MockConfigEntry
2624

2725

28-
async def test_global_services_with_interface(
29-
hass: HomeAssistant,
30-
config_entry: MockConfigEntry,
31-
issue_registry: ir.IssueRegistry,
32-
) -> None:
33-
"""Test services directed at the bus with an interface parameter."""
34-
await init_integration(hass, config_entry)
35-
36-
await hass.services.async_call(
37-
DOMAIN,
38-
SERVICE_SCAN,
39-
{CONF_INTERFACE: config_entry.data["port"]},
40-
blocking=True,
41-
)
42-
config_entry.runtime_data.controller.scan.assert_called_once_with()
43-
assert issue_registry.async_get_issue(DOMAIN, "deprecated_interface_parameter")
44-
45-
await hass.services.async_call(
46-
DOMAIN,
47-
SERVICE_SYNC,
48-
{CONF_INTERFACE: config_entry.data["port"]},
49-
blocking=True,
50-
)
51-
config_entry.runtime_data.controller.sync_clock.assert_called_once_with()
52-
53-
# Test invalid interface
54-
with pytest.raises(vol.error.MultipleInvalid):
55-
await hass.services.async_call(
56-
DOMAIN,
57-
SERVICE_SCAN,
58-
{CONF_INTERFACE: "nonexistent"},
59-
blocking=True,
60-
)
61-
62-
# Test missing interface
63-
with pytest.raises(vol.error.MultipleInvalid):
64-
await hass.services.async_call(
65-
DOMAIN,
66-
SERVICE_SCAN,
67-
{},
68-
blocking=True,
69-
)
70-
71-
7226
async def test_global_survices_with_config_entry(
7327
hass: HomeAssistant,
7428
config_entry: MockConfigEntry,

0 commit comments

Comments
 (0)