Page 1 of 1

Tilt payload to Bierbrick cloud

Posted: Tue Feb 21, 2023 8:38 pm
by Chuckg
Good Evening,

I am setting up a Raspberry Pi brick and want to do Tilt integration. I found a Github project called Tilt-Pitch (https://github.com/linjmeyer/tilt-pitch) which seems low overhead compared to TiltPi or other BLE to WiFi bridges fro Tilt. Tilt-Pitch works with some of the usual suspects. Can you provide an example of the payload you are looking for so I can perhaps modify one of the configurations they have for other cloud sites?

Also does the Pro Version support more frequent logging than the default 15 minutes?

Thanks,
ChuckG

Re: Tilt payload to Bierbrick cloud

Posted: Wed Feb 22, 2023 6:24 am
by Bernhard
Hey ChuckG,

the Bricks API offers currently two endpoints:

1. As used by Bricks / RaspberryPi / the iSpindel /Hydrom, documented in the docu.
2. As used by TILT.

If you build your own mapping tool, I'd go for option 1.
Type: POST
Body: {
"apikey": "Ii3V0unaFaXKQrMfCI8T",
"type": "tilt",
"brand": "tilt_bridge",
"version": "0.0.1",
"chipid": "ORANGE",
"s_number_wort_0": 7.9,
"s_number_temp_0": 14.3,
"s_number_voltage_0": 4.09,
"s_number_wifi_0": -90,
"s_number_tilt_0": 40.23
}
URL: https://brewbricks.com/api/iot/v1


If you go for option two, here is a sample TILT request:

Type: POST
URL: https://brewbricks.com/api/tilt/v1
Body (raw, Text/JSON): {"Timepoint":"44979.30284229166","Temp":"61.0","SG":"1.027","Beer":"Ii3V0unaFaXKQrMfCI8T","Color":"ORANGE","Comment":""}"
"Beer" being your BierBot Bricks API key

Note: Both APIs require you to activate before the "Brick" before the second request.

PRO allows both higher and lower logging rates than 15min.

I'd be highly interested if you implement something!

If you need support, please let me know!

Cheers,
Bernhard.

Re: Tilt payload to Bierbrick cloud

Posted: Wed Feb 22, 2023 4:10 pm
by Chuckg
Good Afternoon,

I was able to get tilt-pitch up and running using the handy tilt simulator. I hope to do live testing with my Tilt soon. I did encounter one things:

1. I am sending the temp in Fahrenheit. It appears regardless of putting SETTTINGS to Imperial or Custom (Fahrenheit), the Tilt Brick is converting it to Fahrenheit again. So, my 73F is showing on the site as 163.4F.

My changes to tilt-pitch for BierBot are here: https://github.com/ChuckGl/tilt-pitch

ChuckGl

Re: Tilt payload to Bierbrick cloud

Posted: Wed Feb 22, 2023 4:55 pm
by Bernhard
Cool stuff!!

Bricks backend only works in SI units. According to your preferences you can change in your user settings what is displayed in the UI.

So please do a (value_in °F − 32) × 5/9 to get temp in C before submitting it.

Cheers,
Bernhard.

Re: Tilt payload to Bierbrick cloud

Posted: Wed Feb 22, 2023 6:39 pm
by Chuckg
SI as in Kelvin?!? If so, I am curious why the use of SI units. I wasn't able to get anything out of the tilt-simulator but F. I will have to see if that changes with an actual Tilt. I do wonder how off things might get converting from the Tilt's F to C to K then back to F for management though.

ChuckG

Re: Tilt payload to Bierbrick cloud

Posted: Wed Feb 22, 2023 6:49 pm
by Bernhard
Hey ChuckG,

you're right. SI would be Kelvin. But a lot of the temperature control logic happens internally in Kelvin (or in Delta of Kelvin). And "Difference in Kelvin" is equal to "Difference in Celsius". Or are you asking why SI units at all?

Regarding how off things would be:
Let's assume 72°F = 22.2222222°C. Even if you only transmit 2 decimals - let's say 22.22°C. This would map back to 71,99°F. Certainly below the temperature probe tolerance - a DS18B20 has +0.5°C.

Cheers,
Bernhard.

Re: Tilt payload to Bierbrick cloud

Posted: Wed Feb 22, 2023 7:47 pm
by Chuckg
Far enough. LOL Thanks for the explanation. I did get tilt-pitch to report in Celsius after installing it on my actual BrickPi.

Thanks again,
ChuckG

Re: Tilt payload to Bierbrick cloud

Posted: Wed Feb 22, 2023 8:09 pm
by Bernhard
Sweet! Please keep me posted!

Re: Tilt payload to Bierbrick cloud

Posted: Sat Mar 11, 2023 7:13 pm
by Chuckg
Well Tilt-Pitch was a bust when I switched from the simulator to my actual Tilt. It uses beacontools, which has a bug with RPI 4. The bug prevents scanning. All attempts to update this and that lead to other known issues. So, after hours of digging and testing I landed on Tilty (pip3 install tilty). It allows time limiting TILT polls and POSTs to BierBot. I had to modify "webhook.py" to change temp from F to C. Other than that it is as "pip'd" with payload added via the configuration, and a tilty.service file to daemonize it.

Tilty captures the following:
{'color': 'Pink', 'gravity': 1.0, 'temp': 65.0, 'mac': 'da:a9:01:03:01:02', 'timestamp': '2023-03-11T20:03:40.214946', 'uuid': 'a495bb80c5b14b44b5121370f02d74de'}

I have opted this as the payload, though I don't think you are doing anything with timepoint.
{"apikey": "xxxxxxxxx", "type": "tilt", "brand": "tilty", "version": "{{ color }}", "chipid": "{{ color }}", "s_number_wort_0": {{ gravity }}, "s_number_temp_0": {{ temp }}, "timepoint": "{{ timestamp }}"}

ChuckGl