These methods are available for use in driver code.
Creates a new child device and returns that device from the method call.
ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Map properties = [:])
ChildDeviceWrapper addChildDevice(String typeName, String deviceNetworkId, Map properties = [:])
namespace
- The namespace of the child driver to add as a child device (optional, if not specified it will default the the namespace of the parent)
typeName
- The name of the child driver to add as a child device
deviceNetworkId
- unique identifier for this device
properties
- optional parameters for this child device. Possible values:
boolean isComponent
- true or false, if true, device will still show up in device list but will not be able to be deleted or edited in the UI. If false, device can be modified/deleted on the UI.
String name
- name of child device, if not specified, driver name is used.
String label
- label of child device, if not specified it is left blank.
ChildDeviceWrapper
Gets a list of all child devices for this device.
List<ChildDeviceWrapper> getChildDevices()
None
List<ChildDeviceWrapper>
Gets a specific child device with the device network id specified.
ChildDeviceWrapper getChildDevice(String deviceNetworkId)
deviceNetworkId
- The unique identifier for the deviceChildDeviceWrapper
Deletes a specific child device with the device network id sepcified.
void deleteChildDevice(String deviceNetworkId)
deviceNetworkId
- The unique identifier for the deviceNone
Returns the parent device (ParentDeviceWrapper
) or app (InstalledAppWrapper
) when called from a child device.
Object getParent()
The ParentDeviceWrapper
or InstalledAppWrapper
Get a data value that was set for this device.
String getDataValue(String name)
name
- The String value of the data item.String
- The value of the data.
DEPRECATED: See getDataValue
; this method is a wrapper for getDataValue.
Update or create a data value for this device.
void updateDataValue(String name, String value)
name
- The name of the data item to store.
value
- The value of the data item to store.
None.
Remove a data value from a device.
void removeDataValue(String name)
(Since 2.2.1)name
- The name of the data item to remove.None.
Use this method to send a HubAction immediately.
void sendHubCommand(HubAction hubAction)
hubAction
- The HubAction object to send.none
Changes the value of an attribute (from which the platform will typically generate an event) based on the values in the provided map.
void sendEvent(Map properties)
properties
- a Map
of properties for the event. Valid keys are:
String name
(required) - name of the event (normally the an name of a device attribute)value
(required) - value of the event (data type should match the type defined for the attribute as defined by either the capability or custom attribute type)String unit
- units corresponding to the value (e.g., could be "%"
for level
or omitted for switch
)String descriptionText
- a human-friendly description of the event, optional but often provided in a format like "[Device name] [event name] is [event value]," possibly with additional information, e.g., "Living Room Dimmer level is 50%" or "Bedroom Button pushed is 1 [phyiscal]".Boolean isStateChange
- set to true
to force an event to be generated even if the new value is the same as the old value (optional and usually omitted in favor of default platform filtering; button events are one case where it is often needed)sendEvent(name: "colorTemperature", value: 2700, unit: "K")
none
For callback methods (that will be executed in response to certain actions in the Hubitat environment) and more on driver code, see: Device Code.
Map getState()
Zwave getZwave()
Zigbee getZigbee()
HubAction response(String cmd)
HubAction response(hubitat.zwave.Command cmd)
HubMultiAction response(List cmds)
Short getZwaveHubNodeId()
List
eventsSince(Date startDate, Map options = null)
void telnetConnect(Map options, String ip, int port, String username, String password)
void telnetConnect(String ip, int port, String username, String password)
void telnetClose()
Map createEvent(Map options)
List
delayBetween(List
cmds, Long delay)
List
delayBetween(List
cmds)