Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions homeassistant/components/dhcp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from collections.abc import Callable
from datetime import timedelta
from fnmatch import translate
from functools import lru_cache, partial
from functools import lru_cache
from ipaddress import IPv4Address
import itertools
import logging
Expand Down Expand Up @@ -50,12 +50,6 @@
device_registry as dr,
discovery_flow,
)
from homeassistant.helpers.deprecation import (
DeprecatedConstant,
all_with_deprecated_constants,
check_if_deprecated_constant,
dir_with_deprecated_constants,
)
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC, format_mac
from homeassistant.helpers.discovery_flow import DiscoveryKey
from homeassistant.helpers.dispatcher import async_dispatcher_connect
Expand All @@ -80,13 +74,6 @@
_LOGGER = logging.getLogger(__name__)


_DEPRECATED_DhcpServiceInfo = DeprecatedConstant(
_DhcpServiceInfo,
"homeassistant.helpers.service_info.dhcp.DhcpServiceInfo",
"2026.2",
)


def async_index_integration_matchers(
integration_matchers: list[DHCPMatcher],
) -> DhcpMatchers:
Expand Down Expand Up @@ -503,11 +490,3 @@ def _memorized_fnmatch(name: str, pattern: str) -> bool:
since the devices will not change frequently
"""
return bool(_compile_fnmatch(pattern).match(name))


# These can be removed if no deprecated constant are in this module anymore
__getattr__ = partial(check_if_deprecated_constant, module_globals=globals())
__dir__ = partial(
dir_with_deprecated_constants, module_globals_keys=[*globals().keys()]
)
__all__ = all_with_deprecated_constants(globals())
2 changes: 1 addition & 1 deletion homeassistant/components/ecovacs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"integration_type": "hub",
"iot_class": "cloud_push",
"loggers": ["sleekxmppfs", "sucks", "deebot_client"],
"requirements": ["py-sucks==0.9.11", "deebot-client==17.0.1"]
"requirements": ["py-sucks==0.9.11", "deebot-client==17.1.0"]
}
16 changes: 16 additions & 0 deletions homeassistant/components/roborock/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@ class RoborockBinarySensorDescription(BinarySensorEntityDescription):
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda data: data.status.water_shortage_status,
),
RoborockBinarySensorDescription(
key="dirty_box_full",
translation_key="dirty_box_full",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda data: data.status.dirty_water_box_status,
is_dock_entity=True,
),
RoborockBinarySensorDescription(
key="clean_box_empty",
translation_key="clean_box_empty",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda data: data.status.clear_water_box_status,
is_dock_entity=True,
),
RoborockBinarySensorDescription(
key="clean_fluid_empty",
translation_key="clean_fluid_empty",
Expand Down
6 changes: 6 additions & 0 deletions homeassistant/components/roborock/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,15 @@
},
"entity": {
"binary_sensor": {
"clean_box_empty": {
"name": "Clean water box"
},
"clean_fluid_empty": {
"name": "Cleaning fluid"
},
"dirty_box_full": {
"name": "Dirty water box"
},
"in_cleaning": {
"name": "Cleaning"
},
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion requirements_test_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 16 additions & 44 deletions tests/components/dhcp/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
MockConfigEntry,
MockModule,
async_fire_time_changed,
import_and_test_deprecated_constant,
mock_integration,
)

Expand Down Expand Up @@ -240,7 +239,7 @@ async def test_dhcp_match_hostname_and_macaddress(hass: HomeAssistant) -> None:
"discovery_key": DiscoveryKey(domain="dhcp", key="b8b7f16db533", version=1),
"source": config_entries.SOURCE_DHCP,
}
assert mock_init.mock_calls[0][2]["data"] == dhcp.DhcpServiceInfo(
assert mock_init.mock_calls[0][2]["data"] == DhcpServiceInfo(
ip="192.168.210.56",
hostname="connect",
macaddress="b8b7f16db533",
Expand Down Expand Up @@ -269,7 +268,7 @@ async def test_dhcp_renewal_match_hostname_and_macaddress(hass: HomeAssistant) -
"discovery_key": DiscoveryKey(domain="dhcp", key="50147903852c", version=1),
"source": config_entries.SOURCE_DHCP,
}
assert mock_init.mock_calls[0][2]["data"] == dhcp.DhcpServiceInfo(
assert mock_init.mock_calls[0][2]["data"] == DhcpServiceInfo(
ip="192.168.1.120",
hostname="irobot-ae9ec12dd3b04885bcbfa36afb01e1cc",
macaddress="50147903852c",
Expand Down Expand Up @@ -319,7 +318,7 @@ async def test_registered_devices(
"discovery_key": DiscoveryKey(domain="dhcp", key="50147903852c", version=1),
"source": config_entries.SOURCE_DHCP,
}
assert mock_init.mock_calls[0][2]["data"] == dhcp.DhcpServiceInfo(
assert mock_init.mock_calls[0][2]["data"] == DhcpServiceInfo(
ip="192.168.1.120",
hostname="irobot-ae9ec12dd3b04885bcbfa36afb01e1cc",
macaddress="50147903852c",
Expand All @@ -346,7 +345,7 @@ async def test_dhcp_match_hostname(hass: HomeAssistant) -> None:
"discovery_key": DiscoveryKey(domain="dhcp", key="b8b7f16db533", version=1),
"source": config_entries.SOURCE_DHCP,
}
assert mock_init.mock_calls[0][2]["data"] == dhcp.DhcpServiceInfo(
assert mock_init.mock_calls[0][2]["data"] == DhcpServiceInfo(
ip="192.168.210.56",
hostname="connect",
macaddress="b8b7f16db533",
Expand All @@ -373,7 +372,7 @@ async def test_dhcp_match_macaddress(hass: HomeAssistant) -> None:
"discovery_key": DiscoveryKey(domain="dhcp", key="b8b7f16db533", version=1),
"source": config_entries.SOURCE_DHCP,
}
assert mock_init.mock_calls[0][2]["data"] == dhcp.DhcpServiceInfo(
assert mock_init.mock_calls[0][2]["data"] == DhcpServiceInfo(
ip="192.168.210.56",
hostname="connect",
macaddress="b8b7f16db533",
Expand Down Expand Up @@ -403,7 +402,7 @@ async def test_dhcp_multiple_match_only_one_flow(hass: HomeAssistant) -> None:
"discovery_key": DiscoveryKey(domain="dhcp", key="b8b7f16db533", version=1),
"source": config_entries.SOURCE_DHCP,
}
assert mock_init.mock_calls[0][2]["data"] == dhcp.DhcpServiceInfo(
assert mock_init.mock_calls[0][2]["data"] == DhcpServiceInfo(
ip="192.168.210.56",
hostname="connect",
macaddress="b8b7f16db533",
Expand All @@ -430,7 +429,7 @@ async def test_dhcp_match_macaddress_without_hostname(hass: HomeAssistant) -> No
"discovery_key": DiscoveryKey(domain="dhcp", key="606bbd59e4b4", version=1),
"source": config_entries.SOURCE_DHCP,
}
assert mock_init.mock_calls[0][2]["data"] == dhcp.DhcpServiceInfo(
assert mock_init.mock_calls[0][2]["data"] == DhcpServiceInfo(
ip="192.168.107.151",
hostname="",
macaddress="606bbd59e4b4",
Expand Down Expand Up @@ -793,7 +792,7 @@ async def test_device_tracker_hostname_and_macaddress_exists_before_start(
"discovery_key": DiscoveryKey(domain="dhcp", key="b8b7f16db533", version=1),
"source": config_entries.SOURCE_DHCP,
}
assert mock_init.mock_calls[0][2]["data"] == dhcp.DhcpServiceInfo(
assert mock_init.mock_calls[0][2]["data"] == DhcpServiceInfo(
ip="192.168.210.56",
hostname="connect",
macaddress="b8b7f16db533",
Expand Down Expand Up @@ -828,7 +827,7 @@ async def test_device_tracker_registered(hass: HomeAssistant) -> None:
"discovery_key": DiscoveryKey(domain="dhcp", key="b8b7f16db533", version=1),
"source": config_entries.SOURCE_DHCP,
}
assert mock_init.mock_calls[0][2]["data"] == dhcp.DhcpServiceInfo(
assert mock_init.mock_calls[0][2]["data"] == DhcpServiceInfo(
ip="192.168.210.56",
hostname="connect",
macaddress="b8b7f16db533",
Expand Down Expand Up @@ -902,7 +901,7 @@ async def test_device_tracker_hostname_and_macaddress_after_start(
"discovery_key": DiscoveryKey(domain="dhcp", key="b8b7f16db533", version=1),
"source": config_entries.SOURCE_DHCP,
}
assert mock_init.mock_calls[0][2]["data"] == dhcp.DhcpServiceInfo(
assert mock_init.mock_calls[0][2]["data"] == DhcpServiceInfo(
ip="192.168.210.56",
hostname="connect",
macaddress="b8b7f16db533",
Expand Down Expand Up @@ -1100,7 +1099,7 @@ async def test_aiodiscover_finds_new_hosts(hass: HomeAssistant) -> None:
"discovery_key": DiscoveryKey(domain="dhcp", key="b8b7f16db533", version=1),
"source": config_entries.SOURCE_DHCP,
}
assert mock_init.mock_calls[0][2]["data"] == dhcp.DhcpServiceInfo(
assert mock_init.mock_calls[0][2]["data"] == DhcpServiceInfo(
ip="192.168.210.56",
hostname="connect",
macaddress="b8b7f16db533",
Expand Down Expand Up @@ -1160,7 +1159,7 @@ async def test_aiodiscover_does_not_call_again_on_shorter_hostname(
"discovery_key": DiscoveryKey(domain="dhcp", key="b8b7f16db533", version=1),
"source": config_entries.SOURCE_DHCP,
}
assert mock_init.mock_calls[0][2]["data"] == dhcp.DhcpServiceInfo(
assert mock_init.mock_calls[0][2]["data"] == DhcpServiceInfo(
ip="192.168.210.56",
hostname="irobot-abc",
macaddress="b8b7f16db533",
Expand All @@ -1170,7 +1169,7 @@ async def test_aiodiscover_does_not_call_again_on_shorter_hostname(
"discovery_key": DiscoveryKey(domain="dhcp", key="b8b7f16db533", version=1),
"source": config_entries.SOURCE_DHCP,
}
assert mock_init.mock_calls[1][2]["data"] == dhcp.DhcpServiceInfo(
assert mock_init.mock_calls[1][2]["data"] == DhcpServiceInfo(
ip="192.168.210.56",
hostname="irobot-abcdef",
macaddress="b8b7f16db533",
Expand Down Expand Up @@ -1226,7 +1225,7 @@ async def test_aiodiscover_finds_new_hosts_after_interval(hass: HomeAssistant) -
"discovery_key": DiscoveryKey(domain="dhcp", key="b8b7f16db533", version=1),
"source": config_entries.SOURCE_DHCP,
}
assert mock_init.mock_calls[0][2]["data"] == dhcp.DhcpServiceInfo(
assert mock_init.mock_calls[0][2]["data"] == DhcpServiceInfo(
ip="192.168.210.56",
hostname="connect",
macaddress="b8b7f16db533",
Expand Down Expand Up @@ -1316,7 +1315,7 @@ async def test_dhcp_rediscover(
assert len(mock_init.mock_calls) == 1
assert mock_init.mock_calls[0][1][0] == "mock-domain"
assert mock_init.mock_calls[0][2]["context"] == expected_context
assert mock_init.mock_calls[0][2]["data"] == dhcp.DhcpServiceInfo(
assert mock_init.mock_calls[0][2]["data"] == DhcpServiceInfo(
ip="192.168.210.56",
hostname="connect",
macaddress="b8b7f16db533",
Expand Down Expand Up @@ -1405,7 +1404,7 @@ async def test_dhcp_rediscover_no_match(
assert len(mock_init.mock_calls) == 1
assert mock_init.mock_calls[0][1][0] == "mock-domain"
assert mock_init.mock_calls[0][2]["context"] == expected_context
assert mock_init.mock_calls[0][2]["data"] == dhcp.DhcpServiceInfo(
assert mock_init.mock_calls[0][2]["data"] == DhcpServiceInfo(
ip="192.168.210.56",
hostname="connect",
macaddress="b8b7f16db533",
Expand All @@ -1416,30 +1415,3 @@ async def test_dhcp_rediscover_no_match(
await hass.async_block_till_done()

assert len(mock_init.mock_calls) == 0


@pytest.mark.parametrize(
("constant_name", "replacement_name", "replacement"),
[
(
"DhcpServiceInfo",
"homeassistant.helpers.service_info.dhcp.DhcpServiceInfo",
DhcpServiceInfo,
),
],
)
def test_deprecated_constants(
caplog: pytest.LogCaptureFixture,
constant_name: str,
replacement_name: str,
replacement: Any,
) -> None:
"""Test deprecated automation constants."""
import_and_test_deprecated_constant(
caplog,
dhcp,
constant_name,
replacement_name,
replacement,
"2026.2",
)
1 change: 1 addition & 0 deletions tests/components/roborock/mock_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1402,6 +1402,7 @@
"charge_status": 1,
"unsave_map_reason": 0,
"unsave_map_flag": 0,
"dss": 20,
}
)

Expand Down
Loading
Loading