-
-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Received message with invalid header. #41
Comments
This is shown when the data received from the particle meter is not as expected. Is your soldering correct and reliable? |
I had the same problem using ESP32 and the Hardware Serial2. The problem is caused by the fact that, depending on how often you poll the sensor library ( The code esp8266-vindriktning-particle-sensor/src/SerialCom.h Lines 92 to 94 in 83fd7c5
clears the buffer after 64 bytes thus deleting three whole messages (3 x 20 bytes) and the 4 bytes of the next message. What is left is not a valid message because the header was chopped off. Anyway, the fix seems to be replacing the loop esp8266-vindriktning-particle-sensor/src/SerialCom.h Lines 85 to 95 in 83fd7c5
with while (sensorSerial.available() && rxBufIdx < sizeof(serialRxBuf))
{
serialRxBuf[rxBufIdx++] = sensorSerial.read();
Serial.print(".");
} Works fine for me after this change. I've not created a pull request because I am not sure why the author used this clearing of the buffer in reading process - probably there is a good reason that I don't see. |
I had the same problem. I tried to reupload sketch several times, but the problem was in incorrect configuration to the Home Assistant (mqtt). After reuploading the sensor didn't create AP again (allowing to reconfigure settings). |
Hi,
I have uploaded to a D1 Mini, it connects to my wifi, I get the status Online message in MQTT, together with the air filter and wifi message, however, it doesn't show any values in MQTT and I can't see it in Home Assistant. When I look at the Serial output of the arduino IDE, I get this messag: "Received message with invalid header."
Occasionally it does show a reading:
Received PM 2.5 reading: 42
Current measurements: 42, 39, 39, 40, 40
Thanks in advance
The text was updated successfully, but these errors were encountered: