Brew/Fermentation temperature versus used Brick

You have questions or need help around BierBot Bricks - this is the right place.
User avatar
JoDaNl
Posts: 23
Joined: Wed Mar 01, 2023 10:49 am

Re: Brew/Fermentation temperature versus used Brick

Post by JoDaNl »

Hi Bernhard,

I really like this, having a separate API to query devices & related information. Very nice!

I tried to get this working. I enabled the Pro-API (note : some additional translation work to be done as I think there are some new string in your code), but had some troubles. Based upon the documentation I tried the following:

Code: Select all

https://bricks.bierbot.com/api/devices/list?apikey=XXXXXXXXXXXXXXXX&proapikey=YYYYYYYYYYYYYYYY
But this results is a 'Page Not Found' error.

When I change the url into:

Code: Select all

https://bricks.bierbot.com/api/devices?apikey=XXXXXXXXXXXXXXXX&proapikey=YYYYYYYYYYYYYYYY
I get the following response : ["U2iFFOgA550767wrql0","zOYW2N1559jjFvlY5"]

I must be doing somthing wrong here I guess.

Regards, Jos
User avatar
Bernhard
Site Admin
Posts: 263
Joined: Sun Jan 23, 2022 3:53 pm
Location: Munich - Germany

Re: Brew/Fermentation temperature versus used Brick

Post by Bernhard »

Hi Jos,

had an error in the exporting. Fixed now in docu

1. Query

Code: Select all

https://brewbricks.com/api/devices
to get a list of device IDs
2. Pass one device ID to

Code: Select all

https://brewbricks.com/api/device
to get details for one specific device.

Hope this helps,
Bernhard.
User avatar
JoDaNl
Posts: 23
Joined: Wed Mar 01, 2023 10:49 am

Re: Brew/Fermentation temperature versus used Brick

Post by JoDaNl »

Hi bernhard,

Thanks for the quick update. I managed to got my test-code working. I'm able to query the Pro API.
I now can easily read the target-temperature/set-point of my fermenters and show it on the display.

Will release the next rev of Bookes Brick shortly...currently busy with another project ;)

Thanks again for your support in this.

Regards,
Jos.
User avatar
Bernhard
Site Admin
Posts: 263
Joined: Sun Jan 23, 2022 3:53 pm
Location: Munich - Germany

Re: Brew/Fermentation temperature versus used Brick

Post by Bernhard »

Glad it worked!
User avatar
JoDaNl
Posts: 23
Joined: Wed Mar 01, 2023 10:49 am

Re: Brew/Fermentation temperature versus used Brick

Post by JoDaNl »

Hi Bernhard,

One thing popped up. When calling the (non-pro) API using 'type=bookes' an array of device-id's is returned.
I noticed some 'escaping' of quotes & array. FYI : the Pro-API does not do this.

I'm using the ArduinoJSON library for parsing the returned array of device-id's...somehow this does not work correctly as the .size() member-function always returns 0, even if the JSON string contains this 'escaped' device-id.

For testing this I did a string replace, removing the backslashes & quotes surrounding the array. See below:

Code: Select all

[COMMS] response TEMP (received)  {"error":0,"error_text":"","warning":0,"warning_text":"","next_request_ms":10000,"epower_0_state":1,"epower_1_state":0,"used_for_devices":"[\"U85iFFgAG0Z7wrql0\"]"}
[COMMS] response TEMP (corrected) {"error":0,"error_text":"","warning":0,"warning_text":"","next_request_ms":10000,"epower_0_state":1,"epower_1_state":0,"used_for_devices":["U85iFFgAG0Z7wrql0"]}
When doing this I can successfully parse the json-array.
Not sure how the JSON is being constructed/serialised on the server...but maybe this article could be of help :

https://arduinojson.org/v6/issues/cannot-get-values/

For now I can fix this locally but maybe it's a good idea to solve this on the server.

Regards, Jos
User avatar
Bernhard
Site Admin
Posts: 263
Joined: Sun Jan 23, 2022 3:53 pm
Location: Munich - Germany

Re: Brew/Fermentation temperature versus used Brick

Post by Bernhard »

Hi Jos,

Thanks for pointing it out! I'll fix it.

Cheers,
Bernhard
User avatar
Bernhard
Site Admin
Posts: 263
Joined: Sun Jan 23, 2022 3:53 pm
Location: Munich - Germany

Re: Brew/Fermentation temperature versus used Brick

Post by Bernhard »

Short update: Should be fixed.

Btw... any device of type "bookesbrick" not only receives the used_for_devices but now also a "s_number_temp_offsetcelsius_0" which should be added to the display value on the device. This offset can be configured on the Bricks page.
Post Reply