Drop the redundant Sofar total sensor seed (#185966)

This commit is contained in:
darkrain-nl
2026-10-13 20:20:10 +02:00
committed by GitHub
parent b3c1c63280
commit 75c9b002fe
2 changed files with 0 additions and 28 deletions
-2
View File
@@ -138,8 +138,6 @@ class SofarTotalSensor(SofarEntity, RestoreSensor):
except ValueError, TypeError:
return
self._attr_native_value = val
if (total_fn := self.entity_description.total_fn) is not None:
total_fn(self.coordinator.device).seed(val)
@property
@override
-26
View File
@@ -302,32 +302,6 @@ async def test_total_sensor_restore_data_parsing(
assert unset_sensor.native_value is None
async def test_total_sensor_seeds_high_water_from_restored_value(
hass: HomeAssistant, init_integration: MockConfigEntry
) -> None:
"""Test a restored value seeds the library's high-water mark."""
runtime_data = init_integration.runtime_data
device = runtime_data.readings.device
description = SofarSensorDescription(
key="load_consumption_total",
component="meter_energy",
translation_key="load_consumption_total",
state_class=SensorStateClass.TOTAL_INCREASING,
value_fn=lambda device: (
device.meter_energy.load_consumption_total_corrected.value
),
total_fn=lambda device: device.meter_energy.load_consumption_total_corrected,
)
sensor = SofarTotalSensor(runtime_data, description)
sensor.hass = hass
sensor.async_get_last_sensor_data = AsyncMock(
return_value=SimpleNamespace(native_value="555.5")
)
with patch.object(device.meter_energy, "seed_high_water") as mock_seed:
await sensor.async_added_to_hass()
mock_seed.assert_called_once_with("load_consumption_total", 555.5)
async def test_sensor_dead_link_unavailable(init_integration: MockConfigEntry) -> None:
"""Test SofarSensor.available is False when the last update failed."""
runtime_data = init_integration.runtime_data