Skip to content

Commit 86cb4e4

Browse files
Remove state of charge sensor (calculated value)
1 parent 375dfae commit 86cb4e4

File tree

1 file changed

+0
-38
lines changed
  • custom_components/solaredge_modbus_multi

1 file changed

+0
-38
lines changed

custom_components/solaredge_modbus_multi/sensor.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ async def async_setup_entry(
186186
entities.append(SolarEdgeBatteryAvailableEnergy(battery, config_entry))
187187
entities.append(SolarEdgeBatterySOH(battery, config_entry))
188188
entities.append(SolarEdgeBatterySOE(battery, config_entry))
189-
entities.append(SolarEdgeBatterySOC(battery, config_entry))
190189
entities.append(SolarEdgeBatteryStatus(battery, config_entry))
191190

192191
if entities:
@@ -1570,43 +1569,6 @@ def native_value(self):
15701569
else:
15711570
return round(self._platform.decoded_model['B_SOE'], 0)
15721571

1573-
1574-
class SolarEdgeBatterySOC(SolarEdgeSensorBase):
1575-
state_class = SensorStateClass.MEASUREMENT
1576-
native_unit_of_measurement = PERCENTAGE
1577-
1578-
def __init__(self, platform, config_entry):
1579-
super().__init__(platform, config_entry)
1580-
"""Initialize the sensor."""
1581-
1582-
@property
1583-
def unique_id(self) -> str:
1584-
return f"{self._platform.model}_{self._platform.serial}_battery_soc"
1585-
1586-
@property
1587-
def name(self) -> str:
1588-
return f"{self._platform._device_info['name']} State of Charge"
1589-
1590-
@property
1591-
def native_value(self):
1592-
if (
1593-
self._platform.decoded_model['B_Energy_Available']== SUNSPEC_NOT_IMPL_FLOAT32
1594-
or self._platform.decoded_model['B_Energy_Available'] == 0xFF7FFFFF
1595-
or self._platform.decoded_model['B_Energy_Available'] == 0x7F7FFFFF
1596-
or self._platform.decoded_model['B_Energy_Max']== SUNSPEC_NOT_IMPL_FLOAT32
1597-
or self._platform.decoded_model['B_Energy_Max'] == 0xFF7FFFFF
1598-
or self._platform.decoded_model['B_Energy_Max'] == 0x7F7FFFFF
1599-
):
1600-
return None
1601-
1602-
else:
1603-
try:
1604-
soc = self._platform.decoded_model['B_Energy_Available'] / self._platform.decoded_model['B_Energy_Max']
1605-
return round(soc * 100, 1)
1606-
1607-
except ZeroDivisionError:
1608-
return None
1609-
16101572
class SolarEdgeBatteryStatus(Status):
16111573
def __init__(self, platform, config_entry):
16121574
super().__init__(platform, config_entry)

0 commit comments

Comments
 (0)