Search
MENU
  • Expressions / Script language
  • Users and Permissions
  • Backup, restore, reset to factory settings
  • Software release notes
  • Equation, Script

    All of these smart rules use the TapHome Expressions scripting language.

    Equation

    Defines a condition whose result can only be TRUE or FALSE. Based on the result, predefined actions are then performed.

    Triggers whenever:

    • The value of any input variable changes

    Special Features:

    • Minimum duration: When the resulting value is TRUE, the smart rule will extend it for at least the minimum duration, even though it may have switched to the FALSE state sooner. The resulting value therefore remains TRUE for a defined minimum time. This timer resets when the condition result changes from FALSE to TRUE.
      Example: If the water temperature in the circuit drops below X degrees Celsius, the circulation pump switches on, but not for less than 10 minutes.
    • Maximum duration: When the resulting value is TRUE for longer than the defined maximum duration, the result switches to the FALSE state, even though the FALSE condition did not occur. This timer resets when the condition changes from FALSE to TRUE.
      Example: If the CO2 value in the room rises above 1000ppm, open a window. But not longer than 2 hours.

    Examples:

    If CO2 is greater than 800, open the window and keep it open for no more than 2 hours

    • Input variables: CO2 sensor… Co
    • Equation: Co > 800
    • Action for TRUE: Set level for window opening… 100%
    • Action for FALSE: Set level for window opening… 0%
    • Maximum duration: 2 hours

    If the CO2 is greater than 1200 and someone is in the room, or if it is greater than 800 and no one is in the room, open the window.

    • Input variables: CO2 sensor… Co, Presence… Mu
    • The action for TRUE and FALSE is the same as the example above
    • Equation:

    A:

    ((CO > 1200) AND (Mu = 1)) OR ((CO > 800) AND (Mu = 0))

    B:

    IF Mu=1
      IF(Co > 1200, RETURN(1));
    ELSE
      IF(Co > 800, RETURN(1));
    END
    RETURN(0);

    If the temperature on any of the thermometers exceeds 40 degrees Celsius, send a notification.

    • Input variables: Thermometer 1… Te1, Thermometer 2… Te2, Thermometer 3… Te3
    • Equation (Te1 > 40) OR (Te2 > 40) OR (Te3 > 40)
    • Action for TRUE: Send notification (bell icon)
    • Action for FALSE: None

    Script

    It is used to calculate the values of devices or variables. It allows simple linear programming or the use of cycles, without the possibility of using complex actions on devices (eg pulse, timing).

    Triggers whenever:

    • Any input variable marked as Trigger will change
    • Controlled trigger - using a button that can be triggered by various time smart rules such as Weekly schedule

    Example:

    1

    Every Saturday at 10 o'clock, you write the consumption of the previous week in the variable, and start counting the current consumption of this week based on the meter, which returns the accumulated consumption from the connection, regardless of the weekly intervals. Because TapHome statistics are optimized for performance, they use predefined intervals in which it is not possible to set the start "on Saturday at 10 o'clock", it is necessary to solve this through its own variables and script.

    • Mode: starts when the button is pressed
    • Input variables: Total cumulative consumption
    • Read and write variables: Last week's consumption, Cumulative consumption at the beginning of the period
    • Auxiliary smart rules:
      • Weekly schedule, which launches a virtual button every Saturday at 10 o'clock
    • Script:

    Last week's consumption := Total cumulated consumption - Cumulated consumption at the beginning of the period; Cumulated consumption at the beginning of the period := Total cumulated consumption;

    Example:

    2

    Control of 3 step ventilation system based on temperature difference.

    HYSTERESIS(temperature, 26, 24, 3, 
    HYSTERESIS(temperature, 22, 20, 2, 
    HYSTERESIS(temperature, 18, 16, 1, 0, Mu), Mu), Mu);