Brew Bubbles: Web-Enabled Airlock

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

ChrisThomas

Well-Known Member
Joined
Aug 11, 2019
Messages
219
Reaction score
49
Location
Bristol, UK
@LBussy I'm tinkering around with HomeAssistant and was thinking if I could log/use BrewBubbles. So where does the general HHTP POST from BrewBubbles come from? Is there an endpoint after the IP address, i.e. "http://IP_ADDRESS/ENDPOINT"? I've tried a few guesses but not yet been able to get HomeAssistant to actually hear anything, but that could also be me fumbling in the dark (again)!
 
Last edited:
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
4,045
Reaction score
1,767
Location
Rural Kansas
Hell if I know! :p Lemme look ....

Are you talking about a "Generic HTTP Target?" That doc section shows you the payload, The target string is a full url like "http://hasst.local/brewbubbles/" (or whatever you want to call it.) It's set in "URL Target Settings." There's some additional information in that part of the doc.

(Incidentally, I found your name in the source code.)

If all that is taken care of, you might be able to see something in the serial log. There should be enough of a clue there to figure out what's going on.
 

ChrisThomas

Well-Known Member
Joined
Aug 11, 2019
Messages
219
Reaction score
49
Location
Bristol, UK
Hell if I know! :p Lemme look ....

Are you talking about a "Generic HTTP Target?" That doc section shows you the payload, The target string is a full url like "http://hasst.local/brewbubbles/" (or whatever you want to call it.) It's set in "URL Target Settings." There's some additional information in that part of the doc.

(Incidentally, I found your name in the source code.)

If all that is taken care of, you might be able to see something in the serial log. There should be enough of a clue there to figure out what's going on.
Well if YOU don't know.... :no:

Yes, Generic HTTP target, but I could never find the full url of what BrewBubbles is supplying in the documentation. The information that HomeAssistant requires about the source of the POST is "http://IP_ADDRESS/ENDPOINT". I guessed several options (I think including .../brewbubbles...) but never got one to work. In BrewBubbles I think I just point to my HomeAssistant IP address, but I'm not sure if it requires anything else.

So far I've not found a combination of source and dstination that works, but I must stress I'm fumbling around with options that I'm not fully understanding!
 

ChrisThomas

Well-Known Member
Joined
Aug 11, 2019
Messages
219
Reaction score
49
Location
Bristol, UK
You'll have to excuse any terminology here, I haven't got to grips with it yet. My "task" is get information from BB into HA. So is this a POST from BB AND a GET from HA? Is this just a POST from BB, or just a GET from HA? At this point I'm unclear if HA requests the info from BB or if BB sends and HA is always listening.

More reading over a coffee or several :coff3:
 
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
4,045
Reaction score
1,767
Location
Rural Kansas
Well my time with HAST ended when I moved full time into an RV ... but BB will POST to an endpoint, that means something in HAST has a RESTful API to allow that. The way HAST works most easily is to have dedicated integration or MQTT. Right now Brew Bubbles does not have MQTT but it could (I think.)

So your paths are "get Home Assistant to accept JSON POSTed by a device," add MQTT support to Brew Bubbles and send a pull request, or wait till I knock a couple projects off my list and can look at it.

One way that could work is to create an endpoint on your HAST host to receive the data and then turn around and send MQTT from there. You can look at this example in BrewPi Remix to see how to receive the POST from the device. You'd then need to code the rest to transform and send via MQTT.
 

ChrisThomas

Well-Known Member
Joined
Aug 11, 2019
Messages
219
Reaction score
49
Location
Bristol, UK
@LBussy Thanks for the info. I've tried to run before I've learned to crawl here, time to go back to some testing. I've downloaded RESTer extension for Chrome and in between hosting and tasking over the next few days I'll go back to first principles.
 

ChrisThomas

Well-Known Member
Joined
Aug 11, 2019
Messages
219
Reaction score
49
Location
Bristol, UK
So, after lots of anti-alcohol. Using RESTer on my laptop and doing a GET to the IP address of BB I get the HTML code. So I'm guessing I need to GET a different port or endpoint?

When I telnet to BB I get the following at the timing specicied in the target frequency.

2023-01-29T16:41:20Z V: Triggered URL Target push.
2023-01-29T16:41:20Z V: Host lookup: 192.168.20.197.
2023-01-29T16:41:20Z V: Resolved host 192.168.20.197 to IP 192.168.20.197.
2023-01-29T16:41:20Z N: Posting to: 192.168.20.197
2023-01-29T16:41:20Z V: Connecting to: 192.168.20.197 at 192.168.20.197 on port 80
2023-01-29T16:41:26Z W: Connection failed, Host: 192.168.20.197, Port: 80 (Err: 0)
2023-01-29T16:41:26Z E: URL Target post failed.
So BB is talking, but I'm not listening, or I'm listening to the wrong thing?
 
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
4,045
Reaction score
1,767
Location
Rural Kansas
So, after lots of anti-alcohol. Using RESTer on my laptop and doing a GET to the IP address of BB I get the HTML code. So I'm guessing I need to GET a different port or endpoint?
There is not currently an endpoint dedicated for any generic use. There is one used to supply information to the index page, however. Here's the JS in index,.htm that does the GET to Brew Bubbles:


You can look at that and see the endpoint is /bubble/ so hit that and you will see the JSON returned. I will warn you that since this is not a "published" API, I reserve the right to change it at any time and not consider it a breaking change. Given how often I have had to make changes, you should be safe.

When I telnet to BB I get the following at the timing specicied in the target frequency.
That looks like whatever you have chosen as your target is not listening.
 

ChrisThomas

