Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important information on the platform change.

cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

Add/edit recipe from outside WebIQ HMI

Add/edit recipe from outside WebIQ HMI

davifas
Member

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.

davifas_0-1718293982346.png

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?

4 REPLIES 4

webiq-sk
Frequent Contributor

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.

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: 

davifas_0-1718607771286.png

Is this correct?

webiq-sk
Frequent Contributor

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.

HmiGuide
Community Moderator
Community Moderator

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

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist