Scenarios

Tools → Scenarios

Raccourcis clavier/souris

Real brain of home automation, the scenarios allow to interact with the real world in a way intelligent.

Gestion

You will find there the list of scenarios of your Jeedom, as well as functionalities to manage them at best :

My scenarios

You will find in this part list of scenarios that you created. They are classified according to their band, possibly defined for each of them. Each scenario is displayed with its name and his parent object. THE grayed out scenarios are the ones that are disabled.

Advice

You can open a scenario by doing :

  • Click on one of them.
  • Ctrl Clic or Clic Center to open it in a new browser tab.

You have a search engine to filter the display of scenarios. The Escape key cancels the search. To the right of the search field, three buttons found in several places in Jeedom :

Once on the configuration of a scenario, you have a contextual menu with the Right Click on the tabs of the scenario. You can also use a Ctrl Click or Click Center to directly open another scenario in a new browser tab.

Creation | Editing a scenario

After clicking on Add, you must choose the name of your scenario. You are then redirected to the page of its general parameters. Before that, at the top of the page, there are some useful functions to manage this scenario :

Tips

Two tools will also be invaluable to you in setting up scenarios : > - The variables, visible in Tools → Variables > - The expression tester, accessible by Tools → Expression tester

A Ctrl Click on the execute button allows you to directly save, execute and display the scenario log (if the log level is not None).

General tab

In the tab General, we find the main parameters of the scenario :

IMPORTANT

The multi launch works per second, that is to say that if you have 2 launches in the same second without the box checked, there will still be 2 launches of the scenario (although it should not). Likewise, during several launches in the same second, some launches may lose the tags. Conclusion it is ABSOLUTELY necessary to avoid multiple launches in the same second.

Advice

Conditions can now be entered in triggered mode. Eg : #[Garage][Open Garage][Ouverture]# == 1 Attention : you can have a maximum of 28 triggers / programming for a scenario.

Tip mode programmed

Scheduled mode uses syntax Cron. For example, you can run a scenario every 20 minutes with */20 * * * *, or at 5am to sort out a multitude of things for the day with 0 5 * * *. THE ? to the right of a program allows you to set it without being a specialist in Cron syntax. It is also possible to put a launch time in the form Gi (hour without initial zero and minute, example for 09h15 => 915 or for 23h40 => 2340). This time can be the result of a calculation (using a command or a tag), for example : #sunset# +10 for a launch 10 minutes after sunset. Note that for a launch 1h30 after sunset you must put #sunset# + 130. Please note that when using a syntax other than a cron, Jeedom will not be able to give you the dates of the previous or following launches.

Scenario tab

This is where you will build your scenario. After creating the scenario, its content is empty, so it will do … nothing. You have to start with Add block, with the button on the right. Once a block has been created, you can add another block or a action.

For more convenience and not having to constantly reorder the blocks in the scenario, adding a block is done after the field in which the mouse cursor is located. For example, if you have ten blocks, and you click in the IF condition of the first block, the added block will be added after this block, at the same level. If no field is active, it will be added at the end of the scenario.

Advice

In conditions and actions, it is better to favor single quotes (‘) instead of double (“).

Advice

A Ctrl Shift Z or Ctrl Shift Y allows you to’Cancel or from redo a modification (addition of action, block…).

Blocks

Here are the different types of blocks available :

Each block has its options to better handle them :

If / Then / Otherwise blocks | Loop | In | A

For the conditions, Jeedom tries to make it possible to write them as much as possible in natural language while remaining flexible.

DO NOT use [] in condition tests, only parentheses () are possible.

Three buttons are available on the right of this type of block to select an item to test :

Note

On blocks of type If / Then / Otherwise, circular arrows to the left of the condition field allow to activate or not the repetition of actions if the evaluation of the condition gives the same result as during the previous evaluation. IF expression != 0 is equivalent to IF expression and IF expression == 0 is equivalent to IF not expression

Advice

There is a list of tags allowing access to variables from the scenario or another, or by the time, the date, a random number,… See below the chapters on commands and tags.

Once the condition is completed, you must use the "add" button on the left to add a new block or a action in the current block.

Block Code

The Code block allows you to execute php code. It is therefore very powerful but requires a good knowledge of the php language.

Access to controls (sensors and actuators)

Access to logs

Access to scenarios

Advice

Addition of a search function in the Code block : To research : Ctrl + F then Enter, Next result : Ctrl + G, Previous result : Ctrl+Shift+G

Scenarios : Little codes with friends

Comment block

Comment block acts differently when it is hidden. Its buttons on the left disappear as well as the title of the block, and reappear on hover. Similarly, the first line of the comment is displayed in bold type. This allows this block to be used as a purely visual separation within the scenario.

The actions

Actions added to blocks have several options :

Advice

Depending on the command selected, different additional fields may be displayed.

Possible substitutions

Triggers

There are specific triggers (other than those provided by commands) :

You can also trigger a scenario using the HTTP API described here.

You can use any of the following symbols for comparisons under conditions :

You can combine any comparison with the following operators :

Whether you are combining comparisons on different equipment or on the same one, it is always necessary to indicate the equipment. [Salle de bain][Hydrometrie][température] >= 18 && [Salle de bain][Hydrometrie][température] <= 22

Tags

A tag is replaced during the execution of the scenario by its value. You can use the following tags :

Advice

To have the leading zeros displayed, use the Date () function. See here.

You also have the following additional tags if your scenario was triggered by an interaction :

IMPORTANT

When a scenario is triggered by an interaction, it is necessarily executed in fast mode. So in the interaction thread and not in a separate thread.

Calculation functions

Several functions are available for the equipment :

