mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +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"
|
DOMAIN: Final = "velbus"
|
||||||
|
|
||||||
CONF_CONFIG_ENTRY: Final = "config_entry"
|
CONF_CONFIG_ENTRY: Final = "config_entry"
|
||||||
CONF_INTERFACE: Final = "interface"
|
|
||||||
CONF_MEMO_TEXT: Final = "memo_text"
|
CONF_MEMO_TEXT: Final = "memo_text"
|
||||||
CONF_TLS: Final = "tls"
|
CONF_TLS: Final = "tls"
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ from homeassistant.const import CONF_ADDRESS
|
|||||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||||
from homeassistant.exceptions import ServiceValidationError
|
from homeassistant.exceptions import ServiceValidationError
|
||||||
from homeassistant.helpers import config_validation as cv, selector
|
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
|
from homeassistant.helpers.storage import STORAGE_DIR
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -22,7 +21,6 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_CONFIG_ENTRY,
|
CONF_CONFIG_ENTRY,
|
||||||
CONF_INTERFACE,
|
|
||||||
CONF_MEMO_TEXT,
|
CONF_MEMO_TEXT,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
SERVICE_CLEAR_CACHE,
|
SERVICE_CLEAR_CACHE,
|
||||||
@ -49,18 +47,6 @@ def async_setup_services(hass: HomeAssistant) -> None:
|
|||||||
"""Get the config entry for this service call."""
|
"""Get the config entry for this service call."""
|
||||||
if CONF_CONFIG_ENTRY in call.data:
|
if CONF_CONFIG_ENTRY in call.data:
|
||||||
entry_id = call.data[CONF_CONFIG_ENTRY]
|
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)):
|
if not (entry := hass.config_entries.async_get_entry(entry_id)):
|
||||||
raise ServiceValidationError(
|
raise ServiceValidationError(
|
||||||
translation_domain=DOMAIN,
|
translation_domain=DOMAIN,
|
||||||
@ -118,21 +104,14 @@ def async_setup_services(hass: HomeAssistant) -> None:
|
|||||||
DOMAIN,
|
DOMAIN,
|
||||||
SERVICE_SCAN,
|
SERVICE_SCAN,
|
||||||
scan,
|
scan,
|
||||||
vol.Any(
|
vol.Schema(
|
||||||
vol.Schema(
|
{
|
||||||
{
|
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
|
||||||
vol.Required(CONF_INTERFACE): vol.All(cv.string, check_entry_id),
|
{
|
||||||
}
|
"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,
|
DOMAIN,
|
||||||
SERVICE_SYNC,
|
SERVICE_SYNC,
|
||||||
syn_clock,
|
syn_clock,
|
||||||
vol.Any(
|
vol.Schema(
|
||||||
vol.Schema(
|
{
|
||||||
{
|
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
|
||||||
vol.Required(CONF_INTERFACE): vol.All(cv.string, check_entry_id),
|
{
|
||||||
}
|
"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,
|
DOMAIN,
|
||||||
SERVICE_SET_MEMO_TEXT,
|
SERVICE_SET_MEMO_TEXT,
|
||||||
set_memo_text,
|
set_memo_text,
|
||||||
vol.Any(
|
vol.Schema(
|
||||||
vol.Schema(
|
{
|
||||||
{
|
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
|
||||||
vol.Required(CONF_INTERFACE): vol.All(cv.string, check_entry_id),
|
{
|
||||||
vol.Required(CONF_ADDRESS): vol.All(
|
"integration": DOMAIN,
|
||||||
vol.Coerce(int), vol.Range(min=0, max=255)
|
}
|
||||||
),
|
),
|
||||||
vol.Optional(CONF_MEMO_TEXT, default=""): cv.template,
|
vol.Required(CONF_ADDRESS): vol.All(
|
||||||
}
|
vol.Coerce(int), vol.Range(min=0, max=255)
|
||||||
),
|
),
|
||||||
vol.Schema(
|
vol.Optional(CONF_MEMO_TEXT, default=""): cv.template,
|
||||||
{
|
}
|
||||||
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,
|
DOMAIN,
|
||||||
SERVICE_CLEAR_CACHE,
|
SERVICE_CLEAR_CACHE,
|
||||||
clear_cache,
|
clear_cache,
|
||||||
vol.Any(
|
vol.Schema(
|
||||||
vol.Schema(
|
{
|
||||||
{
|
vol.Required(CONF_CONFIG_ENTRY): selector.ConfigEntrySelector(
|
||||||
vol.Required(CONF_INTERFACE): vol.All(cv.string, check_entry_id),
|
{
|
||||||
vol.Optional(CONF_ADDRESS): vol.All(
|
"integration": DOMAIN,
|
||||||
vol.Coerce(int), vol.Range(min=0, max=255)
|
}
|
||||||
),
|
),
|
||||||
}
|
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:
|
sync_clock:
|
||||||
fields:
|
fields:
|
||||||
interface:
|
|
||||||
example: "192.168.1.5:27015"
|
|
||||||
default: ""
|
|
||||||
selector:
|
|
||||||
text:
|
|
||||||
config_entry:
|
config_entry:
|
||||||
selector:
|
selector:
|
||||||
config_entry:
|
config_entry:
|
||||||
@ -12,11 +7,6 @@ sync_clock:
|
|||||||
|
|
||||||
scan:
|
scan:
|
||||||
fields:
|
fields:
|
||||||
interface:
|
|
||||||
example: "192.168.1.5:27015"
|
|
||||||
default: ""
|
|
||||||
selector:
|
|
||||||
text:
|
|
||||||
config_entry:
|
config_entry:
|
||||||
selector:
|
selector:
|
||||||
config_entry:
|
config_entry:
|
||||||
@ -24,11 +14,6 @@ scan:
|
|||||||
|
|
||||||
clear_cache:
|
clear_cache:
|
||||||
fields:
|
fields:
|
||||||
interface:
|
|
||||||
example: "192.168.1.5:27015"
|
|
||||||
default: ""
|
|
||||||
selector:
|
|
||||||
text:
|
|
||||||
config_entry:
|
config_entry:
|
||||||
selector:
|
selector:
|
||||||
config_entry:
|
config_entry:
|
||||||
@ -42,11 +27,6 @@ clear_cache:
|
|||||||
|
|
||||||
set_memo_text:
|
set_memo_text:
|
||||||
fields:
|
fields:
|
||||||
interface:
|
|
||||||
example: "192.168.1.5:27015"
|
|
||||||
default: ""
|
|
||||||
selector:
|
|
||||||
text:
|
|
||||||
config_entry:
|
config_entry:
|
||||||
selector:
|
selector:
|
||||||
config_entry:
|
config_entry:
|
||||||
|
@ -60,10 +60,6 @@
|
|||||||
"name": "Sync clock",
|
"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.",
|
"description": "Syncs the clock of the Velbus modules to the Home Assistant clock, this is the same as the 'sync clock' from VelbusLink.",
|
||||||
"fields": {
|
"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": {
|
"config_entry": {
|
||||||
"name": "Config entry",
|
"name": "Config entry",
|
||||||
"description": "The config entry of the Velbus integration"
|
"description": "The config entry of the Velbus integration"
|
||||||
@ -74,10 +70,6 @@
|
|||||||
"name": "Scan",
|
"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.",
|
"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": {
|
"fields": {
|
||||||
"interface": {
|
|
||||||
"name": "[%key:component::velbus::services::sync_clock::fields::interface::name%]",
|
|
||||||
"description": "[%key:component::velbus::services::sync_clock::fields::interface::description%]"
|
|
||||||
},
|
|
||||||
"config_entry": {
|
"config_entry": {
|
||||||
"name": "[%key:component::velbus::services::sync_clock::fields::config_entry::name%]",
|
"name": "[%key:component::velbus::services::sync_clock::fields::config_entry::name%]",
|
||||||
"description": "[%key:component::velbus::services::sync_clock::fields::config_entry::description%]"
|
"description": "[%key:component::velbus::services::sync_clock::fields::config_entry::description%]"
|
||||||
@ -88,10 +80,6 @@
|
|||||||
"name": "Clear cache",
|
"name": "Clear cache",
|
||||||
"description": "Clears the Velbus cache and then starts a new scan.",
|
"description": "Clears the Velbus cache and then starts a new scan.",
|
||||||
"fields": {
|
"fields": {
|
||||||
"interface": {
|
|
||||||
"name": "[%key:component::velbus::services::sync_clock::fields::interface::name%]",
|
|
||||||
"description": "[%key:component::velbus::services::sync_clock::fields::interface::description%]"
|
|
||||||
},
|
|
||||||
"config_entry": {
|
"config_entry": {
|
||||||
"name": "[%key:component::velbus::services::sync_clock::fields::config_entry::name%]",
|
"name": "[%key:component::velbus::services::sync_clock::fields::config_entry::name%]",
|
||||||
"description": "[%key:component::velbus::services::sync_clock::fields::config_entry::description%]"
|
"description": "[%key:component::velbus::services::sync_clock::fields::config_entry::description%]"
|
||||||
@ -106,10 +94,6 @@
|
|||||||
"name": "Set memo text",
|
"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.",
|
"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": {
|
"fields": {
|
||||||
"interface": {
|
|
||||||
"name": "[%key:component::velbus::services::sync_clock::fields::interface::name%]",
|
|
||||||
"description": "[%key:component::velbus::services::sync_clock::fields::interface::description%]"
|
|
||||||
},
|
|
||||||
"config_entry": {
|
"config_entry": {
|
||||||
"name": "[%key:component::velbus::services::sync_clock::fields::config_entry::name%]",
|
"name": "[%key:component::velbus::services::sync_clock::fields::config_entry::name%]",
|
||||||
"description": "[%key:component::velbus::services::sync_clock::fields::config_entry::description%]"
|
"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 (
|
from homeassistant.components.velbus.const import (
|
||||||
CONF_CONFIG_ENTRY,
|
CONF_CONFIG_ENTRY,
|
||||||
CONF_INTERFACE,
|
|
||||||
CONF_MEMO_TEXT,
|
CONF_MEMO_TEXT,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
SERVICE_CLEAR_CACHE,
|
SERVICE_CLEAR_CACHE,
|
||||||
@ -18,57 +17,12 @@ from homeassistant.components.velbus.const import (
|
|||||||
from homeassistant.const import CONF_ADDRESS
|
from homeassistant.const import CONF_ADDRESS
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ServiceValidationError
|
from homeassistant.exceptions import ServiceValidationError
|
||||||
from homeassistant.helpers import issue_registry as ir
|
|
||||||
|
|
||||||
from . import init_integration
|
from . import init_integration
|
||||||
|
|
||||||
from tests.common import MockConfigEntry
|
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(
|
async def test_global_survices_with_config_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user