use of org.openhab.binding.tinkerforge.internal.types.PercentValue in project openhab1-addons by openhab.
the class RemoteSwitchBImpl method setPercentValue.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setPercentValue(PercentValue newPercentValue) {
PercentValue oldPercentValue = percentValue;
percentValue = newPercentValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.REMOTE_SWITCH_B__PERCENT_VALUE, oldPercentValue, percentValue));
}
use of org.openhab.binding.tinkerforge.internal.types.PercentValue in project openhab1-addons by openhab.
the class RemoteSwitchBImpl method setSensorValue.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setSensorValue(PercentValue newSensorValue) {
PercentValue oldSensorValue = sensorValue;
sensorValue = newSensorValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.REMOTE_SWITCH_B__SENSOR_VALUE, oldSensorValue, sensorValue));
}
use of org.openhab.binding.tinkerforge.internal.types.PercentValue in project openhab1-addons by openhab.
the class MBrickDCImpl method setValue.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void setValue(PercentType percentValue, DeviceOptions opts) {
BigDecimal max = Tools.getBigDecimalOpt(ConfigOptsDimmable.MAX.toString(), opts);
if (max == null) {
logger.error("BrickDC dimmer option max is missing, items configuration has to be fixed!");
return;
} else {
logger.debug("Brick DC max {}", max);
}
BigDecimal min = Tools.getBigDecimalOpt(ConfigOptsDimmable.MIN.toString(), opts);
logger.debug("Brick DC min {}", min);
if (min == null) {
logger.error("BrickDC dimmer option min is missing, items configuration has to be fixed!");
return;
}
setPercentValue(new PercentValue(percentValue.toBigDecimal()));
BigDecimal abs = max.add(min.abs());
Short newVelocity = abs.divide(new BigDecimal(100)).multiply(percentValue.toBigDecimal()).subtract(min.abs()).shortValue();
setPoint(newVelocity, opts);
}
use of org.openhab.binding.tinkerforge.internal.types.PercentValue in project openhab1-addons by openhab.
the class MBrickDCImpl method setPercentValue.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setPercentValue(PercentValue newPercentValue) {
PercentValue oldPercentValue = percentValue;
percentValue = newPercentValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MBRICK_DC__PERCENT_VALUE, oldPercentValue, percentValue));
}
use of org.openhab.binding.tinkerforge.internal.types.PercentValue in project openhab1-addons by openhab.
the class MServoImpl method setValue.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void setValue(PercentType newPercentValue, DeviceOptions opts) {
BigDecimal max = Tools.getBigDecimalOpt(ConfigOptsDimmable.MAX.toString(), opts);
if (max == null) {
logger.error("dimmer option max is missing, items configuration has to be fixed!");
return;
} else {
logger.debug("max {}", max);
}
BigDecimal min = Tools.getBigDecimalOpt(ConfigOptsDimmable.MIN.toString(), opts);
logger.debug("min {}", min);
if (min == null) {
logger.error("dimmer option min is missing, items configuration has to be fixed!");
return;
}
setPercentValue(new PercentValue(newPercentValue.toBigDecimal()));
// TODO this is only valid if min has a value < 0
BigDecimal abs = max.add(min.abs());
Short newVelocity = abs.divide(new BigDecimal(100)).multiply(newPercentValue.toBigDecimal()).subtract(min.abs()).shortValue();
setPoint(newVelocity, opts);
}
Aggregations