Skip to content

Commit dfdd243

Browse files
Add class SolarEdgeAdvancedPowerControlBlock
1 parent be8454d commit dfdd243

File tree

1 file changed

+15
-9
lines changed
  • custom_components/solaredge_modbus_multi

1 file changed

+15
-9
lines changed

custom_components/solaredge_modbus_multi/sensor.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ async def async_setup_entry(
9292
entities.append(SolarEdgeCosPhi(inverter, config_entry, coordinator))
9393

9494
""" Power Control Block """
95-
if hub.option_detect_extras and inverter.advanced_power_control:
95+
if hub.option_detect_extras:
9696
entities.append(
9797
SolarEdgeCommitControlSettings(inverter, config_entry, coordinator)
9898
)
@@ -1344,12 +1344,6 @@ def extra_state_attributes(self):
13441344
return attrs
13451345

13461346

1347-
class SolarEdgeGlobalPowerControlBlock(SolarEdgeSensorBase):
1348-
@property
1349-
def available(self) -> bool:
1350-
return super().available and self._platform.global_power_control
1351-
1352-
13531347
class StatusVendor(SolarEdgeSensorBase):
13541348
entity_category = EntityCategory.DIAGNOSTIC
13551349

@@ -1390,6 +1384,12 @@ def extra_state_attributes(self):
13901384
return None
13911385

13921386

1387+
class SolarEdgeGlobalPowerControlBlock(SolarEdgeSensorBase):
1388+
@property
1389+
def available(self) -> bool:
1390+
return super().available and self._platform.global_power_control
1391+
1392+
13931393
class SolarEdgeRRCR(SolarEdgeGlobalPowerControlBlock):
13941394
@property
13951395
def unique_id(self) -> str:
@@ -2336,7 +2336,13 @@ def native_value(self):
23362336
return self._platform.decoded_model["B_SOE"]
23372337

23382338

2339-
class SolarEdgeCommitControlSettings(SolarEdgeSensorBase):
2339+
class SolarEdgeAdvancedPowerControlBlock(SolarEdgeSensorBase):
2340+
@property
2341+
def available(self) -> bool:
2342+
return super().available and self._platform.advanced_power_control
2343+
2344+
2345+
class SolarEdgeCommitControlSettings(SolarEdgeAdvancedPowerControlBlock):
23402346
"""Entity to show the results of Commit Power Control Settings button."""
23412347

23422348
entity_category = EntityCategory.DIAGNOSTIC
@@ -2375,7 +2381,7 @@ def extra_state_attributes(self):
23752381
return attrs
23762382

23772383

2378-
class SolarEdgeDefaultControlSettings(SolarEdgeSensorBase):
2384+
class SolarEdgeDefaultControlSettings(SolarEdgeAdvancedPowerControlBlock):
23792385
"""Entity to show the results of Restore Power Control Default Settings button."""
23802386

23812387
entity_category = EntityCategory.DIAGNOSTIC

0 commit comments

Comments
 (0)