Package io.github.zeroone3010.yahueapi
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.URLbaseUrlprotected java.lang.Stringidprotected java.lang.Stringnameprotected java.lang.StringproductNameprotected SensorTypetype -
Method Summary
Modifier and Type Method Description java.lang.StringgetId()Returns the id of the sensor, as assigned by the Bridge.java.time.ZonedDateTimegetLastUpdated()Returns the last time the sensor status has been updated, or null if it has not been updated.intgetLightLevel()Returns the current light level in lux.java.lang.StringgetName()Returns the human readable name of the sensor as set by the user, e.g.java.lang.StringgetProductName()Returns the human readable name of the sensor product, e.g.SensorTypegetType()Returns the type of the sensor.booleanisDark()Tells whether the current light level is below darkness threshold.booleanisDaylight()Tells whether the current light level is above light threshold.protected <T> TreadStateValue(java.lang.String stateValueKey, java.lang.Class<T> type)java.lang.StringtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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
-
-
Method Details
-
toString
public java.lang.String toString() -
getLightLevel
public int getLightLevel()Description copied from interface:AmbientLightSensorReturns the current light level in lux.- Specified by:
getLightLevelin interfaceAmbientLightSensor- Returns:
- A
intindicating the current light level in lux.
-
isDaylight
public boolean isDaylight()Description copied from interface:AmbientLightSensorTells whether the current light level is above light threshold.- Specified by:
isDaylightin interfaceAmbientLightSensor- Returns:
trueif above light threshold,falseif not.
-
isDark
public boolean isDark()Description copied from interface:AmbientLightSensorTells whether the current light level is below darkness threshold.- Specified by:
isDarkin interfaceAmbientLightSensor- Returns:
trueif below darkness threshold,falseif not.
-
getName
public java.lang.String getName()Description copied from interface:SensorReturns the human readable name of the sensor as set by the user, e.g. "Living room switch". -
getProductName
public java.lang.String getProductName()Description copied from interface:SensorReturns the human readable name of the sensor product, e.g. "Hue motion sensor" or "Hue tap switch".- Specified by:
getProductNamein interfaceSensor- Returns:
- Name of the sensor product. May be null.
-
getId
public java.lang.String getId()Description copied from interface:SensorReturns the id of the sensor, as assigned by the Bridge. -
getType
Description copied from interface:SensorReturns the type of the sensor. -
getLastUpdated
public java.time.ZonedDateTime getLastUpdated()Description copied from interface:SensorReturns the last time the sensor status has been updated, or null if it has not been updated.- Specified by:
getLastUpdatedin interfaceSensor- 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)
-