Difference between revisions of "HubAction Object"
(→Constructors) |
|||
Line 28: | Line 28: | ||
// Protocol.LAN examples | // Protocol.LAN examples | ||
− | + | ||
− | //Send Wake On Lan to mac address 00:11:22:33:44:55 | + | // Send UDP Message |
+ | new HubAction("My UDP Message", Protocol.LAN, [type: HubAction.Type.LAN_TYPE_UDPCLIENT]) | ||
+ | |||
+ | // Send Binary UDP Message | ||
+ | new HubAction("48756269746174", Protocol.LAN, [type: HubAction.Type.LAN_TYPE_UDPCLIENT, encoding: HubAction.Encoding.HEX_STRING]) | ||
+ | |||
+ | // Send Wake On Lan to mac address 00:11:22:33:44:55 | ||
new HubAction("wake on lan 00:11:22:33:44:55", Protocol.LAN) | new HubAction("wake on lan 00:11:22:33:44:55", Protocol.LAN) | ||
− | + | ||
− | //Send Wake On Lan to mac address 00:11:22:33:44:55 with secure code | + | // Send Wake On Lan to mac address 00:11:22:33:44:55 with secure code |
new HubAction("wake on lan 00:11:22:33:44:55", Protocol.LAN, [secureCode: "112233"]) | new HubAction("wake on lan 00:11:22:33:44:55", Protocol.LAN, [secureCode: "112233"]) | ||
− | |||
− | |||
− | |||
− | |||
− | |||
==<code>getAction</code>== | ==<code>getAction</code>== |
Revision as of 18:22, 1 March 2019
Constructors
Create a HubAction object. While protocol is optional, it is recommended that it be provided. If it is not specified the system will attempt to determine the protocol to use.
Signature:
HubAction() HubAction(String request) HubAction(String request, Protocol protocol, String dni) HubAction(String request, Protocol protocol, String dni, Map options) HubAction(String request, Protocol protocol) HubAction(String request, Protocol protocol, Map options) HubAction(Map params) HubAction(Map params, String dni) HubAction(Map params, String dni, Map options)
Parameters:
request - The command to send as a String, this can be a ZigBee, Z-Wave or Lan message to send. protocol - The protocol to use when sending the message. See the Protocol documentation for more info. dni - The device network Id to use when sending the message. options - Optional settings when sending the command. Possible values are callback, destinationAddress, destinationPort, type, secureCode, encoding. See examples for usage. params - a list of parameters for sending a Lan message.
Examples:
//Create and send a Z-Wave message def hubAction = new hubitat.device.HubAction(new hubitat.zwave.commands.basicv1.BasicGet().format(), hubitat.device.Protocol.ZWAVE) sendHubCommand(hubAction)
// Protocol.LAN examples // Send UDP Message new HubAction("My UDP Message", Protocol.LAN, [type: HubAction.Type.LAN_TYPE_UDPCLIENT]) // Send Binary UDP Message new HubAction("48756269746174", Protocol.LAN, [type: HubAction.Type.LAN_TYPE_UDPCLIENT, encoding: HubAction.Encoding.HEX_STRING]) // Send Wake On Lan to mac address 00:11:22:33:44:55 new HubAction("wake on lan 00:11:22:33:44:55", Protocol.LAN) // Send Wake On Lan to mac address 00:11:22:33:44:55 with secure code new HubAction("wake on lan 00:11:22:33:44:55", Protocol.LAN, [secureCode: "112233"])
getAction
Can be used to get the request value of the HubAction.
Signature
String getAction()
getCallbackMethod
Signature:
String getCallbackMethod()
getURI
Signature:
URI getURI()