fix potential bug in presence detection

This commit is contained in:
technyon
2022-07-09 10:58:49 +02:00
parent de305da177
commit af24eeb0e9

View File

@@ -40,13 +40,15 @@ void PresenceDetection::update()
delay(3000); delay(3000);
if(_timeout < 0) return; if(_timeout < 0) return;
memset(_csv, 0, presence_detection_buffer_size);
if(_devices.size() == 0) if(_devices.size() == 0)
{ {
_network->publishPresenceDetection(";;"); strcpy(_csv, ";;");
_network->publishPresenceDetection(_csv);
return; return;
} }
memset(_csv, 0, presence_detection_buffer_size);
_csvIndex = 0; _csvIndex = 0;
long ts = millis(); long ts = millis();
for(auto it : _devices) for(auto it : _devices)