Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BBQ - Meater+ wireless temperature probe #50

Open
jcallaghan opened this issue May 7, 2020 · 16 comments
Open

BBQ - Meater+ wireless temperature probe #50

jcallaghan opened this issue May 7, 2020 · 16 comments

Comments

@jcallaghan
Copy link
Owner

jcallaghan commented May 7, 2020

Meater+ wireless temperature probe

Found this project that has reverse-engineered the BLE communication for the Meater BBQ thermometer which I plan to contribute to or fork and add MQTT to integrate it with Home Assistant. My longer goal would be to create an integration for ESPHome to work with it.

Originally posted by @jcallaghan in #21 (comment)

@jcallaghan
Copy link
Owner Author

jcallaghan commented May 7, 2020

Cloned this project onto an old Raspberry Pi to give it a try.

sudo apt-get install python-pip libglib2.0-dev
sudo pip install bluepy
git clone https://github.com/nathanfaber/meaterble.git
cd /meaterble/

When I run ./scan.sh it is able to see my device. It discovers the probe and the Meater+ block.

pi@raspberrypi:~/meaterble $ ./scan.sh
B8:1F:5E:00:A6:00 MEATER
B8:1F:5E:00:A6:00 MEATER
B8:1F:5E:06:6B:5B MEATER+
B8:1F:5E:06:6B:5B MEATER+

I'm getting an error when trying to run the ./readMeater.py B8:1F:5E:06:6B:5B script an error is throw. This might be down to it being an old image?!?

image

Raised an issue nathanfaber/meaterble#5 in the project to see if anyone has any ideas. Turns out I needed to remove the battery from the Meater+ block to allow me to create a BLE connection with the probe.

@jcallaghan jcallaghan added this to In-progress in IoT BBQ and Smoker May 8, 2020
@jcallaghan
Copy link
Owner Author

jcallaghan commented May 11, 2020

After removing the power to the Meater+ block I was able to connect using the following command.

sudo python ./readMeater.py B8:1F:5E:00:A6:00

image

@jcallaghan
Copy link
Owner Author

jcallaghan commented May 11, 2020

I modified the readMeater.py python script to include the Paho MQTT client and am now able to publish the Meater tip and ambient temperature as well as the battery as MQTT topics. These are now available in Home Assistant.

image

image

The plan is to run this on a Raspberry Pi I am hosting some of my weather station #13 components on. This will have the best range for the BBQ and kitchen. I will need to create a script/service to poll for Meater probes so when it becomes available it automatically connects.

@jcallaghan
Copy link
Owner Author

Shared on Twitter include a video of Home Assistant integration.

@jcallaghan
Copy link
Owner Author

jcallaghan commented May 11, 2020

Integrating MQTT with nathanfaber/meaterble

I publish the following MQTT topics when the Meater probe updates. The {mac_address} represents the MAC address of a individual probe as multiple probes can be connected.

meater/{mac_address}/ambient
meater/{mac_address}/battery
meater/{mac_address}/firmware
meater/{mac_address}/last_updated
meater/{mac_address}/mac
meater/{mac_address}/probe_id
meater/{mac_address}/tip

@esbenr
Copy link

esbenr commented May 11, 2020

This is awesome @jcallaghan. really cool. I had to return my Meater as I wanted at a Meater+. So waiting for that. When it arrives I will definetly try out your code and let you know how it goes.

@jcallaghan
Copy link
Owner Author

Inside the Meater+ block

image

image

image

image

image

image

image

image

@jcallaghan
Copy link
Owner Author

jcallaghan commented May 21, 2020

Meater python connection script

I've created a script that will continuously load the readMeater.py script from the nathanfaber/meaterble project using this example. This allows me to continue to look for my Meater probe based on it's MAC address. If the Meater script errors or has exceptions like disconnects my script will just reload it. Additional to this I have also created a service so it loads on reboot etc.

I am going to read up on bluepy some more to see if I can build exception handling into the functions rather than rely on reopening the script but for now, this will do. My main goal is to refactor the python and get it working as a component on ESPHome.

Errors and exceptions I observed include:

  • IndexError: bytearray index out of range
  • bluepy.btle.BTLEDisconnectError: Device disconnected
  • bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral B8:1F:5E:00:A6:00, addr type: public

Now I can run python meater_connect.py B8:1F:5E:00:A6:00 with my device address or use the service to run this script. The meaterble project includes a scan.sh which provides the address of Meater probes and blocks.

nathanfaber/meaterble

sudo apt-get install git python-pip libglib2.0-dev
sudo pip install bluepy
git clone https://github.com/nathanfaber/meaterble.git
cd /meaterble/

Run ./scan.sh to discover devices.

meater_connect.py

In the meaterble folder create a new file called meater_connect.py. This will be used to launch the readMeater.py script.

#!/usr/bin/python
from subprocess import Popen
import sys

