Configuration can be used with default values
This commit is contained in:
@@ -28,16 +28,16 @@ void Plant::init(void) {
|
||||
this->mSetting->pSensorWet->setValidator([] (long candidate) {
|
||||
return ((candidate >= 0) && (candidate <= 4095) );
|
||||
});
|
||||
this->mSetting->pPumpAllowedHourRangeStart->setDefaultValue(8);
|
||||
this->mSetting->pPumpAllowedHourRangeStart->setDefaultValue(8); // start at 8:00
|
||||
this->mSetting->pPumpAllowedHourRangeStart->setValidator([] (long candidate) {
|
||||
return ((candidate >= 0) && (candidate <= 23) );
|
||||
});
|
||||
this->mSetting->pPumpAllowedHourRangeEnd->setDefaultValue(20);
|
||||
this->mSetting->pPumpAllowedHourRangeEnd->setDefaultValue(20); // stop pumps at 20:00
|
||||
this->mSetting->pPumpAllowedHourRangeEnd->setValidator([] (long candidate) {
|
||||
return ((candidate >= 0) && (candidate <= 23) );
|
||||
});
|
||||
this->mSetting->pPumpOnlyWhenLowLight->setDefaultValue(true);
|
||||
this->mSetting->pPumpCooldownInHours->setDefaultValue(20);
|
||||
this->mSetting->pPumpCooldownInHours->setDefaultValue(20); // minutes
|
||||
this->mSetting->pPumpCooldownInHours->setValidator([] (long candidate) {
|
||||
return ((candidate >= 0) && (candidate <= 1024) );
|
||||
});
|
||||
|
@@ -342,9 +342,15 @@ void setup() {
|
||||
Homie.setLoopFunction(loopHandler);
|
||||
|
||||
mConfigured = Homie.isConfigured();
|
||||
// Load the settings
|
||||
deepSleepTime.setDefaultValue(0);
|
||||
// Set default values
|
||||
deepSleepTime.setDefaultValue(300000); /* 5 minutes in milliseconds */
|
||||
deepSleepNightTime.setDefaultValue(0);
|
||||
wateringDeepSleep.setDefaultValue(60000); /* 1 minute in milliseconds */
|
||||
|
||||
waterLevelMax.setDefaultValue(1000); /* 100cm in mm */
|
||||
waterLevelMin.setDefaultValue(50); /* 5cm in mm */
|
||||
waterLevelWarn.setDefaultValue(500); /* 50cm in mm */
|
||||
waterLevelVol.setDefaultValue(5000); /* 5l in ml */
|
||||
|
||||
if (mConfigured) {
|
||||
// Advertise topics
|
||||
|
Reference in New Issue
Block a user