Files
brewpi/components/plant/pot_real.py
T
jens ead900b7b1 Build the heater/pot/sensor rig as one unit, picked by plant_name alone
heater_name/sensor_name/plant_name were three independent config keys,
each picked via its own factory - in practice sim and real hardware
are never actually mixed and matched, so this could (nonsensically)
disagree, e.g. a real heater paired with a simulated sensor.

Add PlantFactory (components/plant/plant_factory.py): plant_name alone
now builds the whole rig together. "sim" gets HeaterSim/Pot (the
modeled plant, as before)/TempSensorSim. Anything else gets
HeaterHendi/PotReal/TempSensor_max31865 - PotReal is a new, deliberately
unmodeled Pot for the real, physical kettle (components/plant/pot_real.py):
the real temperature comes straight from the real sensor, not from a
model, so it just accepts and ignores set_plant_params()/
set_ambient_temperature()/initial() and reports no temperature of its
own, satisfying PotTask/SudTask's interface with nothing to actually
simulate.

heater_name/sensor_name are gone from config.json.templ; server/brewpi.py
delegates to HeaterFactory/TempSensorFactory lazily from inside
PlantFactory, same as before, so real hardware's spidev/pyserial deps
still aren't needed just to import the module.
2026-06-23 20:22:51 +02:00

47 lines
1.0 KiB
Python

from components.aplant import APlant
class PotReal(APlant):
"""The real kettle - unlike Pot (components/plant/pot.py), this doesn't
model the plant's thermal behavior at all: the real kettle does its
own physics, and the real temperature comes straight from the real
temperature sensor, not from here (see PlantFactory). Exists purely so
a real rig still satisfies the same informal interface PotTask/
SudTask expect from a Pot - set_plant_params()/set_ambient_temperature()/
initial() are accepted and ignored, and get_temperature() has nothing
to report."""
def __init__(self):
APlant.__init__(self)
self.p_in = 0
def is_configured(self):
return True
def set_plant_params(self, params):
pass
def set_ambient_temperature(self, theta_amb):
pass
def initial(self, temp):
pass
def activate(self, enable):
pass
def is_activated(self):
return True
def process(self):
pass
def set_power(self, power):
self.p_in = power
def get_power(self):
return round(self.p_in, 1)
def get_temperature(self):
return None