8none1 / pybq

Hook up your Bluetooth LE iBBQ thermometer to MQTT with Python
GNU General Public License v3.0
9 stars 4 forks source link

pybq

Hook up your Bluetooth LE iBBQ thermometer to MQTT with Python.

Features

Prerequisites

It's probably best and easiest if you install these in a venv.

Things you must change

Things you might like to change

What happens when I turn my thermometer off?

The script will end. If you want to automatically start logging data again when you turn it back on, check out the included systemd service file. It's much easier to just restart the script than deal with reconnecting and reinitalising. The service file will restart bbq.py every 30 seconds. That's probably fine. You might need to change the user part of the service file.

But I don't want to run it as root!

If you're seeing error messages about bluepy.btle.BTLEManagementError: Failed to execute management command 'le on' (code: 20, error: Permission Denied) then you need to run the script as root. If you don't want to do that read this: https://github.com/IanHarvey/bluepy/issues/313 You need to do: sudo setcap 'cap_net_raw,cap_net_admin+eip' bluepy-helper where bluepy-helper is the file which is built when you install bluepy from Git.

What sort of overhead does this have on a Pi Zero W?

Not much. According to top it uses about 1% CPU (usually less) and about 3% RAM. A similar Node application would use more like 10% RAM - still not much, but pybq is less. Or is it fewer?

What am I supposed to do with MQTT temperature data?

You should take a look at Telegraf. It makes it really easy to take an MQTT topic and send it to InfluxDB Cloud. Then you get those sweet charts you're looking for. Here's a Telegraf config snippet:

[[inputs.mqtt_consumer]]
servers = ["tcp://192.168.42.100:1883"]
topics = [
  "bbq/battery",
  "bbq/+/#"
]
data_format = "value"
data_type = "integer"

How do I install this systemd unit file?

Have a look at this page: https://www.linode.com/docs/quick-answers/linux/start-service-at-boot/

For the future?

I've got a couple of ideas for the future, but any pull requests are welcome.