diff --git a/homeassistant/components/honeywell_string_lights/config_flow.py b/homeassistant/components/honeywell_string_lights/config_flow.py index f05402260707cd..db4fcfbc8a45e1 100644 --- a/homeassistant/components/honeywell_string_lights/config_flow.py +++ b/homeassistant/components/honeywell_string_lights/config_flow.py @@ -3,6 +3,7 @@ from typing import Any from rf_protocols import RadioFrequencyCommand +from rf_protocols.codes.honeywell.string_lights import CODES import voluptuous as vol from homeassistant.components.radio_frequency import async_get_transmitters @@ -11,7 +12,6 @@ from homeassistant.helpers import entity_registry as er, selector from .const import CONF_TRANSMITTER, DOMAIN -from .light import COMMANDS class HoneywellStringLightsConfigFlow(ConfigFlow, domain=DOMAIN): @@ -24,7 +24,7 @@ async def async_step_user( ) -> ConfigFlowResult: """Handle the initial step.""" sample_command: RadioFrequencyCommand = await self.hass.async_add_executor_job( - COMMANDS.load_command, "turn_on" + CODES.load_command, "turn_on" ) try: transmitters = async_get_transmitters( diff --git a/homeassistant/components/honeywell_string_lights/light.py b/homeassistant/components/honeywell_string_lights/light.py index 7aee30c11fc55b..24dfe7adc635d5 100644 --- a/homeassistant/components/honeywell_string_lights/light.py +++ b/homeassistant/components/honeywell_string_lights/light.py @@ -2,7 +2,7 @@ from typing import Any -from rf_protocols import get_codes +from rf_protocols.codes.honeywell.string_lights import CODES from homeassistant.components.light import ColorMode, LightEntity from homeassistant.components.radio_frequency import async_send_command @@ -16,8 +16,6 @@ PARALLEL_UPDATES = 1 -COMMANDS = get_codes("honeywell/string_lights") - async def async_setup_entry( hass: HomeAssistant, @@ -57,7 +55,7 @@ async def async_turn_off(self, **kwargs: Any) -> None: async def _async_send_command(self, name: str) -> None: """Load the named command and send it via the configured transmitter.""" - command = await COMMANDS.async_load_command(name) + command = await CODES.async_load_command(name) await async_send_command( self.hass, self._transmitter, command, context=self._context ) diff --git a/homeassistant/components/honeywell_string_lights/manifest.json b/homeassistant/components/honeywell_string_lights/manifest.json index 62d65edb28e300..0b670f9f54a625 100644 --- a/homeassistant/components/honeywell_string_lights/manifest.json +++ b/homeassistant/components/honeywell_string_lights/manifest.json @@ -8,5 +8,5 @@ "integration_type": "device", "iot_class": "assumed_state", "quality_scale": "bronze", - "requirements": ["rf-protocols==2.2.0"] + "requirements": ["rf-protocols==3.0.0"] } diff --git a/homeassistant/components/novy_cooker_hood/commands.py b/homeassistant/components/novy_cooker_hood/commands.py index 783206e9427c47..6e422f9ac28b3c 100644 --- a/homeassistant/components/novy_cooker_hood/commands.py +++ b/homeassistant/components/novy_cooker_hood/commands.py @@ -1,14 +1,7 @@ -"""Helpers for loading Novy cooker-hood RF commands.""" +"""Command names for the Novy Cooker Hood RF codes.""" from typing import Final -from rf_protocols import CodeCollection, get_codes - COMMAND_LIGHT: Final = "light" COMMAND_PLUS: Final = "plus" COMMAND_MINUS: Final = "minus" - - -def get_codes_for_code(code: int) -> CodeCollection: - """Return the bundled `rf-protocols` collection for a Novy cooker-hood code.""" - return get_codes(f"novy/cooker_hood/code_{code}") diff --git a/homeassistant/components/novy_cooker_hood/config_flow.py b/homeassistant/components/novy_cooker_hood/config_flow.py index f8c316fa822a3d..51a3af08455058 100644 --- a/homeassistant/components/novy_cooker_hood/config_flow.py +++ b/homeassistant/components/novy_cooker_hood/config_flow.py @@ -3,6 +3,7 @@ import asyncio from typing import Any +from rf_protocols.codes.novy.cooker_hood import get_codes_for_code import voluptuous as vol from homeassistant.components.radio_frequency import ( @@ -17,7 +18,7 @@ from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import entity_registry as er, selector -from .commands import COMMAND_LIGHT, get_codes_for_code +from .commands import COMMAND_LIGHT from .const import ( CODE_MAX, CODE_MIN, diff --git a/homeassistant/components/novy_cooker_hood/fan.py b/homeassistant/components/novy_cooker_hood/fan.py index 323977d59c889e..7d6c477a4d3f20 100644 --- a/homeassistant/components/novy_cooker_hood/fan.py +++ b/homeassistant/components/novy_cooker_hood/fan.py @@ -3,6 +3,8 @@ import math from typing import Any +from rf_protocols.codes.novy.cooker_hood import get_codes_for_code + from homeassistant.components.fan import ATTR_PERCENTAGE, FanEntity, FanEntityFeature from homeassistant.components.radio_frequency import async_send_command from homeassistant.config_entries import ConfigEntry @@ -14,7 +16,7 @@ ranged_value_to_percentage, ) -from .commands import COMMAND_MINUS, COMMAND_PLUS, get_codes_for_code +from .commands import COMMAND_MINUS, COMMAND_PLUS from .const import CONF_CODE, SPEED_COUNT from .entity import NovyCookerHoodEntity diff --git a/homeassistant/components/novy_cooker_hood/light.py b/homeassistant/components/novy_cooker_hood/light.py index 53853d28cdf1d7..404aa39f06199b 100644 --- a/homeassistant/components/novy_cooker_hood/light.py +++ b/homeassistant/components/novy_cooker_hood/light.py @@ -2,6 +2,8 @@ from typing import Any +from rf_protocols.codes.novy.cooker_hood import get_codes_for_code + from homeassistant.components.light import ColorMode, LightEntity from homeassistant.components.radio_frequency import async_send_command from homeassistant.config_entries import ConfigEntry @@ -10,7 +12,7 @@ from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from homeassistant.helpers.restore_state import RestoreEntity -from .commands import COMMAND_LIGHT, get_codes_for_code +from .commands import COMMAND_LIGHT from .const import CONF_CODE from .entity import NovyCookerHoodEntity diff --git a/homeassistant/components/novy_cooker_hood/manifest.json b/homeassistant/components/novy_cooker_hood/manifest.json index 92a53f4c2624af..d9a2678537485b 100644 --- a/homeassistant/components/novy_cooker_hood/manifest.json +++ b/homeassistant/components/novy_cooker_hood/manifest.json @@ -8,5 +8,5 @@ "integration_type": "device", "iot_class": "assumed_state", "quality_scale": "bronze", - "requirements": ["rf-protocols==2.2.0"] + "requirements": ["rf-protocols==3.0.0"] } diff --git a/homeassistant/components/radio_frequency/manifest.json b/homeassistant/components/radio_frequency/manifest.json index 70797a9cb87641..e3b5a849961299 100644 --- a/homeassistant/components/radio_frequency/manifest.json +++ b/homeassistant/components/radio_frequency/manifest.json @@ -5,5 +5,5 @@ "documentation": "https://www.home-assistant.io/integrations/radio_frequency", "integration_type": "entity", "quality_scale": "internal", - "requirements": ["rf-protocols==2.2.0"] + "requirements": ["rf-protocols==3.0.0"] } diff --git a/requirements.txt b/requirements.txt index 56bfbaf502b83e..c9810e1c3cc8a7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -47,7 +47,7 @@ python-slugify==8.0.4 PyTurboJPEG==1.8.3 PyYAML==6.0.3 requests==2.33.1 -rf-protocols==2.2.0 +rf-protocols==3.0.0 securetar==2026.4.1 SQLAlchemy==2.0.49 standard-aifc==3.13.0 diff --git a/requirements_all.txt b/requirements_all.txt index eb4c09bc9ddb29..439dfb3fc18247 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2861,7 +2861,7 @@ reolink-aio==0.19.1 # homeassistant.components.honeywell_string_lights # homeassistant.components.novy_cooker_hood # homeassistant.components.radio_frequency -rf-protocols==2.2.0 +rf-protocols==3.0.0 # homeassistant.components.idteck_prox rfk101py==0.0.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 72ddc371d6a1e7..3d18cabb994954 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -2445,7 +2445,7 @@ reolink-aio==0.19.1 # homeassistant.components.honeywell_string_lights # homeassistant.components.novy_cooker_hood # homeassistant.components.radio_frequency -rf-protocols==2.2.0 +rf-protocols==3.0.0 # homeassistant.components.rflink rflink==0.0.67 diff --git a/tests/components/broadlink/test_radio_frequency.py b/tests/components/broadlink/test_radio_frequency.py index b5c464c7d151a1..af2422f90e86c2 100644 --- a/tests/components/broadlink/test_radio_frequency.py +++ b/tests/components/broadlink/test_radio_frequency.py @@ -5,7 +5,7 @@ from broadlink.exceptions import BroadlinkException import pytest -from rf_protocols import OOKCommand +from rf_protocols.commands.ook import OOKCommand from homeassistant.components import radio_frequency from homeassistant.components.broadlink.const import DOMAIN diff --git a/tests/components/esphome/test_radio_frequency.py b/tests/components/esphome/test_radio_frequency.py index b6c4b82953bce6..1c1fdb824145a7 100644 --- a/tests/components/esphome/test_radio_frequency.py +++ b/tests/components/esphome/test_radio_frequency.py @@ -8,7 +8,8 @@ RadioFrequencyModulation, ) import pytest -from rf_protocols import ModulationType, OOKCommand +from rf_protocols import ModulationType +from rf_protocols.commands.ook import OOKCommand from homeassistant.components import radio_frequency from homeassistant.const import STATE_UNAVAILABLE diff --git a/tests/components/honeywell_string_lights/test_light.py b/tests/components/honeywell_string_lights/test_light.py index 8795e8ddef8f53..94ef0d47ee9401 100644 --- a/tests/components/honeywell_string_lights/test_light.py +++ b/tests/components/honeywell_string_lights/test_light.py @@ -1,6 +1,7 @@ """Tests for the Honeywell String Lights light platform.""" -from homeassistant.components.honeywell_string_lights.light import COMMANDS +from rf_protocols.codes.honeywell.string_lights import CODES + from homeassistant.components.light import ( DOMAIN as LIGHT_DOMAIN, SERVICE_TURN_OFF, @@ -49,7 +50,7 @@ async def test_turn_on_off_sends_commands( assert state.context is context assert len(mock_rf_entity.send_command_calls) == 1 command = mock_rf_entity.send_command_calls[0] - assert command.command is COMMANDS.load_command("turn_on") + assert command.command is CODES.load_command("turn_on") assert command.context is context await hass.services.async_call( @@ -66,7 +67,7 @@ async def test_turn_on_off_sends_commands( assert state.context is context assert len(mock_rf_entity.send_command_calls) == 2 command = mock_rf_entity.send_command_calls[1] - assert command.command is COMMANDS.load_command("turn_off") + assert command.command is CODES.load_command("turn_off") assert command.context is context diff --git a/tests/components/kitchen_sink/test_radio_frequency.py b/tests/components/kitchen_sink/test_radio_frequency.py index 4cf19865d54557..cfdec6a25a48c8 100644 --- a/tests/components/kitchen_sink/test_radio_frequency.py +++ b/tests/components/kitchen_sink/test_radio_frequency.py @@ -4,7 +4,7 @@ from freezegun.api import FrozenDateTimeFactory import pytest -from rf_protocols import OOKCommand +from rf_protocols.commands.ook import OOKCommand from homeassistant.components.kitchen_sink import DOMAIN from homeassistant.components.radio_frequency import async_send_command diff --git a/tests/components/novy_cooker_hood/conftest.py b/tests/components/novy_cooker_hood/conftest.py index 81437114e5e2d6..f843ae3015b143 100644 --- a/tests/components/novy_cooker_hood/conftest.py +++ b/tests/components/novy_cooker_hood/conftest.py @@ -4,7 +4,7 @@ from unittest.mock import AsyncMock, MagicMock, patch import pytest -from rf_protocols import CodeCollection +from rf_protocols.loader import CodeCollection from homeassistant.components.novy_cooker_hood.const import ( CONF_CODE, @@ -30,9 +30,19 @@ def mock_get_codes() -> Iterator[MagicMock]: fake_collection.async_load_command = AsyncMock( side_effect=lambda name: MockRadioFrequencyCommand() ) - with patch( - "homeassistant.components.novy_cooker_hood.commands.get_codes", - return_value=fake_collection, + with ( + patch( + "homeassistant.components.novy_cooker_hood.light.get_codes_for_code", + return_value=fake_collection, + ), + patch( + "homeassistant.components.novy_cooker_hood.fan.get_codes_for_code", + return_value=fake_collection, + ), + patch( + "homeassistant.components.novy_cooker_hood.config_flow.get_codes_for_code", + return_value=fake_collection, + ), ): yield fake_collection