|
|
@ -369,7 +369,6 @@ void MainWindow::apply_automatic_state(void) |
|
|
|
for (int j = 0; j < r->heaters.count(); j++) { |
|
|
|
const struct Heater *h = &(r->heaters.at(j)); |
|
|
|
qDebug() << "heater " << h->ctrl_topic; |
|
|
|
/* TODO: check if connected */ |
|
|
|
m_mqtt->publish_msg(h->ctrl_topic, |
|
|
|
m_zones.at(i)->m_heating_on ? "1" : "0"); |
|
|
|
} |
|
|
@ -402,6 +401,7 @@ void MainWindow::change_state(void) |
|
|
|
void MainWindow::apply_order_to_heaters(void) |
|
|
|
{ |
|
|
|
Settings *s = Settings::getInstance(); |
|
|
|
bool heating_order = false; |
|
|
|
|
|
|
|
if (m_end_holiday > QDate::currentDate()) { |
|
|
|
qDebug() << "Holiday mode => emit ALL_OFF order"; |
|
|
@ -409,19 +409,21 @@ void MainWindow::apply_order_to_heaters(void) |
|
|
|
} |
|
|
|
|
|
|
|
switch (s->m_state) { |
|
|
|
case ON: |
|
|
|
qDebug() << "emit ALL_ON order"; |
|
|
|
emit setAllHeatersOn(true); |
|
|
|
break; |
|
|
|
case AUTO: |
|
|
|
qDebug() << "apply AUTO state"; |
|
|
|
apply_automatic_state(); |
|
|
|
break; |
|
|
|
case ON: |
|
|
|
heating_order = true; |
|
|
|
/* fall */ |
|
|
|
case OFF: |
|
|
|
/* fall */ |
|
|
|
default: |
|
|
|
qDebug() << "emit ALL_OFF order"; |
|
|
|
emit setAllHeatersOn(false); |
|
|
|
emit setAllHeatersOn(heating_order); |
|
|
|
|
|
|
|
for (int i = 0; i < s->m_rooms.count(); i++) { |
|
|
|
m_zones.at(i)->refresh(); |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|