Page 3 of 3
Re: Brew/Fermentation temperature versus used Brick
Posted: Mon Dec 04, 2023 1:34 pm
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
Re: Brew/Fermentation temperature versus used Brick
Posted: Mon Dec 04, 2023 1:44 pm
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
to get details for one specific device.
Hope this helps,
Bernhard.
Re: Brew/Fermentation temperature versus used Brick
Posted: Mon Dec 04, 2023 5:56 pm
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.
Re: Brew/Fermentation temperature versus used Brick
Posted: Mon Dec 04, 2023 6:46 pm
by Bernhard
Glad it worked!
Re: Brew/Fermentation temperature versus used Brick
Posted: Thu Dec 07, 2023 10:49 am
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
Re: Brew/Fermentation temperature versus used Brick
Posted: Thu Dec 07, 2023 2:21 pm
by Bernhard
Hi Jos,
Thanks for pointing it out! I'll fix it.
Cheers,
Bernhard
Re: Brew/Fermentation temperature versus used Brick
Posted: Wed Dec 13, 2023 5:31 pm
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.