java.lang.Object
org.openremote.agent.protocol.tradfri.device.Device
Direct Known Subclasses:
Light, Plug

public class Device extends Object
The class that represents an IKEA TRÃ…DFRI device
  • Field Details

    • coapClient

      protected CoapClient coapClient
      A CoAP client that can be used to communicate with the device using the IKEA TRÃ…DFRI gateway
  • Constructor Details

    • Device

      public Device(String name, Long creationDate, Integer instanceId, DeviceInfo deviceInfo, CoapClient coapClient)
      Construct the Device class
      Parameters:
      name - The name of the device
      creationDate - The creation date of the device
      instanceId - The instance id of the device
      deviceInfo - The information of the device
      coapClient - A CoAP client that can be used to communicate with the device using the IKEA TRÃ…DFRI gateway
  • Method Details

    • getName

      public String getName()
      Get the name of the device
      Returns:
      The name of the device
    • getCreationDate

      public Long getCreationDate()
      Get the creation date of the device
      Returns:
      The creation date of the device
    • getInstanceId

      public Integer getInstanceId()
      Get the instance id of the device
      Returns:
      The instance id of the device
    • getDeviceInfo

      public DeviceInfo getDeviceInfo()
      Get the information of the device
      Returns:
      The information of the device
    • setName

      public void setName(String name)
      Set the name of the device
      Parameters:
      name - The name of the device
    • setCreationDate

      public void setCreationDate(Long creationDate)
      Set the creation date of the device
      Parameters:
      creationDate - The creation date of the device
    • setInstanceId

      public void setInstanceId(Integer instanceId)
      Set the instance id of the device
      Parameters:
      instanceId - The instance id of the device
    • getProperties

      public DeviceProperties getProperties()
      Get the properties of the device
      Returns:
      The properties of the device
    • setProperties

      public void setProperties(DeviceProperties properties)
      Set the properties of the device
      Parameters:
      properties - The properties of the device
    • getEndpoint

      public String getEndpoint()
      Get the CoAP endpoint of the device
      Returns:
      The CoAP endpoint of the device
    • enableObserve

      public boolean enableObserve()
      Enable observe to automagically detect changes to the device
      Returns:
      True if successfully enabled observe, false if not
    • disableObserve

      public boolean disableObserve()
      Disable observe
      Returns:
      True if successfully disabled observe, false if not
    • getEventHandlers

      public List<EventHandler<?>> getEventHandlers()
      Get a list of event handlers for the device
      Returns:
      A list of event handlers for the device
    • addEventHandler

      public void addEventHandler(EventHandler<?> eventHandler)
      Add an event handler to the device
      Parameters:
      eventHandler - The event handler to add to the device
    • removeEventHandler

      public void removeEventHandler(EventHandler<?> eventHandler)
      Remove an event handler from the device
      Parameters:
      eventHandler - The event handler to remove from the device
    • isLight

      public boolean isLight()
      Check if the device is a Light
      Returns:
      True if the device is a Light, false if not
    • toLight

      public Light toLight()
      Convert the device to the Light class
      Returns:
      The device as Light
    • isPlug

      public boolean isPlug()
      Check if the device is a Plug
      Returns:
      True if the device is a Plug, false if not
    • toPlug

      public Plug toPlug()
      Convert the device to the Plug class
      Returns:
      The device as Plug