Open jcallaghan opened 4 years ago
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?!?
Raised an issue https://github.com/nathanfaber/meaterble/issues/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.
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
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.
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.
Shared on Twitter include a video of Home Assistant integration.
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
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.
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:
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.
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.
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()
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
.
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)
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.
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.
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.
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.
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.
Shared this in an existing Meater conversation in the Home Assistant community.
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/
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
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?
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!
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 https://github.com/jcallaghan/home-assistant-config/issues/21#issuecomment-625509945