diff --git a/soft/thermostat/inc/mainwindow.h b/soft/thermostat/inc/mainwindow.h index 93dc2bb..4845a48 100644 --- a/soft/thermostat/inc/mainwindow.h +++ b/soft/thermostat/inc/mainwindow.h @@ -36,6 +36,7 @@ private: private slots: void temperature_slot(unsigned idx, double val); void hygro_slot(unsigned idx, double val); + void availability_slot(unsigned idx, bool ok); }; #endif // MAINWINDOW_H diff --git a/soft/thermostat/src/mainwindow.cpp b/soft/thermostat/src/mainwindow.cpp index 32470e7..33318ad 100644 --- a/soft/thermostat/src/mainwindow.cpp +++ b/soft/thermostat/src/mainwindow.cpp @@ -32,6 +32,8 @@ MainWindow::MainWindow(QWidget *parent) : connect(mqttclient, SIGNAL(new_hygro(unsigned, double)), this, SLOT(hygro_slot(unsigned, double))); + connect(mqttclient, SIGNAL(new_availability(unsigned, bool)), + this, SLOT(availability_slot(unsigned, bool))); /* * Sensors-related layout */ @@ -77,5 +79,12 @@ void MainWindow::hygro_slot(unsigned idx, double val) m_zones[idx]->set_hygro_value(val); } } +void MainWindow::availability_slot(unsigned idx, bool ok) +{ + if ((idx < NB_ZONES) && !ok) { + m_zones[idx]->set_hygro_value(0); + m_zones[idx]->set_temperature_value(0); + } +} /* vim: set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab: */