use of com.tinkerforge.BrickletLEDStrip.RGBValues in project openhab1-addons by openhab.
the class LEDGroupImpl method fetchSwitchState.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void fetchSwitchState() {
if (ledList.getTrackingled() != null) {
try {
RGBValues rgbValues = tinkerforgeDevice.getRGBValues(ledList.getTrackingled(), (short) 1);
short[] r = rgbValues.r;
short[] g = rgbValues.g;
short[] b = rgbValues.b;
if (r[0] == 0 && g[0] == 0 && b[0] == 0) {
setSwitchState(OnOffValue.OFF);
} else {
setSwitchState(OnOffValue.ON);
}
} catch (TimeoutException e) {
TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e);
} catch (NotConnectedException e) {
TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e);
}
} else {
setSwitchState(OnOffValue.UNDEF);
}
}
Aggregations