confusion with API/output/{id}

Get help and insight.
Post Reply
User avatar
bbrally
Posts: 186
Joined: Sat Mar 27, 2010 3:59 am
Bot?: No
Location: Vancouver, BC or NST, Thailand
Contact:

confusion with API/output/{id}

Post by bbrally » Thu Dec 01, 2016 3:05 am

When I post to the api/output/{id} to enable/disable an output I get a result I don't understand.

When I post to set output8 to enable = true, the response is returned that the output is now enabled. But when I go to the process editor and refresh the browser, output8 is still disabled?
If set output8 enabled=false via the API, output8 disappears altogether from the process editor.

Can someone explain what's going on?
output 8 via api swagger docs.jpg
output 8 via api swagger docs.jpg (79.13 KiB) Viewed 387 times
output 8 process editor.jpg
output 8 process editor.jpg (19.38 KiB) Viewed 387 times
Move, copy, clear processes and states: http://manipulator.from-ca.com/
Perform temp coefficient mods and datalogging: http://calculator.from-ca.com/
HMI Builder: http://bcsgui.from-ca.com/
HMI Builder latest ver: http://bcsguibeta.from-ca.com/

User avatar
JonW
Site Admin
Posts: 1474
Joined: Sun Jul 18, 2010 7:51 am
Bot?: No
Location: Huntington Beach, CA
Contact:

Re: confusion with API/output/{id}

Post by JonW » Thu Dec 01, 2016 8:36 am

bbrally wrote:When I post to the api/output/{id} to enable/disable an output I get a result I don't understand.

When I post to set output8 to enable = true, the response is returned that the output is now enabled. But when I go to the process editor and refresh the browser, output8 is still disabled?
If set output8 enabled=false via the API, output8 disappears altogether from the process editor.

Can someone explain what's going on?
The API call you're using is changing the output at the system level, not the process/state level. It's the equivalent of the "Enabled" checkmark in the BCS "Settings" tab. Your second example causes the output to disappear from the process editor since you are disabling it at the system level.

If you want to enable/disable at the process level, you'll need to use one of the two API's below:
/process/{process_id}/state/{state_id}/output_controllers
/process/{process_id}/state/{state_id}/boolean_outputs

User avatar
bbrally
Posts: 186
Joined: Sat Mar 27, 2010 3:59 am
Bot?: No
Location: Vancouver, BC or NST, Thailand
Contact:

Re: confusion with API/output/{id}

Post by bbrally » Thu Dec 01, 2016 2:04 pm

Seems obvious when you say it.

Thanks Jon.
Move, copy, clear processes and states: http://manipulator.from-ca.com/
Perform temp coefficient mods and datalogging: http://calculator.from-ca.com/
HMI Builder: http://bcsgui.from-ca.com/
HMI Builder latest ver: http://bcsguibeta.from-ca.com/

User avatar
bbrally
Posts: 186
Joined: Sat Mar 27, 2010 3:59 am
Bot?: No
Location: Vancouver, BC or NST, Thailand
Contact:

Re: confusion with API/output/{id}

Post by bbrally » Thu Dec 01, 2016 3:14 pm

/process/{process_id}/state/{state_id}/output_controllers
/process/{process_id}/state/{state_id}/boolean_outputs

These API's will allow toggling of the output, but they do so by changing the programming of the state.

Is there a way to change the output, but not affect the programming?

What I want to do is change the output regardless of any state running, until a state change takes place and then the program will take priority again to affect the output change. This way if returning to a state, the original programming will be intact.
Move, copy, clear processes and states: http://manipulator.from-ca.com/
Perform temp coefficient mods and datalogging: http://calculator.from-ca.com/
HMI Builder: http://bcsgui.from-ca.com/
HMI Builder latest ver: http://bcsguibeta.from-ca.com/

User avatar
JonW
Site Admin
Posts: 1474
Joined: Sun Jul 18, 2010 7:51 am
Bot?: No
Location: Huntington Beach, CA
Contact:

Re: confusion with API/output/{id}

Post by JonW » Thu Dec 01, 2016 3:23 pm

You can use your original call to API/output/{id} and change the "on" state to do that, but program heirarchy may or may not allow the output to be turned on/off.

Using the API to turn the output on is the same as turning it on manually via the main screen of the UI. However, ladder logic or process/state programming may override the ability to do this.

There is no way to turn force an output on via the API when either ladder logic or process/state programming is telling it to be off.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest