LogoLogo
  • Welcome to the MOOST platform user manual
  • Platform Manual
    • Login
      • Forgot Password
    • Notifications
    • Rules
      • Rule Configurator
        • Data graph
        • Datasets
        • Condition
        • Streak
        • Message
        • Settings
        • Rule Simulator
        • Early Adopter
        • Command
      • Rule Language
        • Syntax
        • Data Types
        • Data Structures
        • Functions
          • AVG
          • COUNT
          • DISTINCT
          • EVAL
          • FILTER
          • GROUP_BY_DEVICE
          • GROUP_BY_TIME
          • MAX
          • MIN
          • POSITION
          • REVERSE
          • SORT
          • SUBSET
          • SUM
        • Operations
          • Plus
          • Minus
          • Multiply
          • Divide
          • Negate
          • Less Than
          • Less or Equal
          • Equal
          • Not Equal
          • Greater or Equal
          • Greater
          • AND
          • OR
          • NOT
          • Format
          • Attribute Accessor
        • Examples
    • Events
    • Buildings
      • Household Profile
    • User Profile
    • Billing Portal
      • Payment Method
      • Update Payment Address
      • Invoices
      • Terminate Subscription
    • Context Services
      • Weather Forecast
      • Solar Production Forecast
      • Power Consumption Forecast
      • Power Generation Forecast
    • Support Center
  • Technical Integration
    • Cloud-to-Cloud Integration
      • Platform On-boarding
      • Configure Notification Settings
        • Receive Notifications
          • iOS Notification Handling
      • MOOST API Integration
        • Request Access Token
        • Synchronize Buildings and Devices
          • Device Types
        • Forward Events
          • Event Types
            • Device Status
            • Charging Modes
            • Switch State
        • Notifications and Interactions
          • Return Notification Interaction
  • Best Practices
    • FAQ
    • User Acceptance Testing
  • Policies
    • Security Policy
    • Privacy Policy
Powered by GitBook

© 2025 MOOST AG

On this page
Export as PDF
  1. Platform Manual
  2. Rules
  3. Rule Language

Examples

Our rule configurator often provides the possibility to get to your goal in different ways. This page shows examples on how you can combine the different functions and operations to write a rule.

PreviousAttribute AccessorNextEvents

Last updated 1 year ago

SUBSETS

Subsets are often used to select a certain time period from a timeseries.

For example, we want to send a message if the minimum of the newest two entries of a time series of 5 days in Grid Power Consumption is greater than the minimum of the remaining time series.

, we simply can add the number of entries we want to extract from a vector, as long as they are at the beginning or end of the vector. As we want the most recent entries, we must precede that value with a minus sign.

MIN(SUBSET($GridPowerConsumption5d, -2))

We now have a snippet of the two newest entries from the original time series. By adding the , we end up with the lower value of those two.

Alternatively, we can also take the newest entries in a certain time period. Here we want to get the minimum of all registered Grid Power Consumption events from the last 30 minutes until now.

So we would need to add an additional minute (or at least some seconds) to include the event that occurred exactly 30 minutes ago.

MIN(SUBSET($GridPowerConsumption5d, now-31min, now)) 

Let us continue with the first version. We now want to compare this minimum value with the minimum of the rest of the time series.

The beginning of this snippet is therefore the first value of the vector at position 0 up to and including the third most recent event. As before, we can get the minimum by applying a MIN function to the resulting subset.

MIN(SUBSET($GridPowerConsumption5d, 0, -3))

Finally, we simply have to combine the two parts for our condition by adding a between them:

MIN(SUBSET($GridPowerConsumption5d, -2)) > MIN(SUBSET($GridPowerConsumption5d, 0, -3))
As described on the SUBSET chapter of the Functions page
MIN function
Now is always defined as the newest entry and is included in the subset, but the start time is excluded.
Greater operator