- Source:
Actions namespace. This namespace provides access to openHAB actions. All available actions can be accessed as direct properties of this object (via their simple class name).
Examples
Sends a broadcast notification
let { actions } = require('openhab');
actions.NotificationAction.sendBroadcastNotification("Hello World!")
Sends a PushSafer notification
let { actions } = require('openhab');
actions.Pushsafer.pushsafer("<your pushsafer api key>", "<message>", "<message title>", "", "", "", "")
Members
(static) Audio
- Source:
Audio Actions
The static methods of this class are made available as functions in the scripts. This allows a script to use audio features.
Examples
Audio.decreaseMasterVolume(float percent)
Audio.getMasterVolume()
Audio.increaseMasterVolume(float percent)
Audio.playSound(String filename)
Audio.playSound(String sink, String filename)
Audio.playSound(String sink, String filename, PercentType volume)
Audio.playSound(String filename, PercentType volume)
Audio.playStream(String url)
Audio.playStream(String sink, String url)
Audio.setMasterVolume(float volume)
Audio.setMasterVolume(PercentType percent)
Audio.decreaseMasterVolume(1.0)
(static) BusEvent
- Source:
BusEvent Actions
The static methods of this class are made available as functions in the scripts. This gives direct write access to the openHAB event bus from within scripts. Items should not be updated directly (setting the state property), but updates should be sent to the bus, so that all interested bundles are notified.
Example
BusEvent.postUpdate(String itemName, String stateString)
BusEvent.postUpdate(Item item, Number state)
BusEvent.postUpdate(Item item, String stateAsString)
BusEvent.postUpdate(Item item, State state)
BusEvent.restoreStates(Map<Item,State> statesMap)
BusEvent.sendCommand(String itemName, String commandString)
BusEvent.sendCommand(Item item, Number number)
BusEvent.sendCommand(Item item, String commandString)
BusEvent.sendCommand(Item item, Command command)
BusEvent.storeStates(Item... items)
(static) Ephemeris
- Source:
Ephemeris Actions
The static methods of this class are made available as functions in the scripts. This allows a script to use ephemeris features.
Example
Ephemeris.getBankHolidayName()
Ephemeris.getBankHolidayName(int offset)
Ephemeris.getBankHolidayName(int offset, String filename)
Ephemeris.getBankHolidayName(String filename)
Ephemeris.getBankHolidayName(ZonedDateTime day)
Ephemeris.getBankHolidayName(ZonedDateTime day, String filename)
Ephemeris.getDaysUntil(String searchedHoliday)
Ephemeris.getDaysUntil(String searchedHoliday, String filename)
Ephemeris.getDaysUntil(ZonedDateTime day, String searchedHoliday)
Ephemeris.getDaysUntil(ZonedDateTime day, String searchedHoliday, String filename)
Ephemeris.getHolidayDescription(@Nullable String holiday)
Ephemeris.getNextBankHoliday()
Ephemeris.getNextBankHoliday(int offset)
Ephemeris.getNextBankHoliday(int offset, String filename)
Ephemeris.getNextBankHoliday(String filename)
Ephemeris.getNextBankHoliday(ZonedDateTime day)
Ephemeris.getNextBankHoliday(ZonedDateTime day, String filename)
Ephemeris.isBankHoliday()
Ephemeris.isBankHoliday(int offset)
Ephemeris.isBankHoliday(int offset, String filename)
Ephemeris.isBankHoliday(String filename)
Ephemeris.isBankHoliday(ZonedDateTime day)
Ephemeris.isBankHoliday(ZonedDateTime day, String filename)
Ephemeris.isInDayset(String daysetName)
Ephemeris.isInDayset(String daysetName, int offset)
Ephemeris.isInDayset(String daysetName, ZonedDateTime day)
Ephemeris.isWeekend()
Ephemeris.isWeekend(int offset)
Ephemeris.isWeekend(ZonedDateTime day)
(static) Exec
- Source:
Exec Actions
This class provides static methods that can be used in automation rules for executing commands on command line.
Example
Exec.executeCommandLine(String... commandLine)
Exec.executeCommandLine(Duration timeout, String... commandLine)
(static) HTTP
- Source:
HTTP Actions
This class provides static methods that can be used in automation rules for sending HTTP requests
Example
HTTP.sendHttpDeleteRequest(String url)
HTTP.sendHttpDeleteRequest(String url, int timeout)
HTTP.sendHttpDeleteRequest(String url, Map<String,String> headers, int timeout)
HTTP.sendHttpGetRequest(String url)
HTTP.sendHttpGetRequest(String url, int timeout)
HTTP.sendHttpGetRequest(String url, Map<String,String> headers, int timeout)
HTTP.sendHttpPostRequest(String url)
HTTP.sendHttpPostRequest(String url, int timeout)
HTTP.sendHttpPostRequest(String url, String contentType, String content)
HTTP.sendHttpPostRequest(String url, String contentType, String content, int timeout)
HTTP.sendHttpPostRequest(String url, String contentType, String content, Map<String,String> headers, int timeout)
HTTP.sendHttpPutRequest(String url)
HTTP.sendHttpPutRequest(String url, int timeout)
HTTP.sendHttpPutRequest(String url, String contentType, String content)
HTTP.sendHttpPutRequest(String url, String contentType, String content, int timeout)
HTTP.sendHttpPutRequest(String url, String contentType, String content, Map<String,String> headers, int timeout)
(static) Log
- Source:
Log Actions
The static methods of this class are made available as functions in the scripts. This allows a script to log to the SLF4J-Log.
Example
Log.logDebug(String loggerName, String format, Object... args)
Log.logError(String loggerName, String format, Object... args)
Log.logInfo(String loggerName, String format, Object... args)
Log.logWarn(String loggerName, String format, Object... args)
(static) Ping
- Source:
Ping Actions
This Action checks the vitality of the given host.
Example
Ping.checkVitality(String host, int port, int timeout)
(static) ScriptExecution
- Source:
ScriptExecution Actions
The static methods of this class are made available as functions in the scripts. This allows a script to call another script, which is available as a file.
Example
ScriptExecution.callScript(String scriptName)
ScriptExecution.createTimer(ZonedDateTime instant, org.eclipse.xtext.xbase.lib.Procedures.Procedure0 closure)
ScriptExecution.createTimerWithArgument(ZonedDateTime instant, Object arg1, org.eclipse.xtext.xbase.lib.Procedures.Procedure1<Object> closure)
(static) Semantics
- Source:
Semantics Actions
The static methods of this class are made available as functions in the scripts. This allows a script to use Semantics features.
Example
Semantics.getEquipment(Item item)
Semantics.getEquipmentType(Item item)
Semantics.getLocation(Item item)
Semantics.getLocationType(Item item)
Semantics.getPointType(Item item)
Semantics.getPropertyType(Item item)
Semantics.getSemanticType(Item item)
Semantics.isEquipment(Item item)
Semantics.isLocation(Item item)
Semantics.isPoint(Item item)
(static) Things
- Source:
Things Actions
This class provides static methods that can be used in automation rules for getting thing's status info.
Example
Things.getActions(String scope, String thingUid)
Things.getThingStatusInfo(String thingUid)
(static) Voice
- Source:
Voice Actions
The static methods of this class are made available as functions in the scripts. This allows a script to use voice features.
Example
Voice.interpret(Object text)
Voice.interpret(Object text, String interpreter)
Voice.interpret(Object text, String interpreter, String sink)
Voice.say(Object text)
Voice.say(Object text, String voice)
Voice.say(Object text, String voice, String sink)
Voice.say(Object text, String voice, String sink, PercentType volume)
Voice.say(Object text, String voice, PercentType volume)
Voice.say(Object text, PercentType volume)