Tuesday, January 06, 2015

Exploring OpenHAB

Imports in OpenHAB scripts

Unlike in rules, in scripts import statements are not supported (see OpenHAB discussion). You have to use fully qualified names instead. Suprisingly, the syntax of fully qualified names differs in expressions and declarations:

In a variable declaration, a fully qualified type name is written like in Java dot-separated
var org.openhab.model.script.actions.Timer myTimer
In an expression, the qualification must be written double-colon-separated
if (now.getDayOfWeek() == org::joda::time::DateTimeConstants::SATURDAY) {

No comments :