Make consumer aware of the charge controller

This commit is contained in:
Odd Stråbø 2023-12-10 23:50:34 +01:00
parent fe9c6a82ff
commit 71919fc406
2 changed files with 8 additions and 0 deletions

View File

@ -33,6 +33,11 @@ def main():
log("Connected.")
cc = ChargeController(dev)
log(f"Controller model: {cc.model}")
log(f"Controller version: {cc.version}")
log(f"Controller serial: {cc.serial}")
for consumer in consumers:
consumer.controller = cc
# write(dev, construct_request(0, 32))

View File

@ -2,9 +2,12 @@
from abc import ABC, abstractmethod
from typing import Any, Dict
from ..protocol import ChargeController
class BaseConsumer(ABC):
settings: Dict[str, Any]
controller: ChargeController | None = None
@abstractmethod
def __init__(self, settings: Dict[str, Any]) -> None: