So after switching from Home Assistant to MyController to OpenHAB it seems that OpenHAB doesn’t like the way my sensors are reporting their values.
I’m seeing this stacktrace in the log all the time:
) :01:47:24.343 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Node 3 found in gateway
01:47:24.350 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Child 4 found in node 3
01:47:24.357 [ERROR] [internal.event.MySensorsEventRegister] - Event broadcasting throw an exception
java.lang.NumberFormatException: null
24) ~[?:?]
?]
[?:?]
a:122) ~[?:?]
]
:?]
a:79) [211:org.openhab.binding.mysensors:2.3.0.201803141156]
nection.java:358) [211:org.openhab.binding.mysensors:2.3.0.201803141156]
01:47:24.462 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2225831 TSF:MSG:READ,3-3-0,s=4,c=1,t=37,pt=3,l=2,sg=0:0
01:47:24.469 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2225838 TSF:MSG:ACK REQ
01:47:24.475 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2225842 TSF:MSG:SEND,0-0-3-3,s=4,c=1,t=37,pt=3,l=2,sg=0,ft=0,st=OK:0
01:47:24.483 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 3;4;1;0;37;0
Sensor 3 sending code:
void presentation() {
// Send the sketch version information to the gateway and Controller
sendSketchInfo("Gassensor", "0.0");
Serial.begin(115200);
// Register all sensors to gateway (they will be created as child devices)
for (uint8_t sensor_id = 0; sensor_id < 11; sensor_id++) {
pinMode(sensor_pins[sensor_id], INPUT);
present(sensor_id, S_AIR_QUALITY, "Gas sensor", true);
}
}
void loop() {
for (uint8_t sensor_id = 0; sensor_id < 10; sensor_id++) {
uint16_t reading = analogRead(sensor_pins[sensor_id]);
Serial.print(F("Sensor: "));
Serial.print(sensor_id);
Serial.print(F(", reading: "));
Serial.println(reading);
send(msgPrefix.setSensor(sensor_id).set("ppm"), true);
send(msg.setSensor(sensor_id).set(reading), true);
sleep(100);
}
send(msgPrefix.setSensor(10).set("ppm"), true);
send(msg.setSensor(10).set(analogRead(DUST)), true);
sleep(SLEEP_TIME);
}
Any ideas how to fix this?