The best place is to look for them in the forum… or to ust ask . There are some very basic programming concepts that have never made it into the documentation. Now that you have found what you needed, maybe you could add it to the docs to make it easier for others to find. Here is a helpful resource for use with the old rules DSL and the obscure (and nearly dead) language that it uses… Xtend - Expressions.
It is much easier to learn and find information for real scripting languages, like Python. These can be used with the new rule engine and scripted automation. For now, the easiest way to get started is…
In case you choose to use the new rule engine, here is your rule converted to Jython to get you started…
from org.joda.time import DateTime
from core.rules import rule
from core.triggers import when
from core.actions import ScriptExecution, Telegram
K_Basement_Current_timer = None
def scriptUnloaded():
# This function is called when each script is unloaded and is a nice way to cleanup timers
if K_Basement_Current_timer is not None and not K_Basement_Current_timer.hasTerminated():
K_Basement_Current_timer.cancel()
@rule("Luftentfeuchter bitte Tank leeren")
@when("Item K_Basement_Current changed")
def current_check(event):
if items["K_Basement_Current"] == DecimalType(0):
scriptUnloaded()
elif items["K_Basement_Current"] >= DecimalType(1) and items["K_Basement_Current"] <= DecimalType(2):
if K_Basement_Current_timer is None or K_Basement_Current_timer.hasTerminated():
K_Basement_Current_timer = ScriptExecution.createTimer(DateTime.now().plusSeconds(30), lambda: Telegram.sendTelegram("bot1", "ACHTUNG: Luftentfeuchter bitte Tank leeren!!!"))