From 02b79a8096f78a2882779bd4ba2c721ef4d87812 Mon Sep 17 00:00:00 2001 From: Jeroen Laverman Date: Tue, 1 Nov 2022 13:39:22 +0100 Subject: [PATCH] add solar component --- README.md | 21 ++++++++++++--------- example.py | 2 ++ pysolarfocus/__init__.py | 8 +++++++- pysolarfocus/component_factory.py | 4 ++++ pysolarfocus/components/solar.py | 20 ++++++++++++++++++++ 5 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 pysolarfocus/components/solar.py diff --git a/README.md b/README.md index f79c36f..c1c54f5 100644 --- a/README.md +++ b/README.md @@ -6,26 +6,29 @@ This integration has been tested with Solarfocus ecomanager-touch version `21.040`. +### Systems + +* Heat pump vampair with eco_manager-touch_ +* Biomass boiler therminator II + ### Solarfocus Components | Components | Supported | |---|---| -| Heating Circuits (_Heizkreis_)| :white_check_mark: | -| Buffers (_Puffer_) | :white_check_mark: | -| Solar (_Solar_)| :x:| -| Boilers (_Boiler_) | :white_check_mark: | +| Heating Circuits (_Heizkreis_) 1-8 | :white_check_mark: | +| Buffers (_Puffer_) 1-4 | :white_check_mark: | +| Solar (_Solar_)| :white_check_mark:| +| Boilers (_Boiler_) 1-4 | :white_check_mark: | | Heatpump (_Wärmepumpe_) | :white_check_mark: | | Biomassboiler (_Kessel_) | :white_check_mark: | -_Note: Different components or heating systems could be supported in the future_ - ## Usage ```python from pysolarfocus import SolarfocusAPI,Systems # Create the Solarfocus API client -solarfocus = SolarfocusAPI(ip=[Your-IP],system=Systems.Vampair) +solarfocus = SolarfocusAPI(ip="[Your-IP]",system=Systems.Vampair) # Connect to the heating system solarfocus.connect() # Fetch the values @@ -37,12 +40,12 @@ print(solarfocus.heating_circuit[0]) ``` ### Handling multiple components e.g. heating circuits -_Solarfocus systems allow the use of multiple heating circuits, buffers and boilers. The api can be configured to interact with multiple components._ +Solarfocus systems allow the use of multiple heating circuits, buffers and boilers. The api can be configured to interact with multiple components. ```python # Create the Solarfocus API client with 2 Heating Circuits -solarfocus = SolarfocusAPI(ip=[Your-IP],heating_circuit_count=2,system=Systems.Vampair) +solarfocus = SolarfocusAPI(ip="[Your-IP]",heating_circuit_count=2,system=Systems.Vampair) # Connect to the heating system solarfocus.connect() diff --git a/example.py b/example.py index 57913f3..b203c8d 100644 --- a/example.py +++ b/example.py @@ -17,3 +17,5 @@ print(solarfocus.heatpump) print("\n") print(solarfocus.photovoltaic) +print("\n") +print(solarfocus.solar) \ No newline at end of file diff --git a/pysolarfocus/__init__.py b/pysolarfocus/__init__.py index bb1fe4f..3ae6500 100644 --- a/pysolarfocus/__init__.py +++ b/pysolarfocus/__init__.py @@ -48,6 +48,7 @@ def __init__(self, self.heatpump = self.__factory.heatpump(system) self.photovoltaic = self.__factory.photovoltaic(system) self.pelletsboiler = self.__factory.pelletsboiler(system) + self.solar = self.__factory.solar(system) self._slave_id = slave_id self._system = system @@ -69,6 +70,7 @@ def update(self): and self.update_heatpump() and self.update_photovoltaic() and self.update_pelletsboiler() + and self.update_solar() ): return True return False @@ -104,4 +106,8 @@ def update_photovoltaic(self) -> bool: def update_pelletsboiler(self) -> bool: """Read values from Pellets boiler""" - return self.pelletsboiler.update() \ No newline at end of file + return self.pelletsboiler.update() + + def update_solar(self) -> bool: + """Read values from Solar""" + return self.solar.update() \ No newline at end of file diff --git a/pysolarfocus/component_factory.py b/pysolarfocus/component_factory.py index e711416..61d2399 100644 --- a/pysolarfocus/component_factory.py +++ b/pysolarfocus/component_factory.py @@ -4,6 +4,7 @@ from .components.buffer import * from .components.pellets_boiler import * from .components.photovoltaic import * +from .components.solar import * from .modbus_wrapper import ModbusConnector from . import Systems @@ -55,3 +56,6 @@ def photovoltaic(self, system:Systems)->Photovoltaic: def pelletsboiler(self, system:Systems)->PelletsBoiler: return PelletsBoiler()._initialize(self.__modbus_connector) + def solar(self, system:Systems)->Solar: + return Solar()._initialize(self.__modbus_connector) + diff --git a/pysolarfocus/components/solar.py b/pysolarfocus/components/solar.py new file mode 100644 index 0000000..802f684 --- /dev/null +++ b/pysolarfocus/components/solar.py @@ -0,0 +1,20 @@ +from .base.component import Component +from .base.enums import DataTypes +from .base.data_value import DataValue + +class Solar(Component): + def __init__(self) -> None: + super().__init__(input_address=2100) + self.collector_temperature_1 = DataValue(address=0,multiplier=0.1) + self.collector_temperature_2 = DataValue(address=1,multiplier=0.1) + self.collector_supply_temperature = DataValue(address=2,multiplier=0.1) + self.collector_return_temperature = DataValue(address=3,multiplier=0.1) + self.flow_heat_meter = DataValue(address=4,multiplier=0.1) + self.curent_power = DataValue(address=5,multiplier=0.1) + self.curent_yield_heat_meter = DataValue(address=6,count=2) + self.today_yield = DataValue(address=8,count=2) + self.buffer_sensor_1 = DataValue(address=10,multiplier=0.1) + self.buffer_sensor_2 = DataValue(address=11,multiplier=0.1) + self.buffer_sensor_3 = DataValue(address=12,multiplier=0.1) + self.state = DataValue(address=13,type=DataTypes.UINT) + \ No newline at end of file