Open tringler opened 6 years ago
@quadportnick It went out that i.e. on my device the event.value[0] for the light sensor is empty. I "solved" it like that:
private void getSensorReadings() {
Log.d(TAG, "getSensorReadings called");
for (Sensor sensor : mSensorList) {
mSensorManager.registerListener(new SensorEventListener(){
@Override
public void onSensorChanged(SensorEvent event) {
JSONObject data = new JSONObject();
try {
if (event.values[0] != 0.0) {
data.put(VALUE, event.values[0]);
} else {
data.put(VALUE, event.values[1]);
}
data.put(UNIT, "??"); // todo not useful units :)
data.put(ID, event.sensor.getName());
}
catch (JSONException ex) { ex.printStackTrace(); }
publishSensorData(getSensorName(event.sensor.getType()), data);
mSensorManager.unregisterListener(this);
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {}
}, sensor, 1000);
}
}
I love the peculiarity on this stuff between devices. I'll get that integrated, thanks!
@quadportnick Thanks! Glad to know the project is not dead yet 👍
Hi , I have installed the .7b1 version and I have the same problem where Pressure and brightness not posted via mqtt. I am using core-mosquitto as my mqtt broker. Please guide..
Thanks,
I'm using v0.9.3 on Samsung Galaxy A3 and I have the same problem.
Can anyone confirm that brightness and pressure is not working for some devices? On my Samsung TAB S 8.4 the battery status is sent by mqtt while pressure and brightness mqtt sensor don't get any data: