diff --git a/Thing.h b/Thing.h index 25a6ea3..8311fce 100644 --- a/Thing.h +++ b/Thing.h @@ -578,7 +578,8 @@ class ThingDevice { void setProperty(const char *name, const JsonVariant &newValue) { ThingProperty *property = findProperty(name); - + if(property->readOnly) + return; if (property == nullptr) { return; } @@ -597,15 +598,19 @@ class ThingDevice { case NUMBER: { ThingDataValue value; value.number = newValue.as(); - property->setValue(value); - property->changed(value); + if((property->maximum < property->minimum) || (property->maximum > value.number && property->minimum < value.number)){ + property->setValue(value); + property->changed(value); + } break; } case INTEGER: { ThingDataValue value; value.integer = newValue.as(); - property->setValue(value); - property->changed(value); + if((property->maximum < property->minimum) || (property->maximum > value.integer && property->minimum < value.integer)){ + property->setValue(value); + property->changed(value); + } break; } case STRING: