use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.SensorEnum 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());
}
}
}
use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.SensorEnum in project smarthome by eclipse.
the class DeviceImpl method updateInternalDeviceState.
@Override
public synchronized void updateInternalDeviceState(DeviceStateUpdate deviceStateUpdate) {
if (deviceStateUpdate != null) {
logger.debug("internal set outputvalue");
switch(deviceStateUpdate.getType()) {
case DeviceStateUpdate.OUTPUT_DECREASE:
deviceStateUpdate = new DeviceStateUpdateImpl(DeviceStateUpdate.OUTPUT_DECREASE, internalSetOutputValue(outputValue - getDimmStep()));
break;
case DeviceStateUpdate.OUTPUT_INCREASE:
deviceStateUpdate = new DeviceStateUpdateImpl(DeviceStateUpdate.OUTPUT_INCREASE, internalSetOutputValue(outputValue + getDimmStep()));
break;
case DeviceStateUpdate.OUTPUT:
internalSetOutputValue(deviceStateUpdate.getValueAsInteger());
break;
case DeviceStateUpdate.ON_OFF:
if (deviceStateUpdate.getValueAsInteger() < 0) {
internalSetOutputValue(0);
} else {
internalSetOutputValue(maxOutputValue);
}
break;
case DeviceStateUpdate.OPEN_CLOSE:
if (deviceStateUpdate.getValueAsInteger() < 0) {
internalSetOutputValue(0);
} else {
internalSetOutputValue(maxSlatPosition);
}
break;
case DeviceStateUpdate.OPEN_CLOSE_ANGLE:
if (deviceStateUpdate.getValueAsInteger() < 0) {
internalSetAngleValue(0);
} else {
internalSetAngleValue(maxSlatAngle);
}
break;
case DeviceStateUpdate.SLAT_DECREASE:
deviceStateUpdate = new DeviceStateUpdateImpl(DeviceStateUpdate.SLAT_DECREASE, internalSetOutputValue(slatPosition - getDimmStep()));
break;
case DeviceStateUpdate.SLAT_INCREASE:
deviceStateUpdate = new DeviceStateUpdateImpl(DeviceStateUpdate.SLAT_INCREASE, internalSetOutputValue(slatPosition + getDimmStep()));
case DeviceStateUpdate.SLATPOSITION:
internalSetOutputValue(deviceStateUpdate.getValueAsInteger());
break;
case DeviceStateUpdate.SLAT_ANGLE_DECREASE:
deviceStateUpdate = new DeviceStateUpdateImpl(DeviceStateUpdate.SLAT_ANGLE_DECREASE, internalSetAngleValue(slatAngle - DeviceConstants.ANGLE_STEP_SLAT));
break;
case DeviceStateUpdate.SLAT_ANGLE_INCREASE:
deviceStateUpdate = new DeviceStateUpdateImpl(DeviceStateUpdate.SLAT_ANGLE_INCREASE, internalSetAngleValue(slatAngle + DeviceConstants.ANGLE_STEP_SLAT));
break;
case DeviceStateUpdate.SLAT_ANGLE:
internalSetAngleValue(deviceStateUpdate.getValueAsInteger());
break;
case DeviceStateUpdate.UPDATE_CALL_SCENE:
this.internalCallScene(deviceStateUpdate.getValueAsShort());
return;
case DeviceStateUpdate.UPDATE_UNDO_SCENE:
this.internalUndoScene();
return;
default:
if (deviceStateUpdate.isSensorUpdateType()) {
SensorEnum sensorType = deviceStateUpdate.getTypeAsSensorEnum();
setFloatSensorValue(sensorType, deviceStateUpdate.getValueAsFloat());
}
return;
}
}
if (activeScene != null) {
Integer[] sceneOutput = getStandartSceneOutput(activeScene.getSceneID());
if (sceneOutput == null) {
sceneOutput = sceneOutputMap.get(activeScene.getSceneID());
}
if (sceneOutput != null) {
boolean outputChanged = false;
if (isShade()) {
if (isBlind() && sceneOutput[1] != slatAngle) {
logger.debug("Scene output angle: {} setted output value {}", sceneOutput[1], slatAngle);
outputChanged = true;
}
if (sceneOutput[0] != slatPosition) {
logger.debug("Scene output value: {} setted output value {}", sceneOutput[0], slatPosition);
outputChanged = true;
}
} else {
if (sceneOutput[0] != outputValue) {
logger.debug("Scene output value: {} setted output value {}", sceneOutput[0], outputValue);
outputChanged = true;
}
}
if (outputChanged) {
logger.debug("Device output from Device with dSID {} changed deactivate scene {}", dsid.getValue(), activeScene.getID());
activeScene.deviceSceneChanged((short) -1);
lastScene = null;
activeScene = null;
}
} else {
lastScene = null;
}
}
informListenerAboutStateUpdate(deviceStateUpdate);
}
use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.SensorEnum in project smarthome by eclipse.
the class DsChannelTypeProvider method getChannelTypes.
@Override
public Collection<ChannelType> getChannelTypes(Locale locale) {
List<ChannelType> channelTypeList = new LinkedList<ChannelType>();
for (String channelTypeId : supportedOutputChannelTypes) {
channelTypeList.add(getChannelType(new ChannelTypeUID(DigitalSTROMBindingConstants.BINDING_ID, channelTypeId), locale));
}
for (SensorEnum sensorType : SensorEnum.values()) {
channelTypeList.add(getChannelType(new ChannelTypeUID(DigitalSTROMBindingConstants.BINDING_ID, buildIdentifier(sensorType)), locale));
}
for (MeteringTypeEnum meteringType : MeteringTypeEnum.values()) {
channelTypeList.add(getChannelType(new ChannelTypeUID(DigitalSTROMBindingConstants.BINDING_ID, buildIdentifier(meteringType, MeteringUnitsEnum.WH)), locale));
channelTypeList.add(getChannelType(new ChannelTypeUID(DigitalSTROMBindingConstants.BINDING_ID, buildIdentifier(TOTAL_PRE, meteringType, MeteringUnitsEnum.WH)), locale));
}
for (DeviceBinarayInputEnum binaryInput : DeviceBinarayInputEnum.values()) {
channelTypeList.add(getChannelType(new ChannelTypeUID(DigitalSTROMBindingConstants.BINDING_ID, buildIdentifier(BINARY_INPUT_PRE, binaryInput)), locale));
}
return channelTypeList;
}
Aggregations