Page 3 of 7

Re: BCS 4.0 .NET API and BCS Temperature Logger

Posted: Thu Mar 24, 2016 8:30 am
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.

Re: BCS 4.0 .NET API and BCS Temperature Logger

Posted: Thu Mar 24, 2016 9:11 am
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.

Re: BCS 4.0 .NET API and BCS Temperature Logger

Posted: Thu Mar 24, 2016 9:23 am
by MikeRussell
You're all good! I just haven't been able to test on a 460 yet! :D

Re: BCS 4.0 .NET API and BCS Temperature Logger

Posted: Thu Mar 24, 2016 9:57 am
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]}

Re: BCS 4.0 .NET API and BCS Temperature Logger

Posted: Thu Mar 24, 2016 10:01 am
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!

Re: BCS 4.0 .NET API and BCS Temperature Logger

Posted: Thu Mar 24, 2016 10:05 am
by Broph
No need to say to sorry to me. I appreciate all of your efforts. Let me know if I owe you anything.

Re: BCS 4.0 .NET API and BCS Temperature Logger

Posted: Thu Mar 24, 2016 10:09 am
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]}

Re: BCS 4.0 .NET API and BCS Temperature Logger

Posted: Thu Mar 24, 2016 10:28 am
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.

Re: BCS 4.0 .NET API and BCS Temperature Logger

Posted: Thu Mar 24, 2016 10:43 am
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.

Re: BCS 4.0 .NET API and BCS Temperature Logger

Posted: Thu Mar 24, 2016 10:46 am
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.