Creates a new device instance.
A DTO with device data received from Hubitat's Maker API.
A reference to the HubitatApiService so that the device can send device commands to the Hubitat hub.
A reference to the HubitatDevicesService so that the device can announce it's attribute changes.
A unique id of the device.
A label of the device.
A name of the device.
Returns a value of an attribute with specified name.
The name of the attribute.
Returns a value of an attribute or undefined
if
there is no such attribute.
Gets a value of the attribute as a floating point number.
Name of the attribute.
Returns a value of the attribute as a floating number. Returns 0
if there's no such attribute or its value is not parsable.
Gets a value of the attribute as an integer.
Name of the attribute.
Returns a value of the attribute as an integer. Returns 0
if
there's no such attribute or its value is not parsable.
Gets a value of the attribute as a string.
Name of the attribute.
Gets a value of the attribute as a string. Returns undefined
if
there's no such attribute or its value is empty.
Returns a list of all attribute names and their values.
Returns a list of all attribute names and their values. The list can be empty.
Returns a value whether the device contains an attribute with the specified name.
The name of the attribute.
true
if the device has the attribute; false
if the device
doesn't have the attribute.
Returns a value whether the device contains all of the specified capabilities.
A collection of capabilities to look for.
true
if the device has all the specified capabilities;
false
if the device doesn't have all of the specified capabilities.
Returns a value whether the device contains the specified capability
The capability to check for.
true
if the device has the capability; false
if the device
doesn't have the capability.
Returns a value whether the device supports the specified command.
A command string.
true
if the device supports the specified command;
false
if the device doesn't support the specified command.
Sends a command to the device on Hubitat.
A command string to send.
An optional value to send.
Sets a value of an attribute and emits (announces) the device update event if the value has changed.
A name of the attribute.
A new value of the attribute.
If set to true
it will announce the device
update event regardless whether the value changed or not.
Updates the device with data from provided device.
A device to copy data from.
If set to true
, it will force
the device update event to be emitted. It's false
by default.
Generated using TypeDoc
A representation of a Hubitat's device.