mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Remove the deprecated interface paramater for velbus (#147868)
This commit is contained in:
parent
a7002e3a24
commit
f10fcde6d8
@ -12,7 +12,6 @@ from homeassistant.components.climate import (
|
||||
DOMAIN: Final = "velbus"
|
||||
|
||||
CONF_CONFIG_ENTRY: Final = "config_entry"
|
||||
CONF_INTERFACE: Final = "interface"
|
||||
CONF_MEMO_TEXT: Final = "memo_text"
|
||||
CONF_TLS: Final = "tls"
|
||||
|
||||
|
@ -14,7 +14,6 @@ from homeassistant.const import CONF_ADDRESS
|
||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.exceptions import ServiceValidationError
|
||||
from homeassistant.helpers import config_validation as cv, selector
|
||||
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
|
||||
from homeassistant.helpers.storage import STORAGE_DIR
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -22,7 +21,6 @@ if TYPE_CHECKING:
|
||||
|
||||
from .const import (
|
||||
CONF_CONFIG_ENTRY,
|
||||
CONF_INTERFACE,
|
||||
CONF_MEMO_TEXT,
|
||||
DOMAIN,
|
||||
SERVICE_CLEAR_CACHE,
|
||||
@ -49,18 +47,6 @@ def async_setup_services(hass: HomeAssistant) -> None:
|
||||
"""Get the config entry for this service call."""
|
||||
if CONF_CONFIG_ENTRY in call.data:
|
||||
entry_id = call.data[CONF_CONFIG_ENTRY]
|
||||
elif CONF_INTERFACE in call.data:
|
||||
# Deprecated in 2025.2, to remove in 2025.8
|
||||
async_create_issue(
|
||||
hass,
|
||||
DOMAIN,
|
||||
"deprecated_interface_parameter",
|
||||
breaks_in_ha_version="2025.8.0",
|
||||
is_fixable=False,
|
||||
severity=IssueSeverity.WARNING,
|
||||
translation_key="deprecated_interface_parameter",
|
||||
)
|
||||
entry_id = call.data[CONF_INTERFACE]
|
||||
if not (entry := hass.config_entries.async_get_entry(entry_id)):
|
||||
raise ServiceValidationError(
|
||||
translation_domain=DOMAIN,
|
||||
@ -118,21 +104,14 @@ def async_setup_services(hass: HomeAssistant) -> None:
|
||||
DOMAIN,
|
||||
SERVICE_SCAN,
|
||||
scan,
|
||||
vol.Any(
|
||||
vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_INTERFACE): vol.All(cv.string, check_entry_id),
|
||||
}
|
||||
),
|
||||
vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
|
||||
{
|
||||
"integration": DOMAIN,
|
||||
}
|
||||
)
|
||||
}
|
||||
),
|
||||
vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
|
||||
{
|
||||
"integration": DOMAIN,
|
||||
}
|
||||
)
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
@ -140,21 +119,14 @@ def async_setup_services(hass: HomeAssistant) -> None:
|
||||
DOMAIN,
|
||||
SERVICE_SYNC,
|
||||
syn_clock,
|
||||
vol.Any(
|
||||
vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_INTERFACE): vol.All(cv.string, check_entry_id),
|
||||
}
|
||||
),
|
||||
vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
|
||||
{
|
||||
"integration": DOMAIN,
|
||||
}
|
||||
)
|
||||
}
|
||||
),
|
||||
vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
|
||||
{
|
||||
"integration": DOMAIN,
|
||||
}
|
||||
)
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
@ -162,29 +134,18 @@ def async_setup_services(hass: HomeAssistant) -> None:
|
||||
DOMAIN,
|
||||
SERVICE_SET_MEMO_TEXT,
|
||||
set_memo_text,
|
||||
vol.Any(
|
||||
vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_INTERFACE): vol.All(cv.string, check_entry_id),
|
||||
vol.Required(CONF_ADDRESS): vol.All(
|
||||
vol.Coerce(int), vol.Range(min=0, max=255)
|
||||
),
|
||||
vol.Optional(CONF_MEMO_TEXT, default=""): cv.template,
|
||||
}
|
||||
),
|
||||
vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
|
||||
{
|
||||
"integration": DOMAIN,
|
||||
}
|
||||
),
|
||||
vol.Required(CONF_ADDRESS): vol.All(
|
||||
vol.Coerce(int), vol.Range(min=0, max=255)
|
||||
),
|
||||
vol.Optional(CONF_MEMO_TEXT, default=""): cv.template,
|
||||
}
|
||||
),
|
||||
vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
|
||||
{
|
||||
"integration": DOMAIN,
|
||||
}
|
||||
),
|
||||
vol.Required(CONF_ADDRESS): vol.All(
|
||||
vol.Coerce(int), vol.Range(min=0, max=255)
|
||||
),
|
||||
vol.Optional(CONF_MEMO_TEXT, default=""): cv.template,
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
@ -192,26 +153,16 @@ def async_setup_services(hass: HomeAssistant) -> None:
|
||||
DOMAIN,
|
||||
SERVICE_CLEAR_CACHE,
|
||||
clear_cache,
|
||||
vol.Any(
|
||||
vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_INTERFACE): vol.All(cv.string, check_entry_id),
|
||||
vol.Optional(CONF_ADDRESS): vol.All(
|
||||
vol.Coerce(int), vol.Range(min=0, max=255)
|
||||
),
|
||||
}
|
||||
),
|
||||
vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
|
||||
{
|
||||
"integration": DOMAIN,
|
||||
}
|
||||
),
|
||||
vol.Optional(CONF_ADDRESS): vol.All(
|
||||
vol.Coerce(int), vol.Range(min=0, max=255)
|
||||
),
|
||||
}
|
||||
),
|
||||
vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
|
||||
{
|
||||
"integration": DOMAIN,
|
||||
}
|
||||
),
|
||||
vol.Optional(CONF_ADDRESS): vol.All(
|
||||
vol.Coerce(int), vol.Range(min=0, max=255)
|
||||
),
|
||||
}
|
||||
),
|
||||
)
|
||||
|
@ -1,10 +1,5 @@
|
||||
sync_clock:
|
||||
fields:
|
||||
interface:
|
||||
example: "192.168.1.5:27015"
|
||||
default: ""
|
||||
selector:
|
||||
text:
|
||||
config_entry:
|
||||
selector:
|
||||
config_entry:
|
||||
@ -12,11 +7,6 @@ sync_clock:
|
||||
|
||||
scan:
|
||||
fields:
|
||||
interface:
|
||||
example: "192.168.1.5:27015"
|
||||
default: ""
|
||||
selector:
|
||||
text:
|
||||
config_entry:
|
||||
selector:
|
||||
config_entry:
|
||||
@ -24,11 +14,6 @@ scan:
|
||||
|
||||
clear_cache:
|
||||
fields:
|
||||
interface:
|
||||
example: "192.168.1.5:27015"
|
||||
default: ""
|
||||
selector:
|
||||
text:
|
||||
config_entry:
|
||||
selector:
|
||||
config_entry:
|
||||
@ -42,11 +27,6 @@ clear_cache:
|
||||
|
||||
set_memo_text:
|
||||
fields:
|
||||
interface:
|
||||
example: "192.168.1.5:27015"
|
||||
default: ""
|
||||
selector:
|
||||
text:
|
||||
config_entry:
|
||||
selector:
|
||||
config_entry:
|
||||
|
@ -60,10 +60,6 @@
|
||||
"name": "Sync clock",
|
||||
"description": "Syncs the clock of the Velbus modules to the Home Assistant clock, this is the same as the 'sync clock' from VelbusLink.",
|
||||
"fields": {
|
||||
"interface": {
|
||||
"name": "Interface",
|
||||
"description": "The Velbus interface to send the command to, this will be the same value as used during configuration."
|
||||
},
|
||||
"config_entry": {
|
||||
"name": "Config entry",
|
||||
"description": "The config entry of the Velbus integration"
|
||||
@ -74,10 +70,6 @@
|
||||
"name": "Scan",
|
||||
"description": "Scans the Velbus modules, this will be needed if you see unknown module warnings in the logs, or when you added new modules.",
|
||||
"fields": {
|
||||
"interface": {
|
||||
"name": "[%key:component::velbus::services::sync_clock::fields::interface::name%]",
|
||||
"description": "[%key:component::velbus::services::sync_clock::fields::interface::description%]"
|
||||
},
|
||||
"config_entry": {
|
||||
"name": "[%key:component::velbus::services::sync_clock::fields::config_entry::name%]",
|
||||
"description": "[%key:component::velbus::services::sync_clock::fields::config_entry::description%]"
|
||||
@ -88,10 +80,6 @@
|
||||
"name": "Clear cache",
|
||||
"description": "Clears the Velbus cache and then starts a new scan.",
|
||||
"fields": {
|
||||
"interface": {
|
||||
"name": "[%key:component::velbus::services::sync_clock::fields::interface::name%]",
|
||||
"description": "[%key:component::velbus::services::sync_clock::fields::interface::description%]"
|
||||
},
|
||||
"config_entry": {
|
||||
"name": "[%key:component::velbus::services::sync_clock::fields::config_entry::name%]",
|
||||
"description": "[%key:component::velbus::services::sync_clock::fields::config_entry::description%]"
|
||||
@ -106,10 +94,6 @@
|
||||
"name": "Set memo text",
|
||||
"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.",
|
||||
"fields": {
|
||||
"interface": {
|
||||
"name": "[%key:component::velbus::services::sync_clock::fields::interface::name%]",
|
||||
"description": "[%key:component::velbus::services::sync_clock::fields::interface::description%]"
|
||||
},
|
||||
"config_entry": {
|
||||
"name": "[%key:component::velbus::services::sync_clock::fields::config_entry::name%]",
|
||||
"description": "[%key:component::velbus::services::sync_clock::fields::config_entry::description%]"
|
||||
|
@ -7,7 +7,6 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant.components.velbus.const import (
|
||||
CONF_CONFIG_ENTRY,
|
||||
CONF_INTERFACE,
|
||||
CONF_MEMO_TEXT,
|
||||
DOMAIN,
|
||||
SERVICE_CLEAR_CACHE,
|
||||
@ -18,57 +17,12 @@ from homeassistant.components.velbus.const import (
|
||||
from homeassistant.const import CONF_ADDRESS
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ServiceValidationError
|
||||
from homeassistant.helpers import issue_registry as ir
|
||||
|
||||
from . import init_integration
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
async def test_global_services_with_interface(
|
||||
hass: HomeAssistant,
|
||||
config_entry: MockConfigEntry,
|
||||
issue_registry: ir.IssueRegistry,
|
||||
) -> None:
|
||||
"""Test services directed at the bus with an interface parameter."""
|
||||
await init_integration(hass, config_entry)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SCAN,
|
||||
{CONF_INTERFACE: config_entry.data["port"]},
|
||||
blocking=True,
|
||||
)
|
||||
config_entry.runtime_data.controller.scan.assert_called_once_with()
|
||||
assert issue_registry.async_get_issue(DOMAIN, "deprecated_interface_parameter")
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SYNC,
|
||||
{CONF_INTERFACE: config_entry.data["port"]},
|
||||
blocking=True,
|
||||
)
|
||||
config_entry.runtime_data.controller.sync_clock.assert_called_once_with()
|
||||
|
||||
# Test invalid interface
|
||||
with pytest.raises(vol.error.MultipleInvalid):
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SCAN,
|
||||
{CONF_INTERFACE: "nonexistent"},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
# Test missing interface
|
||||
with pytest.raises(vol.error.MultipleInvalid):
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SCAN,
|
||||
{},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
|
||||
async def test_global_survices_with_config_entry(
|
||||
hass: HomeAssistant,
|
||||
config_entry: MockConfigEntry,
|
||||
|
Loading…
x
Reference in New Issue
Block a user