Well-Known Member
Joined
Aug 11, 2019
Messages
219
Reaction score
49
Location
Bristol, UK
So there is a small amount of illumination dawning. I can GET from HA to the BB endpoint /IP/bubble/ and I understand,
You can look at that and see the endpoint is /bubble/ so hit that and you will see the JSON returned. I will warn you that since this is not a "published" API, I reserve the right to change it at any time and not consider it a breaking change. Given how often I have had to make changes, you should be safe.
could make it stop working.

What I can't get working is the PUSH from BB to HA and am I right that the BB PUSH is always to port 80, as below?
2023-01-29T16:41:20Z V: Triggered URL Target push.
2023-01-29T16:41:20Z V: Host lookup: 192.168.20.197.
2023-01-29T16:41:20Z V: Resolved host 192.168.20.197 to IP 192.168.20.197.
2023-01-29T16:41:20Z N: Posting to: 192.168.20.197
2023-01-29T16:41:20Z V: Connecting to: 192.168.20.197 at 192.168.20.197 on port 80
2023-01-29T16:41:26Z W: Connection failed, Host: 192.168.20.197, Port: 80 (Err: 0)
2023-01-29T16:41:26Z E: URL Target post failed.
The path I set in BB for the URL Target is, http://IP:8123/api/webhook/brewbubbles
The HA webhook set in HA is to the (default) HA port 8123 and the port is not separately configurable, in the above path I can only configure "brewbubbles".

Have I at last appeared at the right tree to bark up?

Additional: I can POST from RESTer to HA with the above path and sample BB data and it works fine.
 
Last edited:
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
4,045
Reaction score
1,767
Location
Rural Kansas
Have I at last appeared at the right tree to bark up?
Yes. :)

It seems I might have to update the lib with which I do that work with the url and port. - the good news is that guy that owns the other lib is standing right here. The bad news is I might end up with other library issues caused by upstream stuff changing.

If you have a moment would you create an issue on GitHub so I don't forget this? I have some other stuff percolating these next days but I might be able to look at that later this week.
 
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
4,045
Reaction score
1,767
Location
Rural Kansas
@LBussy I'm tinkering around with HomeAssistant and was thinking if I could log/use BrewBubbles. So where does the general HHTP POST from BrewBubbles come from? Is there an endpoint after the IP address, i.e. "http://IP_ADDRESS/ENDPOINT"? I've tried a few guesses but not yet been able to get HomeAssistant to actually hear anything, but that could also be me fumbling in the dark (again)!
I was able to glean some more information about a "proper" MQTT push to HA. I'll make myself some notes and queue that up to the next effort here. I just need to actually find my Brew Bubbles board. :)

Add HAST Support through MQTT #50
 

ChrisThomas

Well-Known Member
Joined
Aug 11, 2019
Messages
219
Reaction score
49
Location
Bristol, UK
@LBussy That won't stop me getting out "a spare" d1mini and seeing what happens if I try and configure a new sensor... Well it will 'till next week, which gives you plenty of time :oops:
 
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
4,045
Reaction score
1,767
Location
Rural Kansas
I recall there are some "Hello World" sketches out there for the ESP-8266 to connect to HAST. This will not give you a solution for the Brew Bubbles, but it is fun to play with:

 

ChrisThomas

Well-Known Member
Joined
Aug 11, 2019
Messages
219
Reaction score
49
Location
Bristol, UK
Not wishing to highjack this thread, but yes, ESPHome is what I was thinking of. Got a few sensors already running, just might try a change/addition to see if I can get the same data into MQTT...
 
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
4,045
Reaction score
1,767
Location
Rural Kansas
Okay try #2:

What I was saying was .... Espressif has expressed and acted upon a desire to deprecate the ESP-8266 and go all-in on the ESP-32 ecosystem. The core platform support for the 8266 is a mess, and getting the libraries I use to work with the broken core is a depressing prospect to be honest. I talked it over with @Thorrak a bit and he's got me convinced it's time to set aside my old boards.

So, I ordered some direct from China, and when they get here, I am going to work on porting Brew Bubbles to the new platform. Then, I'll look at fixing a couple bugs, add a feature or two (like HAST), and see if I can get a release out without making it an all-summer project. If you are interested and order now, you will be ready when I release.

1677500562567.png 1677500576995.png

"What about my Brew Bubbles board?!" Not to worry, as you can see, the outside row of pins is nearly identical in function to the older board. The dimensions are the same, and the new board is 0.6g lighter (I wonder if the iSpindel folks will take this up?) It should plug right on your existing Brew Bubbles boards without any muss or fuss.

And, come on folks, it's purple!

You will need a USB-C cable though, that's one for sure difference. Other than that I think it will be a simple upgrade for you folks. Let's hope it's as simple for me.
 

ChrisThomas

Well-Known Member
Joined
Aug 11, 2019
Messages
219
Reaction score
49
Location
Bristol, UK
@LBussy I've had limited exposure to ESP32, what I can say is that the S2 mini, seems a little "odd". Not the double row of pins, but trying to get Arduino or ESPHome to talk nicely took a while to find the right post!

I got the S2 mini initially without reading and thought it was going to be a "drop in" for ESP8266 D1-mini. Still tinkering with the S2 mini on ESPHome, once initially configured it appears to be OK. --crossing fingers--
 
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
4,045
Reaction score
1,767
Location
Rural Kansas
I can say is that the S2 mini, seems a little "odd". Not the double row of pins, but trying to get Arduino or ESPHome to talk nicely took a while to find the right post!
Well, that will all be on me. ESP32 is, in general, going to have different libs created for it depending on the ecosystem. When I am done I intend to add HAST as a feature.
 
Top