|
|
@ -36,7 +36,7 @@ MainWindow::MainWindow(QWidget *parent) : |
|
|
|
Settings *s = Settings::getInstance(); |
|
|
|
|
|
|
|
for (int i = 0; i < s->nbZones(); i++) { |
|
|
|
zone = new ZoneItem(s->m_rooms.at(i).name, this); |
|
|
|
zone = new ZoneItem(s->getRoom(i).name, this); |
|
|
|
zone->setProperty("idx", i); |
|
|
|
zone->m_target_temperature = get_target_temperature(i); |
|
|
|
connect(zone, SIGNAL(clicked()), this, SLOT(show_boost())); |
|
|
@ -290,7 +290,7 @@ double MainWindow::get_target_temperature(int room_idx) |
|
|
|
goto out; |
|
|
|
} |
|
|
|
|
|
|
|
r = &(s->m_rooms.at(room_idx)); |
|
|
|
r = &(s->getRoom(room_idx)); |
|
|
|
target = r->default_temperature; |
|
|
|
if (!dow) { |
|
|
|
goto out; |
|
|
@ -387,14 +387,14 @@ void MainWindow::apply_automatic_state(void) |
|
|
|
int i; |
|
|
|
|
|
|
|
qDebug() << "apply auto state"; |
|
|
|
for (i = 0; i < s->m_rooms.count(); i++) { |
|
|
|
const struct Room *r = &(s->m_rooms.at(i)); |
|
|
|
for (i = 0; i < s->nbZones(); i++) { |
|
|
|
const struct Room r = s->getRoom(i); |
|
|
|
m_zones.at(i)->m_heating_on = get_heater_order(i); |
|
|
|
m_zones.at(i)->m_target_temperature = get_target_temperature(i); |
|
|
|
m_zones.at(i)->refresh(); |
|
|
|
qDebug() << "room " << r->name; |
|
|
|
for (int j = 0; j < r->heaters.count(); j++) { |
|
|
|
const struct Heater *h = &(r->heaters.at(j)); |
|
|
|
qDebug() << "room " << r.name; |
|
|
|
for (int j = 0; j < r.heaters.count(); j++) { |
|
|
|
const struct Heater *h = &(r.heaters.at(j)); |
|
|
|
qDebug() << "heater " << h->ctrl_topic; |
|
|
|
m_mqtt->publish_msg(h->ctrl_topic, |
|
|
|
m_zones.at(i)->m_heating_on ? "1" : "0"); |
|
|
@ -450,7 +450,7 @@ void MainWindow::apply_order_to_heaters(void) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (int i = 0; i < s->m_rooms.count(); i++) { |
|
|
|
for (int i = 0; i < s->nbZones(); i++) { |
|
|
|
m_zones.at(i)->refresh(); |
|
|
|
} |
|
|
|
} |
|
|
|