The periods and intervals of these functions can also be used with PHP expressions For example :

Here are practical examples to understand the values returned by these different functions :

Socket with values : 000 (for 10 minutes) 11 (for 1 hour) 000 (for 10 minutes)
average(prise,période) Returns the average of 0 and 1 (can
  be influenced by polling)
averageBetween(#[Salle de bain][Hydrometrie][Humidité]#,2015-01-01 00:00:00,2015-01-15 00:00:00) Returns the average of the command between January 1, 2015 and January 15, 2015
min(prise,période) Returns 0 : the plug was extinguished during the period
minBetween(#[Salle de bain][Hydrometrie][Humidité]#,2015-01-01 00:00:00,2015-01-15 00:00:00) Returns the minimum command between January 1, 2015 and January 15, 2015
max(prise,période) Returns 1 : the plug was well lit in the period
maxBetween(#[Salle de bain][Hydrometrie][Humidité]#,2015-01-01 00:00:00,2015-01-15 00:00:00) Returns the maximum of the command between January 1, 2015 and January 15, 2015
duration(prise,1,période) Returns 60 : the plug was on (at 1) for 60 minutes in the period
durationBetween(#[Salon][Prise][Etat]#,0,Last Monday,Now) Returns the duration in minutes during which the socket was off since last Monday.
statistics(prise,count,période) Returns 8 : there were 8 escalations in the period
tendance(prise,période,0.1) Returns -1 : downward trend
stateDuration(prise) Returns 600 : the plug has been in its current state for 600 seconds (10 minutes)
lastChangeStateDuration(prise,0) Returns 600 : the socket went out (change to 0) for the last time 600 seconds ago (10 minutes)
lastChangeStateDuration(prise,1) Returns 4200 : the socket turned on (switch to 1) for the last time 4200 seconds ago (1h10)
lastStateDuration(prise,0) Returns 600 : the socket has been off for 600 seconds (10 minutes)
lastStateDuration(prise,1) Returns 3600 : the socket was last switched on for 3600 seconds (1h)
stateChanges(prise,période) Returns 3 : the socket has changed state 3 times during the period (if the info command is of binary type)
stateChanges(prise,0,période) Returns 2 : the socket has extinguished (going to 0) twice during the period
stateChanges(prise,1,période) Returns 1 : the plug is lit (change to 1) once during the period
lastBetween(#[Salle de bain][Hydrometrie][Température]#,Yesterday,Today) Returns the last temperature recorded yesterday.
variable(plop,10) Returns the value of the variable plop or 10 if it is empty or does not exist
scenario(#[Salle de bain][Lumière][Auto]#) Returns 1 in progress, 0 if stopped and -1 if deactivated, -2 if the scenario does not exist and -3 if the state is not consistent
lastScenarioExecution(#[Salle de bain][Lumière][Auto]#) Returns 300 if the scenario was started for the last time 5 min ago
collectDate(#[Salle de bain][Hydrometrie][Humidité]#) Returns 2021-02-14 17:50:12
valueDate(#[Salle de bain][Hydrometrie][Humidité]#) Returns 2021-02-14 17:45:12
eqEnable(#[Aucun][Basilique]#) Returns -2 if the equipment is not found, 1 if the equipment is active and 0 if it is inactive
tag(montag,toto) Returns the value of “montag” if it exists otherwise returns the value “toto”
name(eqLogic,#[Salle de bain][Hydrometrie][Humidité]#) Returns Hydrometry

Mathematical functions

A generic function toolbox can also be used to perform conversions or calculations :

And practical examples :

Example of function Returned result
randText(il fait #[salon][oeil][température]#;La température est de #[salon][oeil][température]#;Actuellement on a #[salon][oeil][température]#) the function will return one of these texts randomly at each execution.
randomColor(40,60) Returns a random color close to green.
round(#[Salle de bain][Hydrometrie][Humidité]# / 10) Returns 9 if the humidity percentage and 85
odd(3) Returns 1
median(15,25,20) Returns 20
avg(10,15,18) Returns 14.3
time_op(#time#, -90) if it is 4:50 p.m., return : 1 650 - 1 130 = 1520
formatTime(1650) Returns 4:50 p.m
floor(130/60) Returns 2 (minutes if 130s, or hours if 130m)
convertDuration(3600) Returns 1h 0min 0s
convertDuration(duration(#[Chauffage][Module chaudière][Etat]#,1, first day of this month)*60) Returns the ignition time in Days / Hours / minutes of the time of transition to state 1 of the module since the 1st day of the month

Miscellaneous functions

Specific commands

In addition to home automation commands, you have access to the following actions :

Scenario template

This functionality allows you to transform a scenario into a template to, for example, apply it to another Jeedom.

By clicking on the button Template at the top of the page, you open the template management window.

From there, you have the possibility :

By clicking on a template, you can :

Below, you have the part to apply your template to the current scenario.

Given that from one Jeedom to another or from one installation to another, the commands can be different, Jeedom asks you for the correspondence of the commands between those present during the creation of the template and those present at home. You just have to fill in the correspondence of the commands then to apply.

Addition of php function

IMPORTANT

Adding PHP function is reserved for advanced users. The slightest error can be fatal for your Jeedom.

Set up

Go to the Jeedom configuration, then OS / DB and launch the file editor.

Go to the data folder then php and click on the user.function.class.php file.

It is in this class that you can add your functions, there you will find an example of a basic function.

IMPORTANT

If you have a concern, you can always revert to the original file by copying the contents of user.function.class.sample.php In user.function.class.php

Nous utilisons des cookies pour vous garantir la meilleure expérience sur notre site web. Si vous continuez à utiliser ce site, nous supposerons que vous en êtes satisfait.