Use typed writes for the Sofar charger mode and remote switch (#183622)

This commit is contained in:
darkrain-nl
2026-09-30 12:15:59 +01:00
committed by GitHub
parent 7818405ed1
commit e69a5a3a1b
2 changed files with 5 additions and 4 deletions
+3 -1
View File
@@ -40,7 +40,9 @@ SELECT_DESCRIPTIONS: tuple[SofarSelectEntityDescription, ...] = (
options=_enum_options(ChargerUseMode),
options_enum=ChargerUseMode,
value_fn=lambda device: device.charger.charger_use_mode,
write_fn=lambda device, value: device.charger.write("charger_use_mode", value),
write_fn=lambda device, value: device.charger.async_write_mode(
ChargerUseMode(value)
),
),
SofarSelectEntityDescription(
key="eps_control",
+2 -3
View File
@@ -31,9 +31,8 @@ SWITCH_DESCRIPTIONS: tuple[SofarSwitchEntityDescription, ...] = (
component="remote",
name=None,
value_fn=lambda device: device.remote.remote_switch_on_off,
write_fn=lambda device, value: device.remote.write(
"remote_switch_on_off",
RemoteSwitchOnOff.ON if value else RemoteSwitchOnOff.OFF,
write_fn=lambda device, value: device.remote.async_write_switch(
RemoteSwitchOnOff.ON if value else RemoteSwitchOnOff.OFF
),
),
)