FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
06-13-2024 05:55 PM
Hello,
I need to add/edit recipes from outside the HMI developed with WebIQ. I saw that in webiq we can do this via websocket. The problem is that when adding the recipe via websocket it adds only Metadata and not Items which are the variables that we need to write.
How can we solve this? Is there another way to write recipes from the outside of the HMI? Or to directly manage the recipe files?
Solved! Go to Solution.
06-14-2024 08:18 AM - edited 06-14-2024 08:18 AM
You can connect from any system with any programming language that supports websocket connections to the WebIQ server API (which is the same that any WebIQ HMI and WebIQ Designer also uses). It is fully documented here: https://www.smart-hmi.com/user/download/deliver/docs/documentation-dev-connect-apidoc-version-2.15.x...
An example written in NodeJS can be downloaded here: https://www.smart-hmi.com/user/download/deliver/xmp/Additional%20Software/webiq-server-api-example-n...
You should not edit any undocumented files in any way as they can change without notice at any time.
06-17-2024 09:15 AM
Hello @webiq-sk, thank you for your reply. Specifically for the recipe.add request, it seems not possible to specify "item variable" which are the variable exchanged with PLC, but only Metadata:
Is this correct?
06-17-2024 10:02 AM
This is stored with a recipe version, so after creating the recipe you can set the item values with the version: https://www.smart-hmi.com/user/download/deliver/docs/documentation-dev-connect-apidoc-version-2.15.x...
Whenever a recipe is modified, a new version will be created automatically.
08-13-2024 07:20 AM
The recipe works like this:
- In a recipe template you define the items, which are part of a recipe. request example from WebIQ docu: recipe.template.add
{
"cmd": "recipe.template.add",
"id": 0,
"data": {
"template_name": "MyTemplate",
"items": [
{
"item_alias": "SBool",
"rank": 1
},
{
"item_alias": "SInt",
"rank": 0
}
],
"metadata": {
"key1": {
"default_value": 123,
"value_type": "int",
"label": "${MY_LOCALIZED_TEXT}"
}
}
}
}
.- Each recipe template has its unique template_id, which you must use as reference when you call recipe.add