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.") log("Connected.")
cc = ChargeController(dev) 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)) # write(dev, construct_request(0, 32))

View file

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