Skip to content

Missing ValidationError for POSTing an instantaneous value to a non-instantaneous sensor #2115

@Flix6x

Description

@Flix6x

This currently yields a ZeroDivisionError on the server rather than a ValidationError. The associated endpoint is [POST] /sensors/<id>/data.

To reproduce set the duration to PT0M and values to [0.0]. The user falsely assumes the sensor has a zero resolution, and should get an error message that explains the mistake. A valid duration would presumably be an integer number times the sensor resolution, in case the sensor resolution is non-zero. In practice, this happened on a sensor representing soc-min correctly in a 15-min resolution, but it is too easy for a user to mistakenly send an instantaneous reading to the sensor, given that they usually also deal with a state-of-charge sensor of 0-min resolution.

This case should become covered in a test, too.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions