I ran into a problem while testing out an nRF52832 board with home assistant. Sometimes, when a new node connected, it would show in Home Assistsant as None nnn (where nnn is the node number) with only a battery sensor and no other sensors. Looking in the mysensors.json file, I found the sensors were defined but the sketch_name was "null".
"211": {
"sensor_id": 211,
"children": {
"0": {
"id": 0,
"type": 6,
"description": "Temperature",
"values": {
"0": "22.99"
}
},
"1": {
"id": 1,
"type": 8,
"description": "Pressure",
"values": {
"43": "kPa",
"4": "101.86"
}
}
},
"type": 17,
"sketch_name": null,
"sketch_version": "1.0",
"battery_level": 0,
"protocol_version": "2.3.2",
"heartbeat": 0
}
The sketch name is set by sendSketchInfo(), which made me think that this message was getting lost sometimes, perhaps the transport message system was still processing previous messages.
I added a 10ms wait, and the problem was solved, the nodes now consistently register with home assistant.
void presentation() {
// Send the sketch name & version information to the gateway and Controller
wait(10); // allow transport to setup, sometimes sketch info is being lost
sendSketchInfo("BMP280 Sensor", "1.0");
present(CHILD_ID_TEMP, S_TEMP, "Temperature");
present(CHILD_ID_PRES, S_BARO, "Pressure");
}
I just thought I would share this, in case others run into the same problem.