validate board gpios in system

This commit is contained in:
MichaelDvP
2025-11-16 20:41:45 +01:00
parent 60b0de79b3
commit a693e96248
8 changed files with 70 additions and 82 deletions

View File

@@ -55,10 +55,12 @@ void TemperatureSensor::start(const bool factory_settings) {
// load settings
void TemperatureSensor::reload() {
// load the service settings
EMSESP::system_.dallas_gpio(0); // reset in system to check valid sensor
EMSESP::webSettingsService.read([&](WebSettings const & settings) {
dallas_gpio_ = settings.dallas_gpio;
dallas_gpio_ = EMSESP::system_.is_valid_gpio(settings.dallas_gpio) ? settings.dallas_gpio : 0;
parasite_ = settings.dallas_parasite;
});
EMSESP::system_.dallas_gpio(dallas_gpio_); // set to system for checks
for (auto & sensor : sensors_) {
remove_ha_topic(sensor.id());