-
Notifications
You must be signed in to change notification settings - Fork 94
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
Datalogger crashes with IntegrityError because 'timestamp' is null #74
Comments
I think I tracked this one down. It seems so happen when starting the datalogger and an incomplete telegram is processed. For example, for one of the cases where it error'd the telegram was:
According to the protocol, every telegram starts with:
I guess this could be used together with the termination to determine if the telegram is complete. |
Thanks for investigating. The current telegram parser does indeed not check the start of the telegram, as it asumes it's complete. It only checks the ending delimiter:
I could add another check for |
Added test to verify and fixed it. Tests passed as well, so merged to master. |
This should fix your problem. Thanks for reporting it as I have not seen it happening here myself, admitting that I lack Sentry monitoring for the moment. Please let me know if it happens again after applying the latest fix. |
Maybe related to the fact that it's a DSMR 4.2 unit (#73). Stacktrace at:
Query that's executed:
'INSERT INTO "dsmr_datalogger_dsmrreading" ("timestamp", "electricity_delivered_1", "electricity_returned_1", "electricity_delivered_2", "electricity_returned_2", "electricity_currently_delivered", "electricity_currently_returned", "extra_device_timestamp", "extra_device_delivered", "processed") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s) RETURNING "dsmr_datalogger_dsmrreading"."id"'
with parameters:
[None, None, None, None, None, None, None, None, None, False]
The text was updated successfully, but these errors were encountered: