controller implemented and tested

This commit is contained in:
Nils Reiners
2025-09-25 21:16:51 +02:00
parent 0bcf8a2d8c
commit b066658eb0
12 changed files with 95 additions and 1536 deletions

25
energysystem.py Normal file
View File

@@ -0,0 +1,25 @@
class EnergySystem():
def __init__(self):
self.components = []
def add_components(self, *args):
for comp in args:
self.components.append(comp)
def get_state_and_store_to_database(self, db):
state = {}
for comp in self.components:
component_state = comp.get_state()
state[comp.device_name] = component_state
db.store_data(comp.device_name, component_state)
return state
def get_component_by_name(self, name):
for comp in self.components:
if comp.device_name == name:
return comp