Esempio n. 1
0
 def __init__(self, device_config: Union[dict, EVNotifyConfiguration]):
     self.config = device_config \
         if isinstance(device_config, EVNotifyConfiguration) \
         else EVNotifyConfiguration.from_dict(device_config)
     self.value_store = store.get_car_value_store(self.config.id)
     self.component_info = ComponentInfo(self.config.id, "EVNotify",
                                         "vehicle")
Esempio n. 2
0
 def __init__(self, device_id: int, component_config: Union[Dict, LgBatSetup]) -> None:
     self.__device_id = device_id
     self.component_config = dataclass_from_dict(LgBatSetup, component_config)
     self.__sim_count = simcount.SimCountFactory().get_sim_counter()()
     self.__simulation = {}
     self.__store = get_bat_value_store(self.component_config.id)
     self.component_info = ComponentInfo.from_component_config(self.component_config)
Esempio n. 3
0
 def __init__(self, device_id: int, component_config: dict,
              tcp_client: modbus.ModbusClient) -> None:
     self.component_config = component_config
     self.__tcp_client = tcp_client
     self.__store = get_counter_value_store(component_config["id"])
     self.component_info = ComponentInfo.from_component_config(
         component_config)
Esempio n. 4
0
 def __init__(self, device_id: int, device_address: str,
              component_config: dict) -> None:
     self.__device_address = device_address
     self.component_config = component_config
     self.__store = get_inverter_value_store(component_config["id"])
     self.component_info = ComponentInfo.from_component_config(
         component_config)
Esempio n. 5
0
 def __init__(self, component_config: Union[Dict,
                                            TeslaInverterSetup]) -> None:
     self.component_config = dataclass_from_dict(TeslaInverterSetup,
                                                 component_config)
     self.__store = get_inverter_value_store(self.component_config.id)
     self.component_info = ComponentInfo.from_component_config(
         self.component_config)
Esempio n. 6
0
 def __init__(self, device_id: int, component_config: dict) -> None:
     self.__device_id = device_id
     self.component_config = component_config
     self.__sim_count = simcount.SimCountFactory().get_sim_counter()()
     self.simulation = {}
     self.__store = get_counter_value_store(component_config["id"])
     self.component_info = ComponentInfo.from_component_config(component_config)
Esempio n. 7
0
 def __init__(self, device_id: int, component_config: dict, tcp_client: modbus.ModbusClient) -> None:
     self.component_config = component_config
     factory = kit_counter_inverter_version_factory(
         component_config["configuration"]["version"])
     self.__client = factory(component_config["configuration"]["id"], tcp_client)
     self.__tcp_client = tcp_client
     self.__store = get_inverter_value_store(component_config["id"])
     self.component_info = ComponentInfo.from_component_config(component_config)
Esempio n. 8
0
 def __init__(self, component_config: Union[Dict, StuderInverterSetup],
              tcp_client: modbus.ModbusTcpClient_) -> None:
     self.component_config = dataclass_from_dict(StuderInverterSetup,
                                                 component_config)
     self.__tcp_client = tcp_client
     self.__store = get_inverter_value_store(self.component_config.id)
     self.component_info = ComponentInfo.from_component_config(
         self.component_config)
Esempio n. 9
0
 def __init__(self, component_config: Union[Dict, SmaSunnyIslandBatSetup],
              tcp_client: modbus.ModbusTcpClient_) -> None:
     self.component_config = dataclass_from_dict(SmaSunnyIslandBatSetup,
                                                 component_config)
     self.__tcp_client = tcp_client
     self.__store = get_bat_value_store(self.component_config.id)
     self.component_info = ComponentInfo.from_component_config(
         self.component_config)
Esempio n. 10
0
 def __init__(self,
              value_store_factory: Callable[[int], ValueStore[T]],
              parser: Callable[[dict], T],
              component_config: Union[SmaHomeManagerCounterSetup, SmaHomeManagerInverterSetup]):
     self.__value_store = value_store_factory(component_config.id)
     self.__parser = parser
     self.__serial_matcher = _create_serial_matcher(component_config.configuration.serials)
     self.component_info = ComponentInfo.from_component_config(component_config)
Esempio n. 11
0
def update(address: str, second_battery: int):
    # `second_battery` is 0 or 1
    log.debug("Beginning update")
    bat_info = ComponentInfo(None, "Solaredge", "bat")
    with SingleComponentUpdateContext(bat_info):
        with ModbusClient(address) as client:
            update_solaredge_battery(client, range(1, 2 + second_battery))
    log.debug("Update completed successfully")
Esempio n. 12
0
 def __init__(self,
              device_id: int,
              component_config: Union[Dict, KostalPikoInverterSetup],
              ip_address: str) -> None:
     self.component_config = dataclass_from_dict(KostalPikoInverterSetup, component_config)
     self.ip_address = ip_address
     self.__store = get_inverter_value_store(self.component_config.id)
     self.component_info = ComponentInfo.from_component_config(self.component_config)
