fix awattar details
change some test details
This commit is contained in:
parent
8f387688e4
commit
a4cffced68
@ -343,7 +343,8 @@ void DevicePluginAwattar::processUserData(const QVariantMap &data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (HeatPump *pump, m_heatPumps) {
|
foreach (HeatPump *pump, m_heatPumps) {
|
||||||
pump->setSgMode(sgMode);
|
if (pump->reachable())
|
||||||
|
pump->setSgMode(sgMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,13 @@ HeatPump::HeatPump(QHostAddress address, QObject *parent) :
|
|||||||
url.setPath("/.well-known/core");
|
url.setPath("/.well-known/core");
|
||||||
|
|
||||||
qCDebug(dcAwattar) << "Discover pump resources on" << url.toString();
|
qCDebug(dcAwattar) << "Discover pump resources on" << url.toString();
|
||||||
m_discoverReplies.append(m_coap->get(CoapRequest(url)));
|
CoapReply *reply = m_coap->get(CoapRequest(url));
|
||||||
|
if (reply->error() != CoapReply::NoError) {
|
||||||
|
qCWarning(dcAwattar()) << "Could not discover pump resources" << reply->errorString();
|
||||||
|
reply->deleteLater();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_discoverReplies.append(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
QHostAddress HeatPump::address() const
|
QHostAddress HeatPump::address() const
|
||||||
@ -65,7 +71,15 @@ void HeatPump::setSgMode(const int &sgMode)
|
|||||||
url.setPath("/a/sg_mode");
|
url.setPath("/a/sg_mode");
|
||||||
|
|
||||||
QByteArray payload = QString("mode=%1").arg(QString::number(sgMode)).toUtf8();
|
QByteArray payload = QString("mode=%1").arg(QString::number(sgMode)).toUtf8();
|
||||||
m_sgModeReplies.append(m_coap->post(CoapRequest(url), payload));
|
|
||||||
|
CoapReply *reply = m_coap->post(CoapRequest(url), payload);
|
||||||
|
if (reply->error() != CoapReply::NoError) {
|
||||||
|
qCWarning(dcAwattar()) << "Could not set sg mode" << reply->errorString();
|
||||||
|
reply->deleteLater();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sgModeReplies.append(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeatPump::setLed(const bool &power)
|
void HeatPump::setLed(const bool &power)
|
||||||
@ -75,11 +89,20 @@ void HeatPump::setLed(const bool &power)
|
|||||||
url.setHost(m_address.toString());
|
url.setHost(m_address.toString());
|
||||||
url.setPath("/a/led");
|
url.setPath("/a/led");
|
||||||
|
|
||||||
|
QByteArray data;
|
||||||
if (power) {
|
if (power) {
|
||||||
m_ledReplies.append(m_coap->post(CoapRequest(url), QString("mode=1").toUtf8()));
|
data = QString("mode=1").toUtf8();
|
||||||
} else {
|
} else {
|
||||||
m_ledReplies.append(m_coap->post(CoapRequest(url), QString("mode=0").toUtf8()));
|
data = QString("mode=0").toUtf8();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CoapReply *reply = m_coap->post(CoapRequest(url), data);
|
||||||
|
if (reply->error() != CoapReply::NoError) {
|
||||||
|
qCWarning(dcAwattar()) << "Could not set led" << reply->errorString();
|
||||||
|
reply->deleteLater();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_ledReplies.append(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeatPump::setReachable(const bool &reachable)
|
void HeatPump::setReachable(const bool &reachable)
|
||||||
|
|||||||
@ -78,6 +78,8 @@ void GuhTestBase::initTestCase()
|
|||||||
rulesSettings.clear();
|
rulesSettings.clear();
|
||||||
GuhSettings deviceSettings(GuhSettings::SettingsRoleDevices);
|
GuhSettings deviceSettings(GuhSettings::SettingsRoleDevices);
|
||||||
deviceSettings.clear();
|
deviceSettings.clear();
|
||||||
|
GuhSettings pluginSettings(GuhSettings::SettingsRolePlugins);
|
||||||
|
pluginSettings.clear();
|
||||||
|
|
||||||
GuhCore::instance();
|
GuhCore::instance();
|
||||||
|
|
||||||
|
|||||||
@ -824,7 +824,7 @@ void TestRules::executeRuleActions()
|
|||||||
verifyRuleError(response, ruleError);
|
verifyRuleError(response, ruleError);
|
||||||
|
|
||||||
// give the ruleeingine time to execute the actions
|
// give the ruleeingine time to execute the actions
|
||||||
QTest::qWait(1000);
|
QTest::qWait(2000);
|
||||||
|
|
||||||
if (ruleError == RuleEngine::RuleErrorNoError) {
|
if (ruleError == RuleEngine::RuleErrorNoError) {
|
||||||
verifyRuleExecuted(mockActionIdWithParams);
|
verifyRuleExecuted(mockActionIdWithParams);
|
||||||
@ -839,7 +839,7 @@ void TestRules::executeRuleActions()
|
|||||||
verifyRuleError(response, ruleError);
|
verifyRuleError(response, ruleError);
|
||||||
|
|
||||||
// give the ruleeingine time to execute the actions
|
// give the ruleeingine time to execute the actions
|
||||||
QTest::qWait(1000);
|
QTest::qWait(2000);
|
||||||
|
|
||||||
if (ruleError == RuleEngine::RuleErrorNoError) {
|
if (ruleError == RuleEngine::RuleErrorNoError) {
|
||||||
verifyRuleExecuted(mockActionIdNoParams);
|
verifyRuleExecuted(mockActionIdNoParams);
|
||||||
|
|||||||
Reference in New Issue
Block a user