use of com.tinkerforge.BrickletDualRelay.State in project openhab1-addons by openhab.
the class MDualRelayImpl method fetchSwitchState.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void fetchSwitchState() {
OnOffValue switchValue = OnOffValue.UNDEF;
try {
State state = getMbrick().getTinkerforgeDevice().getState();
if (relayNum == 1) {
switchValue = (state.relay1) ? OnOffValue.ON : OnOffValue.OFF;
} else {
switchValue = (state.relay2) ? OnOffValue.ON : OnOffValue.OFF;
}
setSwitchState(switchValue);
} catch (TimeoutException e) {
TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e);
} catch (NotConnectedException e) {
TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e);
}
setSwitchState(switchValue);
}
Aggregations