Search in sources :

Example 1 with LoadCellWeight

use of org.openhab.binding.tinkerforge.internal.model.LoadCellWeight in project openhab1-addons by openhab.

the class MBrickletLoadCellImpl method initSubDevices.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void initSubDevices() {
    ModelFactory factory = ModelFactory.eINSTANCE;
    LoadCellWeight weight = factory.createLoadCellWeight();
    weight.setUid(getUid());
    String subIdWeight = "weight";
    weight.setSubId(subIdWeight);
    logger.debug("{} addSubDevice {}", LoggerConstants.TFINIT, subIdWeight);
    weight.init();
    weight.setMbrick(this);
    LoadCellLed led = factory.createLoadCellLed();
    led.setUid(getUid());
    String subIdLed = "led";
    led.setSubId(subIdLed);
    logger.debug("{} addSubDevice {}", LoggerConstants.TFINIT, subIdLed);
    led.init();
    led.setMbrick(this);
}
Also used : ModelFactory(org.openhab.binding.tinkerforge.internal.model.ModelFactory) LoadCellWeight(org.openhab.binding.tinkerforge.internal.model.LoadCellWeight) LoadCellLed(org.openhab.binding.tinkerforge.internal.model.LoadCellLed)

Example 2 with LoadCellWeight

use of org.openhab.binding.tinkerforge.internal.model.LoadCellWeight in project openhab1-addons by openhab.

the class TinkerforgeContextImpl method tfLoadCellTare.

@Override
public boolean tfLoadCellTare(String uid) {
    if (ecosystem == null) {
        logger.error("tfLoadCellTare action failed ecosystem is null");
        return false;
    }
    MBaseDevice mDevice = ecosystem.getDevice(uid, "weight");
    if (mDevice instanceof LoadCellWeight) {
        logger.trace("load cell tare action");
        ((LoadCellWeight) mDevice).tare();
        return true;
    } else {
        logger.error("no Load Cell Bricklet found for uid {}", uid);
        return false;
    }
}
Also used : MBaseDevice(org.openhab.binding.tinkerforge.internal.model.MBaseDevice) LoadCellWeight(org.openhab.binding.tinkerforge.internal.model.LoadCellWeight)

Aggregations

LoadCellWeight (org.openhab.binding.tinkerforge.internal.model.LoadCellWeight)2 LoadCellLed (org.openhab.binding.tinkerforge.internal.model.LoadCellLed)1 MBaseDevice (org.openhab.binding.tinkerforge.internal.model.MBaseDevice)1 ModelFactory (org.openhab.binding.tinkerforge.internal.model.ModelFactory)1