Esempio n. 13
0
 def __init__(self, value_store_factory: Callable[[int], ValueStore[T]],
              parser: Callable[[dict], T], component_config: dict):
     self.__value_store = value_store_factory(component_config["id"])
     self.__parser = parser
     self.__serial_matcher = _create_serial_matcher(
         component_config["configuration"]["serials"])
     self.component_info = ComponentInfo.from_component_config(
         component_config)
Esempio n. 14
0
 def __init__(self, component_config: dict, ip_address: str,
              password: str) -> None:
     self.component_config = component_config
     self.ip_address = ip_address
     self.password = password
     self.__store = get_inverter_value_store(component_config["id"])
     self.component_info = ComponentInfo.from_component_config(
         component_config)
Esempio n. 15
0
def update(address1: str, address2: str, read_external: int, pvmodul: str):
    # read_external is 0 or 1
    log.debug("Beginning update")
    addresses = [address for address in [address1, address2] if address != "none"]
    pv_other = pvmodul != "none"
    bat_info = ComponentInfo(None, "E3DC", "bat")
    with SingleComponentUpdateContext(bat_info):
        update_e3dc_battery(addresses, read_external, pv_other)
    log.debug("Update completed successfully")
Esempio n. 16
0
 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)
Esempio n. 17
0
 def __init__(
         self, device_address: str,
         component_config: Union[Dict, SmaWebboxInverterSetup]) -> None:
     self.__device_address = device_address
     self.component_config = dataclass_from_dict(SmaWebboxInverterSetup,
                                                 component_config)
     self.__store = get_inverter_value_store(self.component_config.id)
     self.component_info = ComponentInfo.from_component_config(
         self.component_config)
Esempio n. 18
0
 def __init__(self,
              modbus_id: int,
              component_config: Union[Dict, GoodWeBatSetup],
              tcp_client: modbus.ModbusTcpClient_) -> None:
     self.__modbus_id = modbus_id
     self.component_config = dataclass_from_dict(GoodWeBatSetup, component_config)
     self.__tcp_client = tcp_client
     self.__store = get_bat_value_store(self.component_config.id)
     self.component_info = ComponentInfo.from_component_config(self.component_config)
Esempio n. 19
0
 def __init__(self, component_config: dict, domain: str) -> None:
     self.__get_power = create_request_function(
         domain, component_config["configuration"]["power_path"])
     self.__get_counter = create_request_function(
         domain, component_config["configuration"]["counter_path"])
     self.component_config = component_config
     self.__store = get_inverter_value_store(component_config["id"])
     self.component_info = ComponentInfo.from_component_config(
         component_config)
Esempio n. 20
0
 def __init__(self, device_id: int, component_config: dict) -> None:
     self.__device_id = device_id
     self.component_config = component_config
     ip_address = component_config["configuration"]["ip_address"]
     self.__tcp_client = modbus.ModbusClient(ip_address, 502)
     self.__sim_count = simcount.SimCountFactory().get_sim_counter()()
     self.__simulation = {}
     self.__store = get_bat_value_store(component_config["id"])
     self.component_info = ComponentInfo.from_component_config(component_config)
Esempio n. 21
0
    def __init__(self, component_config: Union[Dict, SunwaysInverterSetup],
                 ip_address: str, password: str) -> None:

        self.component_config = dataclass_from_dict(SunwaysInverterSetup,
                                                    component_config)
        self.ip_address = ip_address
        self.password = password
        self.__store = get_inverter_value_store(self.component_config.id)
        self.component_info = ComponentInfo.from_component_config(
            self.component_config)
Esempio n. 22
0
File: bat.py Progetto: okaegi/openWB
 def __init__(self, device_id: int, component_config: dict,
              tcp_client: modbus.ModbusClient, device_config: Dict) -> None:
     self.__device_id = device_id
     self.component_config = component_config
     self.__tcp_client = tcp_client
     self.__sim_count = simcount.SimCountFactory().get_sim_counter()()
     self.__simulation = {}
     self.__store = get_bat_value_store(component_config["id"])
     self.component_info = ComponentInfo.from_component_config(
         component_config)
Esempio n. 23
0
 def __init__(self,
              device_id: int,
              component_config: Union[Dict, SungrowCounterSetup],
              tcp_client: modbus.ModbusTcpClient_) -> None:
     self.__device_id = device_id
     self.component_config = dataclass_from_dict(SungrowCounterSetup, component_config)
     self.__tcp_client = tcp_client
     self.__sim_count = simcount.SimCountFactory().get_sim_counter()()
     self.simulation = {}
     self.__store = get_counter_value_store(self.component_config.id)
     self.component_info = ComponentInfo.from_component_config(self.component_config)
