Search in sources :

Example 1 with DeviceSensorValue

use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DeviceSensorValue in project smarthome by eclipse.

the class DeviceImpl method checkAndSetSensorValue.

private boolean checkAndSetSensorValue(Object obj, Integer dsValue, Float floatValue) {
    boolean isSet = false;
    if (obj != null) {
        DeviceSensorValue devSenVal = getDeviceSensorValueForSet(obj);
        if (devSenVal != null) {
            if (dsValue != null && floatValue != null) {
                isSet = devSenVal.setValues(floatValue, dsValue);
            } else if (dsValue != null) {
                isSet = devSenVal.setDsValue(dsValue);
            } else if (floatValue != null) {
                isSet = devSenVal.setFloatValue(floatValue);
            }
            logger.debug("check devSenVal {} isSet={}", devSenVal.toString(), isSet);
            checkSensorValueSet(devSenVal, isSet);
        }
    }
    return isSet;
}
Also used : DeviceSensorValue(org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DeviceSensorValue)

Example 2 with DeviceSensorValue

use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DeviceSensorValue in project smarthome by eclipse.

the class DeviceImpl method setDeviceSensorByEvent.

@Override
public void setDeviceSensorByEvent(EventItem event) {
    DeviceSensorValue devSenVal = new DeviceSensorValue(event.getProperties());
    if (devSenVal != null) {
        SensorEnum sensorType = devSenVal.getSensorType();
        if (!isEchoSensor(sensorType)) {
            logger.debug("Event is no echo, set values {} for sensorType {}", devSenVal, devSenVal.getSensorType());
            if (SensorEnum.isPowerSensor(sensorType) && getSensorDataReadingInitialized(sensorType)) {
                logger.debug("SensorJob was initialized, remove sensorjob for sensorType: {}", devSenVal.getSensorType());
                deviceStateUpdates.add(new DeviceStateUpdateImpl(sensorType, -1));
            }
            setDeviceSensorValue(devSenVal);
        } else {
            logger.debug("Event is echo remove sensorType {} from echoBox", devSenVal.getSensorType());
            sensorEchoBox.remove(devSenVal.getSensorType());
        }
    }
}
Also used : SensorEnum(org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.SensorEnum) DeviceStateUpdateImpl(org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DeviceStateUpdateImpl) DeviceSensorValue(org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DeviceSensorValue)

Aggregations

DeviceSensorValue (org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DeviceSensorValue)2 SensorEnum (org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.SensorEnum)1 DeviceStateUpdateImpl (org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DeviceStateUpdateImpl)1