craftbeerpi/craftbeerpi4

How can you query the current temperature of a kettle

JamFfm opened this issue · 4 comments

How can you query the current temperature of a kettle (via kettle_ID)?
and:
How can you query the current value of a sensor (via sensor ID)?

There are a few examples in my cbpi4-BM_Steps Plugin:
If you have the sensor as property:
Property.Sensor(label="Sensor", description="Sensor that is used during cooldown")

you can retrieve the value with this line:
sensor_value = self.get_sensor_value(self.props.get("Sensor")).get("value")

You can use also the information from the steps that you query in your LCD Plugin and use that id instead of self.props.get("Sensor").

I did a quick and dirty test for the LCD screen which I can send you later as an example when I have access to my pi if you want.

yes please, that would be nice

@JamFfm This is a quick and dirty version of your plugin which is showing standby if no step is active and individual step information if brewing steps are active. I was just putting this together to run a test brew and to see what's going on as I have no touch screen.

init.zip

The hop alarms can also be used 'globally' as Manuel integrated that with the latest merge of my pull request for the 'native' boilstep.

Feel free to use whatever you need. Looking forward to a running version with Fermenter support. However, this needs to be added frst to cbpi4 :-)

Thank you avollkopf.
Like this it worked:

`class LCDisplay(CBPiExtension):
def init(self, cbpi):
self.cbpi = cbpi
self._task = asyncio.create_task(self.run())

async def run(self):
    sensor_value = self.cbpi.sensor.get_sensor_value(kettle_sensor_id).get('value')
    print(sensor_value)

`