Package nl.tue.id.oocsi.client.data

# Class OOCSIDevice

java.lang.Object
nl.tue.id.oocsi.client.data.OOCSIDevice

    public class OOCSIDevice
    extends java.lang.Object

OOCSIDevice allows to configure one or more devices for an OOCSI client that can be recognized by HomeAssistant (and the OOCSI server) and will then be displayed or treated otherwise in a semantically correct way.

Author:
  matsfunk

- ## Nested Class Summary

  Nested Classes
  Modifier and Type | Class | Description
  --- | --- | ---
  `static class` | `OOCSIDevice.BinarySensorType` | from: https://developers.home-assistant.io/docs/core/entity/binary-sensor/#available-device-classes
  `static class` | `OOCSIDevice.LedType` | from: ? Tbd.
  `static class` | `OOCSIDevice.LightSpectrum` | from: ? Tbd.
  `static class` | `OOCSIDevice.SensorType` | from: https://developers.home-assistant.io/docs/core/entity/sensor/#available-device-classes
  `static class` | `OOCSIDevice.SwitchType` | from: https://developers.home-assistant.io/docs/core/entity/switch/#available-device-classes

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `OOCSIDevice​(OOCSIClient client, java.lang.String deviceName)` | create a new OOCSI device

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `OOCSIDevice` | `addBinarySensor​(java.lang.String name, java.lang.String channel, java.lang.String sensorType, boolean sensorDefault, java.lang.String icon)` | add a binary sensor component to this device
  `OOCSIDevice` | `addBinarySensor​(java.lang.String name, java.lang.String channel, OOCSIDevice.BinarySensorType sensorType, boolean sensorDefault, java.lang.String icon)` | add a binary sensor component to this device
  `OOCSIDevice` | `addLight​(java.lang.String name, java.lang.String channel, java.lang.String lightType, java.lang.String spectrum, int min, int max, boolean lightDefault, int defaultBrightness, java.lang.String icon)` | add a sensor component to this device
  `OOCSIDevice` | `addLight​(java.lang.String name, java.lang.String channel, OOCSIDevice.LedType lightType, OOCSIDevice.LightSpectrum spectrum, int min, int max, boolean lightDefault, int defaultBrightness, java.lang.String icon)` | add a sensor component to this device
  `OOCSIDevice` | `addLocation​(java.lang.String name, float lat, float lng)` | add a device location
  `OOCSIDevice` | `addNumber​(java.lang.String name, java.lang.String channel, float min, float max, float numberDefault, java.lang.String icon)` | add a number component to this device
  `OOCSIDevice` | `addNumber​(java.lang.String name, java.lang.String channel, float min, float max, java.lang.String numberUnit, float numberDefault, java.lang.String icon)` | add a number component to this device
  `OOCSIDevice` | `addProperty​(java.lang.String name, java.lang.String value)` | add a device property
  `OOCSIDevice` | `addSensor​(java.lang.String name, java.lang.String channel, java.lang.String sensorType, java.lang.String sensorUnit, float sensorDefault, java.lang.String icon)` | add a sensor component to this device
  `OOCSIDevice` | `addSensor​(java.lang.String name, java.lang.String channel, OOCSIDevice.SensorType sensorType, java.lang.String sensorUnit, float sensorDefault, java.lang.String icon)` | add a sensor component to this device
  `OOCSIDevice` | `addSwitch​(java.lang.String name, java.lang.String channel, java.lang.String switchType, boolean switchDefault, java.lang.String icon)` | add a switch component to this device
  `OOCSIDevice` | `addSwitch​(java.lang.String name, java.lang.String channel, OOCSIDevice.SwitchType switchType, boolean switchDefault, java.lang.String icon)` | add a switch component to this device
  `boolean` | `getState​(boolean defaultValue)` | retrieve the currently set state for the only component -- or default value
  `boolean` | `getStateOfComponent​(java.lang.String componentName, boolean defaultValue)` | retrieve the currently set state for the given component -- or default value
  `float` | `getValue​(float defaultValue)` | retrieve the currently set value for the only component -- or default value
  `float` | `getValue​(java.lang.String key, float defaultValue)` | retrieve the currently set value for a given key for the only component -- or default value
  `float` | `getValueOfComponent​(java.lang.String componentName, float defaultValue)` | retrieve the currently set default value for the given component -- or default value
  `float` | `getValueOfComponent​(java.lang.String componentName, java.lang.String key, float defaultValue)` | retrieve the currently set value for the given component and key -- or default value
  `void` | `sayHi()` | alternative call for submit()
  `void` | `setState​(boolean state)` | set the default value for the only component
  `void` | `setValue​(java.lang.Number value)` | set the default value for the only component
  `void` | `setValue​(java.lang.String value)` | set the default value for the only component
  `void` | `setValue​(java.lang.String key, java.lang.Number value)` | set the value for a given key for the only component
  `void` | `setValue​(java.lang.String key, java.lang.String value)` | set the value for a given key for the only component
  `void` | `setValueForComponent​(java.lang.String componentName, java.lang.Number value)` | set the default value for the given component
  `void` | `setValueForComponent​(java.lang.String componentName, java.lang.String value)` | set the default value for the given component
  `void` | `setValueForComponent​(java.lang.String componentName, java.lang.String key, boolean value)` | set a value for the given component
  `void` | `setValueForComponent​(java.lang.String componentName, java.lang.String key, java.lang.Number value)` | set a value for the given component
  `void` | `setValueForComponent​(java.lang.String componentName, java.lang.String key, java.lang.String value)` | set a value for the given component
  `void` | `submit()` | submit the heyOOCSI! message to the server

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### OOCSIDevice

    public OOCSIDevice​(OOCSIClient client, java.lang.String deviceName)
    create a new OOCSI device
    Parameters:
      `client` -
      `deviceName` -

