def __init__(self, device_config: Union[Dict, SmaSunnyIsland]) -> None: self.components = {} # type: Dict[str, bat.SunnyIslandBat] try: self.device_config = dataclass_from_dict(SmaSunnyIsland, device_config) self.client = modbus.ModbusTcpClient_(self.device_config.configuration.ip_address, 502) except Exception: log.exception("Fehler im Modul "+self.device_config.name)
def __init__(self, device_id: int, component_config: Union[Dict, SolaredgeCounterSetup], tcp_client: modbus.ModbusTcpClient_) -> None: self.component_config = dataclass_from_dict(SolaredgeCounterSetup, component_config) self.__tcp_client = tcp_client self.__store = get_counter_value_store(self.component_config.id) self.component_info = ComponentInfo.from_component_config( self.component_config)