private void readOutputValue(Device device) {
    short outputIndex = DeviceConstants.DEVICE_SENSOR_OUTPUT;
    if (device.isShade()) {
      outputIndex = DeviceConstants.DEVICE_SENSOR_SLAT_POSITION_OUTPUT;
    }

    int outputValue =
        this.digitalSTROMClient.getDeviceOutputValue(
            connMan.getSessionToken(), device.getDSID(), null, outputIndex);
    if (outputValue != -1) {
      if (!device.isShade()) {
        device.updateInternalDeviceState(
            new DeviceStateUpdateImpl(DeviceStateUpdate.UPDATE_BRIGHTNESS, outputValue));
      } else {
        device.updateInternalDeviceState(
            new DeviceStateUpdateImpl(DeviceStateUpdate.UPDATE_SLATPOSITION, outputValue));
        if (device.isBlind()) {
          outputValue =
              this.digitalSTROMClient.getDeviceOutputValue(
                  connMan.getSessionToken(),
                  device.getDSID(),
                  null,
                  DeviceConstants.DEVICE_SENSOR_SLAT_ANGLE_OUTPUT);
          device.updateInternalDeviceState(
              new DeviceStateUpdateImpl(DeviceStateUpdate.UPDATE_SLAT_ANGLE, outputValue));
        }
      }
    }
  }
 /**
  * Checks the output value of a {@link Device} and return 0, if the output value or slat position
  * is min and 1, if the output value or slat position is max, otherwise it returns -1.
  *
  * @param device
  * @return 0 = output value is min, 1 device value is min, otherwise -1
  */
 private short checkIsAllreadyMinMax(Device device) {
   if (device.isShade()) {
     if (device.getSlatPosition() == device.getMaxSlatPosition()) {
       if (device.isBlind()) {
         if (device.getAnglePosition() == device.getMaxSlatAngle()) {
           return 1;
         } else {
           return -1;
         }
       }
       return 1;
     }
     if (device.getSlatPosition() == device.getMinSlatPosition()) {
       if (device.isBlind()) {
         if (device.getAnglePosition() == device.getMinSlatAngle()) {
           return 0;
         } else {
           return -1;
         }
       }
       return 0;
     }
   } else {
     if (device.getOutputValue() == device.getMaxOutputValue()) {
       return 1;
     }
     if (device.getOutputValue() == device.getMinOutputValue() || device.getOutputValue() <= 0) {
       return 0;
     }
   }
   return -1;
 }