Class AmbientLightSensorImpl

java.lang.Object
io.github.zeroone3010.yahueapi.AmbientLightSensorImpl
All Implemented Interfaces:
AmbientLightSensor, Sensor

public class AmbientLightSensorImpl
extends java.lang.Object
implements AmbientLightSensor
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.net.URL baseUrl  
    protected java.lang.String id  
    protected java.lang.String name  
    protected java.lang.String productName  
    protected SensorType type  
  • Method Summary

    Modifier and Type Method Description
    java.lang.String getId()
    Returns the id of the sensor, as assigned by the Bridge.
    java.time.ZonedDateTime getLastUpdated()
    Returns the last time the sensor status has been updated, or null if it has not been updated.
    int getLightLevel()
    Returns the current light level in lux.
    java.lang.String getName()
    Returns the human readable name of the sensor as set by the user, e.g.
    java.lang.String getProductName()
    Returns the human readable name of the sensor product, e.g.
    SensorType getType()
    Returns the type of the sensor.
    boolean isDark()
    Tells whether the current light level is below darkness threshold.
    boolean isDaylight()
    Tells whether the current light level is above light threshold.
    protected <T> T readStateValue​(java.lang.String stateValueKey, java.lang.Class<T> type)  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface io.github.zeroone3010.yahueapi.Sensor

    getId, getLastUpdated, getName, getProductName, getType
  • Field Details

    • id

      protected final java.lang.String id
    • name

      protected final java.lang.String name
    • productName

      protected final java.lang.String productName
    • baseUrl

      protected final java.net.URL baseUrl
    • type

      protected final SensorType type
  • Method Details

    • toString

      public java.lang.String toString()
    • getLightLevel

      public int getLightLevel()
      Description copied from interface: AmbientLightSensor
      Returns the current light level in lux.
      Specified by:
      getLightLevel in interface AmbientLightSensor
      Returns:
      A int indicating the current light level in lux.
    • isDaylight

      public boolean isDaylight()
      Description copied from interface: AmbientLightSensor
      Tells whether the current light level is above light threshold.
      Specified by:
      isDaylight in interface AmbientLightSensor
      Returns:
      true if above light threshold, false if not.
    • isDark

      public boolean isDark()
      Description copied from interface: AmbientLightSensor
      Tells whether the current light level is below darkness threshold.
      Specified by:
      isDark in interface AmbientLightSensor
      Returns:
      true if below darkness threshold, false if not.
    • getName

      public java.lang.String getName()
      Description copied from interface: Sensor
      Returns the human readable name of the sensor as set by the user, e.g. "Living room switch".
      Specified by:
      getName in interface Sensor
      Returns:
      Name of the sensor.
    • getProductName

      public java.lang.String getProductName()
      Description copied from interface: Sensor
      Returns the human readable name of the sensor product, e.g. "Hue motion sensor" or "Hue tap switch".
      Specified by:
      getProductName in interface Sensor
      Returns:
      Name of the sensor product. May be null.
    • getId

      public java.lang.String getId()
      Description copied from interface: Sensor
      Returns the id of the sensor, as assigned by the Bridge.
      Specified by:
      getId in interface Sensor
      Returns:
      The sensor id.
    • getType

      public SensorType getType()
      Description copied from interface: Sensor
      Returns the type of the sensor.
      Specified by:
      getType in interface Sensor
      Returns:
      The type of the sensor as a SensorType enumeration value.
    • getLastUpdated

      public java.time.ZonedDateTime getLastUpdated()
      Description copied from interface: Sensor
      Returns the last time the sensor status has been updated, or null if it has not been updated.
      Specified by:
      getLastUpdated in interface Sensor
      Returns:
      The time when the sensor status was last updated, or null.
    • readStateValue

      protected <T> T readStateValue​(java.lang.String stateValueKey, java.lang.Class<T> type)