• Please visit and share your knowledge at our sister communities:
  • If you have not, please join our official Homebrewing Facebook Group!

    Homebrewing Facebook Group

Need python script to read API from rapt.io or bluetooth diretctly from Rapt Pill

Homebrew Talk

Help Support Homebrew Talk:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

Zippy123

Supporting Member
HBT Supporter
Joined
Nov 29, 2023
Messages
92
Reaction score
88
Location
Appleton, Wisconsin
I am looking for a python scrip that will allow me to get data directly, or nearly directly, from the @KegLand Rapt Pill. My preference would be to use API GET to pull data from rapt.io but as a second option I would be okay using the bluetooth capability of the pill to get data even more directly. I have tried and tried and tried but I cannot get either of those to work. I have a flask server set up on a pi and can get API data from other sources, but not rapt.io. And don't get me started on getting bluetooth data from the pi - I nearly lost my mind. If you have something that works and are willing to share, I am also willing to share some code. Read on if you haven't dozed off yet.

Here's the fundamental reason for the ask: I am easily pulling brew session data from brewersfriend.com with an API GET to a python program in one of my Raspberry Pi's. But as you may know that data is once every 15 minutes at best, and sometimes there are issues that cause one or more 15-minute cycles to be missed. So I am getting data from the pill yes, but sometimes it's stale and sometimes very stale data. If I can get reliable 5 or 10 minute data dumps that would be great for my implementation.

This is why I'm asking. I have built-out a reasonably robust fermentation chamber control system. At the heart is a Raspberry Pi, a relay HAT, a duplex outlet, a cut-off length of extension cord, and a python app put together in a few weeks of spare time. I picked up a ***free*** 5 CF freezer from a guy Marketplace and it is the perfect chamber. For heat I am using a seedling heating pad that was lying around unused (until my wife goes to plant seedlings in March and then I have an issue). I am controlling the temp of a "test carboy" rather well in this setup in spite of the stale data from brewersfriend.com. I would be more confident in the robustness of this control system if I had more direct access to the pill data.

My automation app has a few features that I am excited about and I have a few ideas for other automations. The one I deployed and tested last week is a "fast crash" automation where I compare the ambient temp of the freezer to the measured temp of the beer from the pill. When Fast Crash Auto is started, the beer would be at d-rest temp, 68-76 depending on the beer style. I bring down the ambient temp of the freezer to pretty dang cold (below freezing) and as the beer cools down, I raise the "low ambient" threshold until the beer is at crash temp of about 34F. I can get 5.5 gallons from 74 to 34 in about 12 hours, without freezing the beer. Future automation includes a lager step-up function and there are more in the hopper because I can't seem to turn off my brain.

If you have some code that would work for me and you'd like a copy of what I have, I am willing to share. Thanks in advance.

[EDIT] I reviewed my data and "Fast Crash Automation" was more like 24 hours from 70 to 35ish. Without lifting a finger. Just had to click a dropdown.

1739978866914.png
 
Last edited:
I am looking for a python scrip that will allow me to get data directly, or nearly directly, from the @KegLand Rapt Pill. My preference would be to use API GET to pull data from rapt.io but as a second option I would be okay using the bluetooth capability of the pill to get data even more directly. I have tried and tried and tried but I cannot get either of those to work. I have a flask server set up on a pi and can get API data from other sources, but not rapt.io. And don't get me started on getting bluetooth data from the pi - I nearly lost my mind. If you have something that works and are willing to share, I am also willing to share some code. Read on if you haven't dozed off yet.

Here's the fundamental reason for the ask: I am easily pulling brew session data from brewersfriend.com with an API GET to a python program in one of my Raspberry Pi's. But as you may know that data is once every 15 minutes at best, and sometimes there are issues that cause one or more 15-minute cycles to be missed. So I am getting data from the pill yes, but sometimes it's stale and sometimes very stale data. If I can get reliable 5 or 10 minute data dumps that would be great for my implementation.

This is why I'm asking. I have built-out a reasonably robust fermentation chamber control system. At the heart is a Raspberry Pi, a relay HAT, a duplex outlet, a cut-off length of extension cord, and a python app put together in a few weeks of spare time. I picked up a ***free*** 5 CF freezer from a guy Marketplace and it is the perfect chamber. For heat I am using a seedling heating pad that was lying around unused (until my wife goes to plant seedlings in March and then I have an issue). I am controlling the temp of a "test carboy" rather well in this setup in spite of the stale data from brewersfriend.com. I would be more confident in the robustness of this control system if I had more direct access to the pill data.

