Bump pyenphase to 1.23.1 (#136200)

This commit is contained in:
Arie Catsman 2025-01-23 19:05:57 +01:00 committed by GitHub
parent 5803d44443
commit c98df36b75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 33 additions and 6 deletions

View File

@ -6,7 +6,7 @@
"documentation": "https://www.home-assistant.io/integrations/enphase_envoy",
"iot_class": "local_polling",
"loggers": ["pyenphase"],
"requirements": ["pyenphase==1.23.0"],
"requirements": ["pyenphase==1.23.1"],
"zeroconf": [
{
"type": "_enphase-envoy._tcp.local."

View File

@ -37,7 +37,7 @@ class EnvoyRelaySelectEntityDescription(SelectEntityDescription):
class EnvoyStorageSettingsSelectEntityDescription(SelectEntityDescription):
"""Describes an Envoy storage settings select entity."""
value_fn: Callable[[EnvoyStorageSettings], str]
value_fn: Callable[[EnvoyStorageSettings], str | None]
update_fn: Callable[[Envoy, str], Awaitable[dict[str, Any]]]
@ -118,7 +118,9 @@ STORAGE_MODE_ENTITY = EnvoyStorageSettingsSelectEntityDescription(
key="storage_mode",
translation_key="storage_mode",
options=STORAGE_MODE_OPTIONS,
value_fn=lambda storage_settings: STORAGE_MODE_MAP[storage_settings.mode],
value_fn=lambda storage_settings: (
None if not storage_settings.mode else STORAGE_MODE_MAP[storage_settings.mode]
),
update_fn=lambda envoy, value: envoy.set_storage_mode(
REVERSE_STORAGE_MODE_MAP[value]
),
@ -235,7 +237,7 @@ class EnvoyStorageSettingsSelectEntity(EnvoyBaseEntity, SelectEntity):
)
@property
def current_option(self) -> str:
def current_option(self) -> str | None:
"""Return the state of the select entity."""
assert self.data.tariff is not None
assert self.data.tariff.storage_settings is not None

2
requirements_all.txt generated
View File

@ -1923,7 +1923,7 @@ pyeiscp==0.0.7
pyemoncms==0.1.1
# homeassistant.components.enphase_envoy
pyenphase==1.23.0
pyenphase==1.23.1
# homeassistant.components.envisalink
pyenvisalink==4.7

View File

@ -1567,7 +1567,7 @@ pyeiscp==0.0.7
pyemoncms==0.1.1
# homeassistant.components.enphase_envoy
pyenphase==1.23.0
pyenphase==1.23.1
# homeassistant.components.everlights
pyeverlights==0.1.0

View File

@ -226,3 +226,28 @@ async def test_select_storage_modes(
mock_envoy.set_storage_mode.assert_called_once_with(
REVERSE_STORAGE_MODE_MAP[current_state]
)
@pytest.mark.parametrize(
("mock_envoy", "use_serial"),
[
("envoy_metered_batt_relay", "enpower_654321"),
("envoy_eu_batt", "envoy_1234"),
],
indirect=["mock_envoy"],
)
async def test_select_storage_modes_if_none(
hass: HomeAssistant,
mock_envoy: AsyncMock,
config_entry: MockConfigEntry,
use_serial: str,
) -> None:
"""Test select platform entity storage mode when tariff storage_mode is none."""
mock_envoy.data.tariff.storage_settings.mode = None
with patch("homeassistant.components.enphase_envoy.PLATFORMS", [Platform.SELECT]):
await setup_integration(hass, config_entry)
test_entity = f"{Platform.SELECT}.{use_serial}_storage_mode"
assert (entity_state := hass.states.get(test_entity))
assert entity_state.state == "unknown"