set min/max for percent sensor
[psensor.git] / src / lib / psensor.c
index 415af89..236842a 100644 (file)
@@ -45,6 +45,14 @@ struct psensor *psensor_create(char *id,
        psensor->sess_lowest = UNKNOWN_DBL_VALUE;
        psensor->sess_highest = UNKNOWN_DBL_VALUE;
 
+       if (type & SENSOR_TYPE_PERCENT) {
+               psensor->min = 0;
+               psensor->max = 100;
+       } else {
+               psensor->min = UNKNOWN_DBL_VALUE;
+               psensor->max = UNKNOWN_DBL_VALUE;
+       }
+
        psensor->type = type;
 
        psensor->values_max_length = values_max_length;