mirror of
https://github.com/home-assistant/core.git
synced 2026-04-20 10:26:37 +00:00
Remove None support from ESPHome supported_frequency_ranges
Always return frequency ranges from device info, matching the updated RadioFrequencyTransmitterEntity contract. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -37,12 +37,9 @@ class EsphomeRadioFrequencyEntity(
|
||||
"""ESPHome radio frequency entity using native API."""
|
||||
|
||||
@property
|
||||
def supported_frequency_ranges(self) -> list[tuple[int, int]] | None:
|
||||
def supported_frequency_ranges(self) -> list[tuple[int, int]]:
|
||||
"""Return supported frequency ranges from device info."""
|
||||
info = self._static_info
|
||||
if info.frequency_min == 0 and info.frequency_max == 0:
|
||||
return None
|
||||
return [(info.frequency_min, info.frequency_max)]
|
||||
return [(self._static_info.frequency_min, self._static_info.frequency_max)]
|
||||
|
||||
@callback
|
||||
def _on_device_update(self) -> None:
|
||||
|
||||
@@ -209,27 +209,3 @@ async def test_radio_frequency_supported_frequency_ranges(
|
||||
hass, 868_000_000, ModulationType.OOK
|
||||
)
|
||||
assert len(transmitters) == 0
|
||||
|
||||
|
||||
async def test_radio_frequency_no_frequency_ranges(
|
||||
hass: HomeAssistant,
|
||||
mock_client: APIClient,
|
||||
mock_esphome_device: MockESPHomeDeviceType,
|
||||
) -> None:
|
||||
"""Test entity with no frequency ranges matches any frequency."""
|
||||
await _mock_rf_device(
|
||||
mock_esphome_device,
|
||||
mock_client,
|
||||
frequency_min=0,
|
||||
frequency_max=0,
|
||||
)
|
||||
|
||||
transmitters = radio_frequency.async_get_transmitters(
|
||||
hass, 433_920_000, ModulationType.OOK
|
||||
)
|
||||
assert len(transmitters) == 1
|
||||
|
||||
transmitters = radio_frequency.async_get_transmitters(
|
||||
hass, 868_000_000, ModulationType.OOK
|
||||
)
|
||||
assert len(transmitters) == 1
|
||||
|
||||
Reference in New Issue
Block a user