device = filename = sys.argv[1]
while True:
    print("\nStarting Meater connection to " + device + ".....................")
    p = Popen("python ./readMeater.py " + device, shell=True)
    p.wait()

meater_mqtt.service

Create another file called meater_mqtt.service in the same directory. Edit the ExecStart parameter to connect to

[Unit]
Description=Meater Thermometer Monitor
After=network.target

[Service]
Type=simple
Restart=always
RestartSec=1
User=pi
WorkingDirectory=/home/pi/meaterble
ExecStart=/usr/bin/python3 meater_connect.py B8:1F:5E:00:A6:00

#StandardOutput=syslogConsola               # Output to syslog
#StandardError=syslogConsola                # Output to syslog

[Install]
WantedBy=multi-user.target

To install the service use the following commands to copy the service to the system folder, enable the service and start it.

sudo cp meater_mqtt.service /etc/systemd/system
sudo systemctl enable meater_mqtt.service
sudo systemctl start meater_mqtt.service

You can check on the status of the service with systemctl status meater_mqtt.service.

meater.py

I updated the following in the meater.py to broadcast the information over MQTT.

def __str__(self):
       import paho.mqtt.client as mqtt
	   client = mqtt.Client()
       client.connect("10.20.1.10", 1883)
	   client.loop_start()
	   mqtt_topic = "meater/"

	   client.publish(mqtt_topic + self.getID() + "/firmware", self.getFirmware())
       client.publish(mqtt_topic + self.getID() + "/last_updated", self._lastUpdate)
       client.publish(mqtt_topic + self.getID() + "/mac", self.getAddress())
       client.publish(mqtt_topic + self.getID() + "/probe_id", self.getID())
       client.publish(mqtt_topic + self.getID() + "/tip", round(self.getTipC(),2))
       return "%s %s probe: %s tip: %fF/%fC ambient: %fF/%fC battery: %d%% age: %ds" % (self.getAddress(), self.getFirmware(), self.getID(), self.getTipF(),self.getTipC(), self.getAmbientF(), self.getAmbientC(), self.getBattery(),time.time() - self._lastUpdate)

@jcallaghan
Copy link
Owner Author

Update

Contributing to the original project. The updates I've made to nathanfaber/meaterble are working really well. Nathan has added me as a contributor to his project so I will work with him to include the changes I have made and share the MQTT work within his project.

Meater+ block power switch. Having taken the Meater+ block apart I now know where I can place a slide switch to turn the unit off without having to take the battery out each time I want my Home Assistant integration to work.

ESPHome integration. I have found some reference integrations I am hoping I will be able to use to get started with an integration for ESPHome.

@jcallaghan
Copy link
Owner Author

jcallaghan commented May 21, 2020

Target temperature

I created an input_number sensor to maintain the target temperature for my Meater probe. While cooking dinner this evening I gave it a quick test. It is great to see this real-time in the history panel.

image

Next up is an automation to notify me as the cook (this is the Meater term for something you are cooking) is progressing. I'm happy with regular updates but when I'm close to reaching my target temperature I plan to also use TTS through Alexa or Sonos.

@jcallaghan
Copy link
Owner Author

jcallaghan commented May 30, 2020

Update

This week I reached out to the Meater team to provide some positive feedback as I have really enjoyed using their product. This lead to a call with someone on the team. It was great to share what I and others had been trying to achieve and for them to embrace the idea of making an API available for makers like us. I'll share more about this soon.

Meater Block

After the call, I was super excited to receive a little something from the team which resulted in a receiving a Meater Block just 24-hours later. I look forward to sharing a solution to integrate this with Home Assistant very soon.

@jcallaghan
Copy link
Owner Author

Shared this in an existing Meater conversation in the Home Assistant community.

@jcallaghan
Copy link
Owner Author

Meater MQTT

Seems it is possible to connect to the Meater MQTT service.

mosquitto_sub -h cloud.meater.com -p 8883 -u 'my-email-address-' -P 'my-meater-password' -t 'MEATERCloud/Devices/some-id-I-dont-know/MASTER' --verbose -d --capath /etc/ssl/certs/

@jcallaghan jcallaghan added this to Backlog in The Retreat Jul 31, 2020
@arzaman
Copy link

arzaman commented Oct 19, 2021

Hi nice work indeed...would to try to integrate BLE meater probe in my BBQ charcoal blow fan temperature controller
where can I find the modified the readMeater.py python script with MQTT support
In the orginal meaterble.git seems not available
thanks
Davide

@robinsmidsrod
Copy link

Any updates on this, now that Bluetooth is an integrated part of Home Assistant. Are there any plans to get this supported by the bluetooth proxy feature?

@jeroenterheerdt
Copy link

Hey, @jcallaghan any update on making this a esphome integration? I don't want to use a cloud version and only have a meater. Also don't want to use my phone as the middle man. Let me know if I can help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
The Retreat
  
Backlog
Development

No branches or pull requests

5 participants