Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple heating circuits, boilers, etc #13

Closed
7 tasks
LavermanJJ opened this issue Oct 19, 2022 · 2 comments · Fixed by #14
Closed
7 tasks

Support multiple heating circuits, boilers, etc #13

LavermanJJ opened this issue Oct 19, 2022 · 2 comments · Fixed by #14

Comments

@LavermanJJ
Copy link
Owner

According to Solarfocus spec, some components can be present more than once. Currently, this library only supports one of each.

  • 1-8 heating circuits
  • 1-4 buffers
  • 1-4 boilers

Proposal on how to achieve this:

  • The __init__ needs to be extended, so that the desired count for each component can be set, and passed to the factory methods.
  • Let the def update_heating(self) -> bool: methods iterate each element, and update it
  • Find a better way to handle the setter methods (e.g. def hc1_set_target_supply_temperature(self, temperature) -> bool:
  • Each attribute (e.g. self.heating_circuit) becomes a list
  • The ComponentFactory needs to create components in accordance with the passed count and returns them as list
  • Each component needs to be extended with the addresses
class HeatingCircuit_2(HeatingCircuit):
    def __init__(self, input_address=1150, holding_address=32650) -> None:
        super().__init__(input_address, holding_address)
  • The list of properties needs to be extended accordingly ... or a better mechanism needs to be found (maybe @data_class) to avoid such a long list of properties?
    ... and more
@LavermanJJ
Copy link
Owner Author

@LLukas22 WDYT ... is this approach feasible? Do you have a hint regarding the long list of properties, how to do this in a more efficient way? Thanks for your input/feedback 👍

@LLukas22
Copy link
Contributor

LLukas22 commented Oct 19, 2022

@LavermanJJ
This extension was the reason i wanted to transition to a object oriented model.

In theory we don't need to create new subclasses, we only need to create n instances of already defined classes and pass in the offset input and holding addresses.

The factory would iterate a predefined range of addresses and create the component instances and return them as a list.
To update these components we just need to iterate the list and update them seperatly.

Implementing a better method to set values is a bit tricky ...
I would prefer an implementation directly in the DataValue class. This would make sense because we have access to the absolute address and the value in this class. We could create a commit() method that writes the current value of the DataValue to the modbus register. For this to work we need to create a modbus wrapper class that is passed to every DataValue instance. This would also give the api complete control over the modbus connection.

Regarding the list of properties you mentioned i don't know what you mean with extending it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants