Fork me on GitHub

What's a rule

A rule is a string that has the format: "if this then that". The this part will be called the condition of the rule and the that part the actions of the rule.

Examples:

  • if its 10pm then turn the tv off
  • if its friday and its 8am then turn the light on
  • if (music is playing or the light is on) and somebody is present then turn the speaker on
  • if temperature of living room is less than 15°C for 5 minutes then log "its getting cold"

The condition of a rule consists of one or more predicates. The predicates can be combined with "and", "or" and can be grouped by parentheses.

for-suffix

A predicate can have a "for" as a suffix like in "music is playing for 5 seconds" or "tv is on for 2 hours". If the predicate has a for-suffix then the rule action is only triggered, when the predicate stays true the given time. Predicates that represent one time events like "10pm" can't have a for-suffix because the condition can never hold.

Predicates

Built in

Switches

Predicate for devices that have a state like switches

  • device is on|off
  • device is switched on|off
  • device is turned on|off

Examples:

  • tv is on
  • light is off

Presence sensors

Predicates for presence sensors like a motion detector

  • device is present
  • device is not present
  • device is absent

Examples:

  • my smartphone is present

Contact sensors

  • device is opened
  • device is closed

Variables

  • _expression [==|<|>|<=|>=] expression

Examples:

  • $tempsetting < 42
  • $device.attribute >= $someVar + 10

General Device attributes

Predicates for comparing device attributes like sensor value or other states.

  • attribute of device is equal to value
  • attribute of device equals value
  • attribute of device is not value
  • attribute of device is less than value
  • attribute of device is lower than value
  • attribute of device is greater than value
  • attribute of device is higher than value

Examples:

  • temperature of temperature sensor 1 is lower than 15°C
  • humidity of temperature sensor 1 is greater than 60%

Device attribute watchdog

Becomes true if an attribute was not update for a certain time.

  • attribute of device was not updated for time

Examples:

  • temperature of temperature sensor 1 was not updated for 5 minutes

chron-Plugin

Provided by the cron-plugin

  • its time
  • its day time
  • its day

Examples:

  • its 8am
  • its 8:00
  • its friday 10pm

mobile-frontend-Plugin

  • button text is pressed
  • button button text is pressed

Examples:

  • watch tv button is pressed

sunrise-Plugin

  • its suntime
  • its suntime
  • its time period before|after suntime
  • its before|after suntime

where suntime is "sunrise", "sunset" or any other supported suntime event.

Examples:

  • its sunrise
  • its sunset
  • its before sunrise
  • its after sunset
  • its 30 minutes after sunrise
  • its 2h before sunset

Actions

Built in

Switches

Actions for devices that can be turned on or off:

  • switch [the] device on|off
  • turn [the] device on|off
  • switch on|off [the] device
  • turn on|off [the] device

These actions support a for-Suffix to switch the device back to the state before after a certain time.

Examples:

  • turn tv on
  • switch the light off
  • switch the light on for 5 minutes

Dimmer

Actions dimmer devices.

  • dim [the] device to value[%]

Examples:

  • dim couch-light to 30%

Shutter/screens

Actions for shutter/screen devices:

  • lower [the] device [down]
  • raise [the] device [up]
  • move [the] device up|down
  • stop [the] device

These actions support a for-Suffix to stop the shutter/screen from moving after a certain time.

Examples:

  • raise kitchen-screen
  • lower kitchen-screen
  • lower kitchen-screen for 5 seconds
  • stop kitchen-screen

Logger

  • log "a string"

Variables

  • set $varname to expression

Examples:

  • set $tempsetting to $tempsetting + 0.5

shell-execute-Plugin

  • execute "shell-command"

mail-Plugin

  • send mail to: "address" subject:"subject" text:"text"

pushover-Plugin

  • push title:"title" message:"message" priority:1

Development

Take a look at the developer documentation for how it works and how to implement your own predicates and actions.