Of course it's ugly. The correct way for this is to move the initial readings posting to the setup function:
void sendSensorData()
{
// Collect, process and send the sensors data here
send(msgSample.set(42, 1));
}
void presentation()
{
// Send the sketch version information to the gateway
sendSketchInfo("Gen", "1.0");
present(CHILD_ID_SAMPLE, S_LIGHT_LEVEL, "L");
}
void setup()
{
// Code to initialize the sensors and stuff.
sendSensorData();
timer.every(UPDATE_INTERVAL, sendSensorData);
}
void loop()
{
// Only timer update and possibly OTA checks go into the loop itself.
// All the other operations are called by the timer.
timer.update();
}