My automation app has a few features that I am excited about and I have a few ideas for other automations. The one I deployed and tested last week is a "fast crash" automation where I compare the ambient temp of the freezer to the measured temp of the beer from the pill. When Fast Crash Auto is started, the beer would be at d-rest temp, 68-76 depending on the beer style. I bring down the ambient temp of the freezer to pretty dang cold (below freezing) and as the beer cools down, I raise the "low ambient" threshold until the beer is at crash temp of about 34F. I can get 5.5 gallons from 74 to 34 in about 12 hours, without freezing the beer. Future automation includes a lager step-up function and there are more in the hopper because I can't seem to turn off my brain.

If you have some code that would work for me and you'd like a copy of what I have, I am willing to share. Thanks in advance.

[EDIT] I reviewed my data and "Fast Crash Automation" was more like 24 hours from 70 to 35ish. Without lifting a finger. Just had to click a dropdown.

View attachment 869309
Can’t help directly but i did see this earlier discussion that might help…

https://gitlab.com/rapt.io/public/-/wikis/Pill-Hydrometer-Bluetooth-Transmissions
 
I am making use of the Rapt webhook if that might help you? I have set my pill to send data every 30 minutes which will trigger the URL I set in the webhook configuration. Then I save this data in a database.

I tried to get BLE working for a while but wasn't successful either. I found this documentation about it: https://gitlab.com/rapt.io/public/-/wikis/Pill Hydrometer Bluetooth Transmissions

As for the webhook I use the following Payload

JavaScript:
{
   "device_id": "@device_id",
  "device_type": "@device_type",
  "device_name": "@device_name",
  "temperature": "@temperature",
  "target_temperature": "@target_temperature",
  "temp_unit": "C",
  "gravity": "@gravity",
  "gravity_unit": "G",
  "battery": "@battery",
  "rssi": "@rssi",
  "created_date": "@created_date"
}

Just need to deploy your script somewhere to read the data from the incoming webhook.
 
I am looking for a python scrip that will allow me to get data directly, or nearly directly, from the @KegLand Rapt Pill. My preference would be to use API GET to pull data from rapt.io but as a second option I would be okay using the bluetooth capability of the pill to get data even more directly. I have tried and tried and tried but I cannot get either of those to work. I have a flask server set up on a pi and can get API data from other sources, but not rapt.io. And don't get me started on getting bluetooth data from the pi - I nearly lost my mind. If you have something that works and are willing to share, I am also willing to share some code. Read on if you haven't dozed off yet.

Here's the fundamental reason for the ask: I am easily pulling brew session data from brewersfriend.com with an API GET to a python program in one of my Raspberry Pi's. But as you may know that data is once every 15 minutes at best, and sometimes there are issues that cause one or more 15-minute cycles to be missed. So I am getting data from the pill yes, but sometimes it's stale and sometimes very stale data. If I can get reliable 5 or 10 minute data dumps that would be great for my implementation.

This is why I'm asking. I have built-out a reasonably robust fermentation chamber control system. At the heart is a Raspberry Pi, a relay HAT, a duplex outlet, a cut-off length of extension cord, and a python app put together in a few weeks of spare time. I picked up a ***free*** 5 CF freezer from a guy Marketplace and it is the perfect chamber. For heat I am using a seedling heating pad that was lying around unused (until my wife goes to plant seedlings in March and then I have an issue). I am controlling the temp of a "test carboy" rather well in this setup in spite of the stale data from brewersfriend.com. I would be more confident in the robustness of this control system if I had more direct access to the pill data.

My automation app has a few features that I am excited about and I have a few ideas for other automations. The one I deployed and tested last week is a "fast crash" automation where I compare the ambient temp of the freezer to the measured temp of the beer from the pill. When Fast Crash Auto is started, the beer would be at d-rest temp, 68-76 depending on the beer style. I bring down the ambient temp of the freezer to pretty dang cold (below freezing) and as the beer cools down, I raise the "low ambient" threshold until the beer is at crash temp of about 34F. I can get 5.5 gallons from 74 to 34 in about 12 hours, without freezing the beer. Future automation includes a lager step-up function and there are more in the hopper because I can't seem to turn off my brain.

If you have some code that would work for me and you'd like a copy of what I have, I am willing to share. Thanks in advance.

[EDIT] I reviewed my data and "Fast Crash Automation" was more like 24 hours from 70 to 35ish. Without lifting a finger. Just had to click a dropdown.

View attachment 869309
Did you already get the answer ?
 
Did you already get the answer ?
Sorry for the delayed response. Bluetooth is a non-starter. Kegland told me that Bluetooth only works with a bonded kegland device. Pitty. Unfortunately kegland was silent on my ask for help with pulling api data directly from them. I wonder if they read what I was up to and don’t like the thought of “competition” although I have no plans to do so. I have another resource on pulling data from their site but I have not had the chance to work on it.

Is my project of interest to you?
 

Latest posts

Back
Top