From 9391fd8155fb33979a0b6190ff75591840197bcd Mon Sep 17 00:00:00 2001 From: WillCodeForCats <48533968+WillCodeForCats@users.noreply.github.com> Date: Thu, 2 May 2024 04:24:43 -0700 Subject: [PATCH] MMPPT id and idstr as properties --- custom_components/solaredge_modbus_multi/hub.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/custom_components/solaredge_modbus_multi/hub.py b/custom_components/solaredge_modbus_multi/hub.py index 09203511..d5dab79b 100644 --- a/custom_components/solaredge_modbus_multi/hub.py +++ b/custom_components/solaredge_modbus_multi/hub.py @@ -1413,8 +1413,6 @@ def __init__( self.hub = hub self.unit = unit self.mmppt_key = f"mmppt_{self.unit}" - self.mmppt_id = self.inverter.decoded_model[self.mmppt_key]["ID"] - self.mmppt_idstr = self.inverter.decoded_model[self.mmppt_key]["IDStr"] @property def online(self) -> bool: @@ -1433,6 +1431,14 @@ def device_info(self) -> DeviceInfo: via_device=(DOMAIN, self.inverter.uid_base), ) + @property + def mmppt_id(self) -> str: + return self.inverter.decoded_model[self.mmppt_key]["ID"] + + @property + def mmppt_idstr(self) -> str: + return self.inverter.decoded_model[self.mmppt_key]["IDStr"] + class SolarEdgeMeter: """Defines a SolarEdge meter."""