User Tools

Site Tools


recipes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
recipes [2020/06/01 12:32] emozolyakrecipes [2020/06/01 15:14] – [Using recipes in scripts] emozolyak
Line 1: Line 1:
 ======Recipes====== ======Recipes======
  
-The recipe allows you to initialize a set of values ​​to a certain group of registers. There are several options for using recipes. +The recipe allows you to initialize a set of registers with pre-defined values. There are several options for using recipes
 +  * Recipes can be applied either by selecting an entry in the recipe drop-down list or by calling a script 
 +  * Recipes can be edited right on the dashboard with a quick edit method (not going back to the main recipe menu) 
 +  * Recipes can be visible or not for different users. Some recipes can be 'locked' (i.e. viewed w/o possibility to change recipe data for users except the admin) to protect important, or base recipes from changing.  
 +  * Recipe list can be used as a handy tool for analysing user choice from different options. In this case recipe names in the list or category serve as a placeholders for the selection listbox. The selected id is returned to the lua script which then can process the selection
  
-The recipe management menu resided in a 'logic' section of the Setup menu: +===== Recipes page=====
-{{ ::recipes_entry.png?direct&400 |}} +
  
 +The recipe management menu resides in a 'logic' section of the Setup menu:
  
-  * placing a list of recipes on a dashboard in the form of a drop-down or full list. After choosing a recipe, there are two options - immediately apply it, or use a script that will track the selection of a new recipe and perform some additional actions. +{{ ::recipes_entry.png?direct&600 |}} 
-  * activation of the recipe inside the script, which can be initiated, for example, by the scheduler (you can apply several recipes at the same time, implementing script management, for example control of lighting zones, etc.).+
  
-Recipes are created in the Configuration/Recipes menu.+The main spots of the recipe management page are
 +  - Import/Export buttons. The recipe can be exported to a JSON file. After importing such recipe file, it will create a new entry in the list with a new id 
 +  - Add recipe button 
 +  - Recipe category. use them to divide the list, then the dropdown lists on dashboard can show only specific category you set for them 
 +  - 'Locked' recipe colored light gray. This recipe can only be edited by admin, but still viewed by the users with respective rights 
 +  - Checkbox for selecting export candidates 
 +  - Common (non-locked) recipe list.  
 +  - Edit/Delete/Clone buttons
  
-{{ :recipes1.png?direct |Configuration/Recipes menu}}+{{ ::recipe_list_inum.png?direct&600 |}}
  
-Recipes can have sub-categories, i.e. the list of recipes on a dashboard can be displayed completely, or only from a certain category.+===== Recipe setup=====
  
-{{ :recipes2.png?direct |category}}+The //Basic// tab: 
 +  ***Title** - this title will be seen in the selection lists and setup page 
 +  ***Description** - user comments for the recipe  
 +  ***Disable** checkbox - hides this recipe from the list 
 +  ***Lock** - prevent the recipe from editing by non-admin users 
 +  ***Registers 1..4 / Value / Description** - this set of the registers will be initialized with the respective values upon invoking recipe. The description given here will be used to show the comments in the quick edit window (right on the dashboard) 
 +  ***Delete** button deletes the register //n// from the list 
 +  ***Add register to recipe** button expands the list with a new entry 
  
-And also be available to specific users.+{{ ::recipe_basic_tab.png?direct&600 |}}
  
-{{ :recipes3.png?direct |users}}+The //Permission// tab lists the users who can view or edit recipes.  
 +{{ ::recipe_permissions.png?direct&600 |}}
  
-When placing a list of recipes on dashboard, you must specify:+===== Using recipe on the dashboard =====
  
-  * Category of recipes, or complete list of all categories +When placing a recipes selection listbox on dashboardthere are some specific attributes you must specify:
-  * Drop-down or multiline list +
-  * Number of the register where the recipe number will change. (changing this register can be monitored in scripts when you need to perform some actions associated with this recipe) +
-  * Whether to apply the recipe immediately or not (in the second caseonly the register number will change where the current recipe number is stored)+
  
-{{ :recipe4.png?direct |dashboard}}+  * //Category// of recipes, or a full list.  
 +  * The //register// accosiated with the dropdown list which will keep the //id// of the selected recipe.  
 +  * '//Allow change value//' checkbox. If you want the user be able to expand the list, check it, otherwise the user won't be able to select and expand the list. With unchecked option, the recipes can be itereated with the lua script and extra buttons which return next/previous selection event (register value coding the action)  
 +  * '//Apply immediately//' checkbox. The values from the set will be written at once after selection, or you can check register change in a lua script and first do some steps before applying a recipe
  
-To apply recipes within scripts, the **ApplyRecipe (recipeId, userId)** function is used. [[working_with_recipes|See here]]. After it is executed, if a list is displayed on one of the dashboards, the contents of the recipe from the ApplyRecipe function, you must also write the recipe number in the register tied to the list - to synchronize the display of the list.+ 
 +{{ ::recipe_on_the_dashboard.png?direct&600 |}} 
 + 
 +If the user has right to edit the recipe, he can do this right in the selectoin box: 
 + 
 +{{ quick_rcp_apply_edit.gif |}} 
 + 
 +===== Using recipes in scripts ===== 
 + 
 +To apply recipes within scripts, the **ApplyRecipe (recipeId, userId)** function is used. [[working_with_recipes|See here]]. The example of such script: 
 + 
 +<code lua> 
 +function main (userId) 
 +    local id = GetReg("rcpSelector"
 +    ApplyRecipe(iduserId) 
 +    AddInfoMessage("The recipe with id = " .. id .. " was applied!"
 +end 
 +</code> 
 + 
 +{{ recipe_in_scripts.gif |}}
recipes.txt · Last modified: 2022/01/15 15:41 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki