BCS 4.0 .NET API and BCS Temperature Logger

Applications that run on PC/Mac.
MikeRussell
Posts: 30
Joined: Thu Jun 18, 2015 7:58 pm
Bot?: No

Re: BCS 4.0 .NET API and BCS Temperature Logger

Post by MikeRussell »

Hey Broph,
thanks for giving it a try!

Here's my hunch - are you on a BCS460 or 462?

I bet the app is requesting http://192.168.1.122/api/temp/4 and getting a 404, parsing the response and throwing an exception.

That exception message is written in place of all of the temperatures and thus, destroys the use of the program. I need to fix the error handling there.
User avatar
Broph
Posts: 117
Joined: Fri Oct 16, 2009 1:19 am
Bot?: No
Location: Illinois
Contact:

Re: BCS 4.0 .NET API and BCS Temperature Logger

Post by Broph »

Hi Mike,

Yes a BCS-460. If there's anything else that I should try on my end feel free to let me know.
Thomas Brophy
AleForce Homebrewery
MikeRussell
Posts: 30
Joined: Thu Jun 18, 2015 7:58 pm
Bot?: No

Re: BCS 4.0 .NET API and BCS Temperature Logger

Post by MikeRussell »

You're all good! I just haven't been able to test on a 460 yet! :D
User avatar
Broph
Posts: 117
Joined: Fri Oct 16, 2009 1:19 am
Bot?: No
Location: Illinois
Contact:

Re: BCS 4.0 .NET API and BCS Temperature Logger

Post by Broph »

MikeRussell wrote:Hey Broph,
thanks for giving it a try!

Here's my hunch - are you on a BCS460 or 462?

I bet the app is requesting http://192.168.1.122/api/temp/4 and getting a 404, parsing the response and throwing an exception.

That exception message is written in place of all of the temperatures and thus, destroys the use of the program. I need to fix the error handling there.
ok thanks. Yep nothing comes up with that URL.

When I change that URL in the browser for 0,1,2,3 is what I get (4,5,6,7 are blank):

http://192.168.1.122/api/temp/0
{"name":"Hot Liq","temp":498,"setpoint":null,"resistance":19945,"enabled":true,"coefficients":[0.001137155,0.0002325949,9.5400029999e-8]}

http://192.168.1.122/api/temp/1
{"name":"Mashtun","temp":497,"setpoint":null,"resistance":19985,"enabled":true,"coefficients":[0.001137155,0.0002325949,9.5400029999e-8]}

http://192.168.1.122/api/temp/2
{"name":"Boil Kettle","temp":492,"setpoint":null,"resistance":20277,"enabled":true,"coefficients":[0.001137155,0.0002325949,9.5400029999e-8]}

http://192.168.1.122/api/temp/3
{"name":"RIMS","temp":494,"setpoint":null,"resistance":20166,"enabled":true,"coefficients":[0.001137155,0.0002325949,9.5400029999e-8]}
Thomas Brophy
AleForce Homebrewery
MikeRussell
Posts: 30
Joined: Thu Jun 18, 2015 7:58 pm
Bot?: No

Re: BCS 4.0 .NET API and BCS Temperature Logger

Post by MikeRussell »

Ok, perfect, just as I suspected.

I will correct the scope of error handling so it is usable for BCS460 users. Sorry for the oversight!
User avatar
Broph
Posts: 117
Joined: Fri Oct 16, 2009 1:19 am
Bot?: No
Location: Illinois
Contact:

Re: BCS 4.0 .NET API and BCS Temperature Logger

Post by Broph »

No need to say to sorry to me. I appreciate all of your efforts. Let me know if I owe you anything.
Thomas Brophy
AleForce Homebrewery
JonW
Site Admin
Posts: 1726
Joined: Sun Jul 18, 2010 7:51 am
Bot?: No
Location: Huntington Beach, CA
Contact:

Re: BCS 4.0 .NET API and BCS Temperature Logger

Post by JonW »

Why not just use the "poll" API call? It will work the same for the 460 or 462 and then you just iterate the number of elements returned.

Results for BCS-460 /api/poll
{"alarm":{"on":false},"din":[null,null,null,null],"output":[0,0,0,0,null,null],"temp":[804,null,null,null],"process":[{"running":false,"paused":false,"current_state":255,"waiting":false,"timers":[0,0,0,0]},{"running":false,"paused":false,"current_state":255,"waiting":false,"timers":[0,0,0,0]},{"running":false,"paused":false,"current_state":255,"waiting":false,"timers":[0,0,0,0]},{"running":false,"paused":false,"current_state":255,"waiting":false,"timers":[0,0,0,0]},{"running":false,"paused":false,"current_state":255,"waiting":false,"timers":[0,0,0,0]},{"running":false,"paused":false,"current_state":255,"waiting":false,"timers":[0,0,0,0]},{"running":false,"paused":false,"current_state":255,"waiting":false,"timers":[0,0,0,0]},{"running":false,"paused":false,"current_state":255,"waiting":false,"timers":[0,0,0,0]}],"setpoint":[null,null,null,null]}

Results for BCS-462 /api/poll
{"alarm":{"on":false},"din":[null,null,null,null,null,null,null,0],"output":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"temp":[669,640,659,647,667,646,642,null],"process":[{"running":false,"paused":false,"current_state":255,"waiting":false,"timers":[0,0,0,0]},{"running":false,"paused":false,"current_state":255,"waiting":false,"timers":[0,0,0,0]},{"running":false,"paused":false,"current_state":255,"waiting":false,"timers":[0,0,0,0]},{"running":false,"paused":false,"current_state":255,"waiting":false,"timers":[0,0,0,0]},{"running":false,"paused":false,"current_state":255,"waiting":false,"timers":[0,0,0,0]},{"running":false,"paused":false,"current_state":255,"waiting":false,"timers":[0,0,0,0]},{"running":false,"paused":false,"current_state":255,"waiting":false,"timers":[0,0,0,0]},{"running":false,"paused":false,"current_state":255,"waiting":false,"timers":[0,0,0,0]}],"setpoint":[null,null,null,null,null,null,null,null]}
MikeRussell
Posts: 30
Joined: Thu Jun 18, 2015 7:58 pm
Bot?: No

Re: BCS 4.0 .NET API and BCS Temperature Logger

Post by MikeRussell »

Great suggestion, JonW!

To answer your question, I was not aware of poll - is it hiding on http://www.embeddedcc.com/api-docs/ somewhere? That's what I used to create my basic test app. So far the .net API I wrote only has an object for TemperatureProbe based on the json response for /api/temp/x - does poll return the probe names? I'm not seeing anything obvious in your example response.

I will look into modeling that response as an alternative.
brahn
Posts: 543
Joined: Thu Dec 13, 2012 11:01 am
Bot?: No

Re: BCS 4.0 .NET API and BCS Temperature Logger

Post by brahn »

JonW wrote:Why not just use the "poll" API call?
Because it's an undocumented API designed specifically for the UI and could change without notice. The documented API's should be considered more stable and we'll be careful not to remove elements or change the format of the data.

But, with that caveat Jon's right that poll would be an easy way to do this.
brahn
Posts: 543
Joined: Thu Dec 13, 2012 11:01 am
Bot?: No

Re: BCS 4.0 .NET API and BCS Temperature Logger

Post by brahn »

MikeRussell wrote:Great suggestion, JonW!

To answer your question, I was not aware of poll - is it hiding on http://www.embeddedcc.com/api-docs/ somewhere? That's what I used to create my basic test app. So far the .net API I wrote only has an object for TemperatureProbe based on the json response for /api/temp/x - does poll return the probe names? I'm not seeing anything obvious in your example response.

I will look into modeling that response as an alternative.
Nope, undocumented because we want to be flexible with the option to change poll in the future if needed for UI changes. Poll does not return probe names. At one point we worked on an API that returned all the names of the common objects but it required too much memory and caused lots of problems.
Post Reply