Skip to content

Commit e6ae7a8

Browse files
Add available properties to commit and restore sensors
1 parent dfdd243 commit e6ae7a8

File tree

1 file changed

+13
-0
lines changed
  • custom_components/solaredge_modbus_multi

1 file changed

+13
-0
lines changed

custom_components/solaredge_modbus_multi/sensor.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,6 +2356,12 @@ def unique_id(self) -> str:
23562356
def name(self) -> str:
23572357
return "Commit Power Settings"
23582358

2359+
@property
2360+
def available(self) -> bool:
2361+
return (
2362+
super().available and "CommitPwrCtlSettings" in self._platform.decoded_model
2363+
)
2364+
23592365
@property
23602366
def native_value(self):
23612367
return self._platform.decoded_model["CommitPwrCtlSettings"]
@@ -2395,6 +2401,13 @@ def unique_id(self) -> str:
23952401
def name(self) -> str:
23962402
return "Default Power Settings"
23972403

2404+
@property
2405+
def available(self) -> bool:
2406+
return (
2407+
super().available
2408+
and "RestorePwrCtlDefaults" in self._platform.decoded_model
2409+
)
2410+
23982411
@property
23992412
def native_value(self):
24002413
return self._platform.decoded_model["RestorePwrCtlDefaults"]

0 commit comments

Comments
 (0)