- ## Method Details

  - ### addProperty

    public OOCSIDevice addProperty​(java.lang.String name, java.lang.String value)
    add a device property
    Parameters:
      `name` -
      `value` -
    Returns:

  - ### addLocation

    public OOCSIDevice addLocation​(java.lang.String name, float lat, float lng)
    add a device location
    Parameters:
      `name` -
      `lat` -
      `lng` -
    Returns:

  - ### addNumber

    public OOCSIDevice addNumber​(java.lang.String name, java.lang.String channel, float min, float max, float numberDefault, java.lang.String icon)
    add a number component to this device
    Parameters:
      `name` -
      `channel` -
      `min` -
      `max` -
      `numberDefault` -
      `icon` - Get an icon from the set at: https://materialdesignicons.com/ Copy the title of the icon page
    Returns:

  - ### addNumber

    public OOCSIDevice addNumber​(java.lang.String name, java.lang.String channel, float min, float max, java.lang.String numberUnit, float numberDefault, java.lang.String icon)
    add a number component to this device
    Parameters:
      `name` -
      `channel` -
      `min` -
      `max` -
      `numberUnit` -
      `numberDefault` -
      `icon` - Get an icon from the set at: https://materialdesignicons.com/ Copy the title of the icon page
    Returns:

  - ### addSensor

    public OOCSIDevice addSensor​(java.lang.String name, java.lang.String channel, java.lang.String sensorType, java.lang.String sensorUnit, float sensorDefault, java.lang.String icon)
    add a sensor component to this device
    Parameters:
      `name` -
      `channel` -
      `sensorType` -
      `sensorUnit` -
      `sensorDefault` -
      `icon` - Get an icon from the set at: https://materialdesignicons.com/ Copy the title of the icon page
    Returns:

  - ### addSensor

    public OOCSIDevice addSensor​(java.lang.String name, java.lang.String channel, OOCSIDevice.SensorType sensorType, java.lang.String sensorUnit, float sensorDefault, java.lang.String icon)
    add a sensor component to this device
    Parameters:
      `name` -
      `channel` -
      `sensorType` -
      `sensorUnit` -
      `sensorDefault` -
      `icon` - Get an icon from the set at: https://materialdesignicons.com/ Copy the title of the icon page
    Returns:

  - ### addBinarySensor

    public OOCSIDevice addBinarySensor​(java.lang.String name, java.lang.String channel, java.lang.String sensorType, boolean sensorDefault, java.lang.String icon)
    add a binary sensor component to this device
    Parameters:
      `name` -
      `channel` -
      `sensorType` -
      `sensorDefault` -
      `icon` - Get an icon from the set at: https://materialdesignicons.com/ Copy the title of the icon page
    Returns:

  - ### addBinarySensor

    public OOCSIDevice addBinarySensor​(java.lang.String name, java.lang.String channel, OOCSIDevice.BinarySensorType sensorType, boolean sensorDefault, java.lang.String icon)
    add a binary sensor component to this device
    Parameters:
      `name` -
      `channel` -
      `sensorType` -
      `sensorDefault` -
      `icon` - Get an icon from the set at: https://materialdesignicons.com/ Copy the title of the icon page
    Returns:

  - ### addSwitch

    public OOCSIDevice addSwitch​(java.lang.String name, java.lang.String channel, java.lang.String switchType, boolean switchDefault, java.lang.String icon)
    add a switch component to this device
    Parameters:
      `name` -
      `channel` -
      `switchType` -
      `switchDefault` -
      `icon` - Get an icon from the set at: https://materialdesignicons.com/ Copy the title of the icon page
    Returns:

  - ### addSwitch

    public OOCSIDevice addSwitch​(java.lang.String name, java.lang.String channel, OOCSIDevice.SwitchType switchType, boolean switchDefault, java.lang.String icon)
    add a switch component to this device
    Parameters:
      `name` -
      `channel` -
      `switchType` -
      `switchDefault` -
      `icon` - Get an icon from the set at: https://materialdesignicons.com/ Copy the title of the icon page
    Returns:

  - ### addLight

    public OOCSIDevice addLight​(java.lang.String name, java.lang.String channel, java.lang.String lightType, java.lang.String spectrum, int min, int max, boolean lightDefault, int defaultBrightness, java.lang.String icon)
    add a sensor component to this device
    Parameters:
      `name` -
      `channel` -
      `lightType` -
      `spectrum` -
      `min` -
      `max` -
      `lightDefault` -
      `defaultBrightness` -
      `icon` - Get an icon from the set at: https://materialdesignicons.com/ Copy the title of the icon page
    Returns:

  - ### addLight

    public OOCSIDevice addLight​(java.lang.String name, java.lang.String channel, OOCSIDevice.LedType lightType, OOCSIDevice.LightSpectrum spectrum, int min, int max, boolean lightDefault, int defaultBrightness, java.lang.String icon)
    add a sensor component to this device
    Parameters:
      `name` -
      `channel` -
      `lightType` -
      `spectrum` -
      `min` -
      `max` -
      `lightDefault` -
      `defaultBrightness` -
      `icon` - Get an icon from the set at: https://materialdesignicons.com/ Copy the title of the icon page
    Returns:

  - ### submit

    public void submit()
    submit the heyOOCSI! message to the server

  - ### sayHi

    public void sayHi()
    alternative call for submit()

  - ### getState

    public boolean getState​(boolean defaultValue)
    retrieve the currently set state for the only component -- or default value
    Parameters:
      `defaultValue` -
    Returns:

  - ### getStateOfComponent

    public boolean getStateOfComponent​(java.lang.String componentName, boolean defaultValue)
    retrieve the currently set state for the given component -- or default value
    Parameters:
      `defaultValue` -
    Returns:

  - ### getValue

    public float getValue​(float defaultValue)
    retrieve the currently set value for the only component -- or default value
    Parameters:
      `defaultValue` -
    Returns:

  - ### getValue

    public float getValue​(java.lang.String key, float defaultValue)
    retrieve the currently set value for a given key for the only component -- or default value
    Parameters:
      `defaultValue` -
    Returns:

  - ### getValueOfComponent

    public float getValueOfComponent​(java.lang.String componentName, float defaultValue)
    retrieve the currently set default value for the given component -- or default value
    Parameters:
      `componentName` -
      `defaultValue` -
    Returns:

  - ### getValueOfComponent

    public float getValueOfComponent​(java.lang.String componentName, java.lang.String key, float defaultValue)
    retrieve the currently set value for the given component and key -- or default value
    Parameters:
      `componentName` -
      `key` -
      `defaultValue` -
    Returns:

  - ### setState

    public void setState​(boolean state)
    set the default value for the only component
    Parameters:
      `state` -

  - ### setValue

    public void setValue​(java.lang.Number value)
    set the default value for the only component
    Parameters:
      `value` -

  - ### setValue

    public void setValue​(java.lang.String value)
    set the default value for the only component
    Parameters:
      `value` -

  - ### setValue

    public void setValue​(java.lang.String key, java.lang.Number value)
    set the value for a given key for the only component
    Parameters:
      `key` -
      `value` -

  - ### setValue

    public void setValue​(java.lang.String key, java.lang.String value)
    set the value for a given key for the only component
    Parameters:
      `key` -
      `value` -

  - ### setValueForComponent

    public void setValueForComponent​(java.lang.String componentName, java.lang.Number value)
    set the default value for the given component
    Parameters:
      `componentName` -
      `value` -

  - ### setValueForComponent

    public void setValueForComponent​(java.lang.String componentName, java.lang.String value)
    set the default value for the given component
    Parameters:
      `componentName` -
      `value` -

  - ### setValueForComponent

    public void setValueForComponent​(java.lang.String componentName, java.lang.String key, boolean value)
    set a value for the given component
    Parameters:
      `componentName` -
      `key` -
      `value` -

  - ### setValueForComponent

    public void setValueForComponent​(java.lang.String componentName, java.lang.String key, java.lang.Number value)
    set a value for the given component
    Parameters:
      `componentName` -
      `key` -
      `value` -

  - ### setValueForComponent

    public void setValueForComponent​(java.lang.String componentName, java.lang.String key, java.lang.String value)
    set a value for the given component
    Parameters:
      `componentName` -
      `key` -
      `value` -