rulesx

Namespace

rulesx

Description:
  • Rules namespace

    This namespace provides complete rules with specific functionality, as well as utilities to be used in rules. It is not comparable to but uses the namespace rules from openhab-js. The rules provided by this namespace are developed to be created from file-based scripts only!

Source:

Classes

AlertManager
SceneEngine

Methods

(static) createAlarmClock(switchItem, alarmFunc)

Description:
  • Creates an alarm clock with time and days configurable over Items, therefore compatible with Sitemaps.

    The manager rule that creates and updates the alarm clock rule _createClockRule on change of settings Items. Also creates and removes the alarm clock rule on command ON/OFF of switchItem.

Source:
Example
rulesx.createAlarmClock('Florian_alarm1', data => { console.log('Successfully tested alarm clock.'); });
Parameters:
Name Type Description
switchItem string

name of Item to switch the alarm on/off

alarmFunc function

function to execute when the alarm clock fires

(static) createAlarmClockItems(switchItemName, switchItemLabel, persistenceGroup, sitemapSnippetopt, weekdaysLabelsopt)

Description:
  • Creates all required Items for an alarm clock.

Source:
Parameters:
Name Type Attributes Default Description
switchItemName String

name of Item to switch alarm on/off

switchItemLabel String

label of Item to switch alarm on/off

persistenceGroup String

name of group whose members are persisted & restored on startup

sitemapSnippet Boolean <optional>
false

whether to output a Sitemap snippet for alarm configuration

weekdaysLabels Array:.<String:> <optional>
['Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag']

names of weekdays in your language, starting with Monday & ending with Sunday

(static) createRainAlarmRule(config)

Description:
  • Create a rain alarm rule that monitors rain and wind conditions to raise alerts for open windows and doors when it rains.

    Please note that, if enabled, the wind speed condition is only evaluated when the rain alarm becomes active or when the contact opens. It is not continuously monitored, so if the wind speed changes while the rain alarm is active, it will not trigger a alert.

Source:
Parameters:
Name Type Description
config RainAlarmConfig

(static) createSceneEngine(sceneDefinition)

Description:
Source:
Parameters:
Name Type Description
sceneDefinition object

scenes definition

Properties
Name Type Description
controller string

name of Item that calls the scenes

scenes Array:.<object:>

Array of scenes

Properties
Name Type Description
value number

integer identifying the scene

targets Array:.<object:>

Array of scene members

Properties
Name Type Attributes Default Description
item string

name of Item

value string

target state of Item

required boolean <optional>
true

whether the Item's state must match the target state when the engine gets the current scene on change of a member

conditionFn function <optional>

the Item is only commanded and required for scene checks if the evaluation of this function returns true

(static) createTemperatureAlarmRule(config) → {MuteAlertFunction}

Description:
  • Create a rule for a temperature-based alarm that monitors the temperature and raises alerts for open windows and doors when the temperatur condition callback returns true.

Source:
Parameters:
Name Type Description
config TemperatureAlarmConfig
Returns:

a method to mute alerts for a specific contact Item for a certain time

Type
MuteAlertFunction