Skip to content

Commit 0aed9ee

Browse files
Battery fixes using modbus simulator
1 parent 6d7f75b commit 0aed9ee

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

custom_components/solaredge_modbus_multi/hub.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,10 +722,10 @@ def __init__(self, device_id: int, battery_id: int, hub: SolarEdgeModbusMultiHub
722722

723723
self.manufacturer = self.decoded_common['B_Manufacturer']
724724
self.model = self.decoded_common['B_Model']
725-
self.option = None
725+
self.option = ''
726726
self.fw_version = self.decoded_common['B_Version']
727727
self.serial = self.decoded_common['B_SerialNumber']
728-
self.device_address = self.decoded_common['B_Device_address']
728+
self.device_address = self.decoded_common['B_Device_Address']
729729
self.name = f"{hub.hub_id.capitalize()} B{self.battery_id}"
730730

731731
self._device_info = {
@@ -806,3 +806,7 @@ def online(self) -> bool:
806806
@property
807807
def device_info(self) -> Optional[Dict[str, Any]]:
808808
return self._device_info
809+
810+
@property
811+
def single_device_entity(self) -> bool:
812+
return self.hub._single_device_entity

custom_components/solaredge_modbus_multi/sensor.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,12 @@ def extra_state_attributes(self):
265265
attrs["sunspec_device"] = "unknown"
266266

267267
except KeyError:
268-
attrs["sunspec_device"] = "unknown"
268+
attrs["sunspec_device"] = None
269269

270-
attrs["sunspec_did"] = self._platform.decoded_model['C_SunSpec_DID']
270+
try:
271+
attrs["sunspec_did"] = self._platform.decoded_model['C_SunSpec_DID']
272+
except KeyError:
273+
attrs["sunspec_did"] = None
271274

272275
return attrs
273276

0 commit comments

Comments
 (0)