Skip to content

Luup.call_action command details

reneboer edited this page Jul 29, 2020 · 8 revisions

In LUA you can use the following luup.call_action commands in scenes LUUP code or your own plug ins: GetCurrentActivityID, StartActivity, PowerOff, IssueDeviceCommand, IssueSequenceCommand, ChangeChannel, SetSleepTimer, CancelSleepTimer, SetHubPolling, SetLogLevel, SetRemoteImages, FindActivityByID, FindActivityByName, FindDeviceByID, FindDeviceByName, FindSequenceByID, FindSequenceByName, ForceUpdateConfiguration, SetTarget, SendDeviceCommand, SetLoadLevelTarget, SetColorRGB, SetColor.

When starting an activity or sending a command any set notifications or Scene trigger will fire. The commands are documented by the details and examples below.

SetHubPolling (newPollingFlag: “0” or “1”) determines is the WebSocket is kept open (1) or re-opened and closed for each command (0). With the latter the plug-in will not get instant updates and notification messages from the Hub and should only be used if you plan to turn off the power to the Hub. Calling SetHubPolling with 1 after restoring power will re-enable the instant updates. If SetHubPolling is 1 and the connection to the Hub is lost, the plug-in will try to restore the connection after five minutes.

luup.call_action command details

Main Harmony Control device actions.

GetCurrentActivityID, gets the current activity ID number from the Hub.

  • Input : None
  • Output: currentActivityID

StartActivity, starts the activity. Use activity ID number or activity name.

  • Input : newActivityID
  • Output: None

PowerOff, turn off the hub. Same as starting activity -1.

  • Input : None
  • Output: None

IssueDeviceCommand, Send IR Command to DeviceID, holding the button for Duration seconds. You can specify the DeviceID number or Device name. A duration of zero (0) gives a single click. Do not use a duration for more then 5 seconds as your Vera will not respond to other commands during.

  • Input : DeviceID, Command, Duration
  • Output: None

IssueSequenceCommand, Start a Button Sequence. You can specify the SequenceID number or Sequence name. The Sequence name is the name you created on your Hub.

  • Input : SequenceID or SequenceName
  • Output: None

ChangeChannel, change the channel of the current activity.

  • Input : newChannel
  • Output: None

SetSleepTimer, set the sleep timer to fire in Interval seconds.

  • Input : Interval
  • Output: None

CancelSleepTimer, cancel the currently active sleep timer.

  • Input : None
  • Output: None

SetHubPolling, when set to 1 the plugin will keep the websocket to the Harmony Hub open between commands and tracks any changes. When 0 only the command is handled and the connection is then closed.

  • Input : newPollFlag
  • Output: None

SetLogLevel, sets the log level. Supported values: 1 = Error, 2 = Warning, 8 = Info, 11 = Debug

  • Input : newLogLevel
  • Output: None

SetRemoteImages, sets if remote images should be used. 0 = local, 1 = remote. Calling this action will cause a luup reload. Is only supported on Vera, not on openLuup.

  • Input : newImageRemote
  • Output: None

FindActivityByID, lookup the activity name by specifying the activity ID.

  • Input : ActivityID
  • Output: retActivityName

FindActivityByName, lookup the activity ID by specifying the activity name.

  • Input : ActivityName
  • Output: retActivityID

FindDeviceByID, lookup the device name by specifying the device ID.

  • Input : DeviceID
  • Output: retDeviceName

FindDeviceByName, look up the device ID by specifying the device name.

  • Input : DeviceName
  • Output: retDeviceID

FindSequenceByID, lookup the sequence name by specifying the sequence ID.

  • Input : SequenceID
  • Output: retSequenceName

FindSequenceByName, look up the sequence ID by specifying the sequence name.

  • Input : SequenceName
  • Output: retSequenceID

ForceUpdateConfiguration, get the latest configuration details from the Hub.

  • Input : None
  • Output: None

SetTarget, to main Harmony Control device. Start the default activity (1) or power off the hub (0).

  • Input : newTargetValue
  • Output: None

###Child device actions

SendDeviceCommand, Send IR Command to child device, holding the button for Duration seconds. A duration of zero (0) gives a single click. Do not use a duration for more then 5 seconds as your Vera will not respond to other commands during. Not for Lamp child devices.

  • Input : Command, Duration
  • Output: None

###Child Lamp device actions

SetTarget, Turn the light on (1) or off (0).

  • Input : newTargetValue
  • Output: None

SetLoadLevelTarget, sets the desired brightness or load level for the dimming device. 0 = off, 100 = full brightness.

  • Input : newLoadlevelTarget
  • Output: None

SetColorRGB, set the lamp RGB color. Format R,G,B each between 0 and 100.

  • Input : newColorRGBTarget
  • Output: None

SetColor, set the lamp color in kelvin. Format TNNNNN where T is W for Warm and D for cool and NNNNN is the temperature in kelvin.

  • Input : newColorTarget
  • Output: None

luup.call_action examples

Get the current activity ID;

rc, rs, jb, rarg = luup.call_action("urn:rboer-com:serviceId:Harmony1", "GetCurrentActivityID",{},28) 
if (rc==0) then curActID = rarg.currentActivityID end

Start activity with ID 10439301;

rc, rs, jb, rarg = luup.call_action("urn:rboer-com:serviceId:Harmony1", "StartActivity",{newActivityID=10439301},28)

Start activity with name Watch TV;

rc, rs, jb, rarg = luup.call_action("urn:rboer-com:serviceId:Harmony1", "StartActivity",{newActivityID=”Watch TV”},28)

Send Mute command to device 21447853;

rc, rs, jb, rarg = luup.call_action("urn:rboer-com:serviceId:Harmony1", "IssueDeviceCommand",{DeviceID=21447853,Command="Mute"},28)

Send Mute command to device Radio;

rc, rs, jb, rarg = luup.call_action("urn:rboer-com:serviceId:Harmony1", "IssueDeviceCommand", {DeviceID=”Radio”,Command="Mute},28)

Turn on the default activity;

rc, rs, jb, rarg = luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget", {newTargetValue=1},28)

Turn all activities off;

rc, rs, jb, rarg = luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget", {newTargetValue=0},28)

Find activity ID with name Watch TV;

rc, rs, jb, rarg = luup.call_action("urn:rboer-com:serviceId:Harmony1", "FindActivityByName",{ActivityID=”Watch TV”},28)

Turn off polling;

rc, rs, jb, rarg = luup.call_action("urn:rboer-com:serviceId:Harmony1", "SetHubPolling",{newPollingFlag=”0”},28)

Send a VolumeUp command with holding the button for five seconds to child device #30;

rc, rs, jb, rarg = luup.call_action("urn:rboer-com:serviceId:HarmonyDevice1", "SendDeviceCommand",{Command="VolumeUp",Duration="5"},30)

Initiate a Sequence;

rc, rs, jb, rarg = luup.call_action("urn:rboer-com:serviceId:Harmony1", "IssueSequenceCommand",{SequenceID=”ShowRecordings”},28)

Next: HTTP request command details

Back to User Guide index