Get error Invalid input class: 'float' when trying to read temperature - code is in kotlin

I'm trying to read the temperature data from my MetaMotionR, but i get and error that says:
2020-10-08 12:18:37.290 31070-1610/com.example.afgangsprojektet W/BluetoothGatt: Unhandled exception in callback
java.lang.ClassCastException: Invalid input class: 'float'
at com.mbientlab.metawear.impl.DataPrivate.value(
at com.mbientlab.metawear.impl.SFloatData$1.value(

I have tried reading acceleration data, and that works fine, can anyone help?

This is the part of my code where i try to read temperature:

override fun onServiceConnected(componentName: ComponentName?, iBinder: IBinder) {
    serviceBinder = iBinder as LocalBinder
    Log.d(SENSOR_LOG, "Sensor connected")

private fun retrieveBoard(macAddress: String) {
    val btManager =
        getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
    val remoteDevice: BluetoothDevice = btManager.adapter.getRemoteDevice(macAddress)

    // Create a MetaWear board object for the Bluetooth Device
    board = serviceBinder.getMetaWearBoard(remoteDevice)

    board.connectAsync().onSuccessTask {

            Log.d(SENSOR_LOG, "Sensor connection succeeded, connected to: $macAddress")


    }.continueWith { task ->
        if (task.isFaulted) {
            Log.d(SENSOR_LOG, "Sensor connection is faulted error: ${task.error} ")
        } else {
            Log.d(SENSOR_LOG, "Sensor is configured")

private fun setUpTemperatureSensor(): Task<Route>{
    temperature = board.getModule(
    temperatureSensor =

    return temperatureSensor.addRouteAsync { source -> { data, _ ->
            Log.d(SENSOR_LOG, "temperature data ${data.value(}")
Sign In or Register to comment.