use of org.eclipse.smarthome.core.library.types.PercentType in project smarthome by eclipse.
the class LifxLightHandler method handleIncreaseDecreaseTemperatureCommand.
private void handleIncreaseDecreaseTemperatureCommand(IncreaseDecreaseType increaseDecrease) {
PercentType baseTemperature = getLightStateForCommand().getNullSafeColor().getTemperature();
PercentType newTemperature = increaseDecreasePercentType(increaseDecrease, baseTemperature);
handleTemperatureCommand(newTemperature);
}
use of org.eclipse.smarthome.core.library.types.PercentType in project smarthome by eclipse.
the class LifxLightHandler method handleIncreaseDecreaseCommand.
private void handleIncreaseDecreaseCommand(IncreaseDecreaseType increaseDecrease) {
HSBK baseColor = getLightStateForCommand().getNullSafeColor();
PercentType newBrightness = increaseDecreasePercentType(increaseDecrease, baseColor.getHSB().getBrightness());
handlePercentCommand(newBrightness);
}
use of org.eclipse.smarthome.core.library.types.PercentType in project smarthome by eclipse.
the class LifxLightHandler method handleIncreaseDecreaseTemperatureCommand.
private void handleIncreaseDecreaseTemperatureCommand(IncreaseDecreaseType increaseDecrease, int zoneIndex) {
PercentType baseTemperature = getLightStateForCommand().getNullSafeColor(zoneIndex).getTemperature();
PercentType newTemperature = increaseDecreasePercentType(increaseDecrease, baseTemperature);
handleTemperatureCommand(newTemperature, zoneIndex);
}
use of org.eclipse.smarthome.core.library.types.PercentType in project smarthome by eclipse.
the class LifxLightState method setInfrared.
public void setInfrared(PercentType newInfrared) {
PercentType oldInfrared = this.infrared;
this.infrared = newInfrared;
updateLastChange();
listeners.forEach(listener -> listener.handleInfraredChange(oldInfrared, newInfrared));
}
use of org.eclipse.smarthome.core.library.types.PercentType in project smarthome by eclipse.
the class HueLightHandler method onLightStateChanged.
@Override
public void onLightStateChanged(@Nullable HueBridge bridge, FullLight fullLight) {
logger.trace("onLightStateChanged() was called");
if (!fullLight.getId().equals(lightId)) {
logger.trace("Received state change for another handler's light ({}). Will be ignored.", fullLight.getId());
return;
}
initializeProperties();
lastSentColorTemp = null;
lastSentBrightness = null;
// update status (ONLINE, OFFLINE)
if (fullLight.getState().isReachable()) {
updateStatus(ThingStatus.ONLINE);
} else {
// we assume OFFLINE without any error (NONE), as this is an
// expected state (when bulb powered off)
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "@text/offline.light-not-reachable");
}
HSBType hsbType = LightStateConverter.toHSBType(fullLight.getState());
if (!fullLight.getState().isOn()) {
hsbType = new HSBType(hsbType.getHue(), hsbType.getSaturation(), new PercentType(0));
}
updateState(CHANNEL_COLOR, hsbType);
PercentType percentType = LightStateConverter.toColorTemperaturePercentType(fullLight.getState());
updateState(CHANNEL_COLORTEMPERATURE, percentType);
percentType = LightStateConverter.toBrightnessPercentType(fullLight.getState());
if (!fullLight.getState().isOn()) {
percentType = new PercentType(0);
}
updateState(CHANNEL_BRIGHTNESS, percentType);
if (fullLight.getState().isOn()) {
updateState(CHANNEL_SWITCH, OnOffType.ON);
} else {
updateState(CHANNEL_SWITCH, OnOffType.OFF);
}
StringType stringType = LightStateConverter.toAlertStringType(fullLight.getState());
if (!stringType.toString().equals("NULL")) {
updateState(CHANNEL_ALERT, stringType);
scheduleAlertStateRestore(stringType);
}
}
Aggregations