Esempio n. 24
0
 def __init__(self, device_id: int,
              component_config: Union[Dict, KostalPikoCounterSetup],
              ip_address: str) -> None:
     self.__device_id = device_id
     self.component_config = dataclass_from_dict(KostalPikoCounterSetup,
                                                 component_config)
     self.ip_address = ip_address
     self.__sim_count = simcount.SimCountFactory().get_sim_counter()()
     self.simulation = {}
     self.__store = get_counter_value_store(self.component_config.id)
     self.component_info = ComponentInfo.from_component_config(
         self.component_config)
Esempio n. 25
0
 def __init__(self, device_id: int,
              component_config: Union[Dict, FroniusInverterSetup],
              device_config: FroniusConfiguration) -> None:
     self.__device_id = device_id
     self.component_config = dataclass_from_dict(FroniusInverterSetup,
                                                 component_config)
     self.device_config = device_config
     self.__sim_count = simcount.SimCountFactory().get_sim_counter()()
     self.simulation = {}
     self.__store = get_inverter_value_store(self.component_config.id)
     self.component_info = ComponentInfo.from_component_config(
         self.component_config)
Esempio n. 26
0
 def __init__(
         self, device_id: int, device_address: str, device_variant: int,
         component_config: Union[Dict, SonnenbatterieBatSetup]) -> None:
     self.__device_id = device_id
     self.__device_address = device_address
     self.__device_variant = device_variant
     self.component_config = dataclass_from_dict(SonnenbatterieBatSetup,
                                                 component_config)
     self.__sim_count = simcount.SimCountFactory().get_sim_counter()()
     self.simulation = {}
     self.__store = get_bat_value_store(self.component_config.id)
     self.component_info = ComponentInfo.from_component_config(
         self.component_config)
Esempio n. 27
0
def update(bydhvip: str, bydhvuser: str, bydhvpass: str):
    '''BYD Speicher bieten zwei HTML-Seiten, auf denen Informationen abgegriffen werden können:
    /asp/Home.asp und /asp/RunData.asp. Aktuell (2022-03) ist die Leistungsangabe (Power) auf der
    RunData.asp auf ganze kW gerundet und somit für openWB nicht brauchbar.
    '''
    log.debug("Beginning update")
    bat_info = ComponentInfo(None, "BYD", "bat")
    with SingleComponentUpdateContext(bat_info):
        # response = req.get_http_session().get('http://' + bydhvip + '/asp/RunData.asp', auth=(bydhvuser, bydhvpass))
        response = req.get_http_session().get('http://' + bydhvip +
                                              '/asp/Home.asp',
                                              auth=(bydhvuser, bydhvpass))
        get_bat_value_store(1).set(BydParser.parse(response.text))
    log.debug("Update completed successfully")
Esempio n. 28
0
 def __init__(self, device_id: int,
              component_config: Union[Dict,
                                      HttpInverterSetup], url: str) -> None:
     self.__device_id = device_id
     self.component_config = dataclass_from_dict(HttpInverterSetup,
                                                 component_config)
     self.__sim_count = simcount.SimCountFactory().get_sim_counter()()
     self.simulation = {}
     self.__store = get_inverter_value_store(self.component_config.id)
     self.component_info = ComponentInfo.from_component_config(
         self.component_config)
     self.__get_power = create_request_function(
         url, self.component_config.configuration.power_path)
     self.__get_exported = create_request_function(
         url, self.component_config.configuration.exported_path)
Esempio n. 29
0
 def __init__(self, device_id: int,
              component_config: Union[Dict, BatKitFlexSetup],
              tcp_client: modbus.ModbusTcpClient_) -> None:
     self.__device_id = device_id
     self.component_config = dataclass_from_dict(BatKitFlexSetup,
                                                 component_config)
     factory = kit_bat_version_factory(
         self.component_config.configuration.version)
     self.__client = factory(self.component_config.configuration.id,
                             tcp_client)
     self.__tcp_client = tcp_client
     self.__sim_count = simcount.SimCountFactory().get_sim_counter()()
     self.simulation = {}
     self.__store = get_bat_value_store(self.component_config.id)
     self.component_info = ComponentInfo.from_component_config(
         self.component_config)
Esempio n. 30
0
    def __init__(self, component_config: dict, domain: str) -> None:
        self.__get_power = create_request_function(
            domain, component_config["configuration"]["power_path"])
        self.__get_imported = create_request_function(
            domain, component_config["configuration"]["imported_path"])
        self.__get_exported = create_request_function(
            domain, component_config["configuration"]["exported_path"])
        self.__get_powers = [
            create_request_function(
                domain, component_config["configuration"]["power_l" + str(i) +
                                                          "_path"])
            for i in range(1, 4)
        ]

        self.component_config = component_config
        self.__store = get_counter_value_store(component_config["id"])
        self.component_info = ComponentInfo.from_component_config(
            component_config)