fix rule engine
remove debug from tune
This commit is contained in:
parent
55298f639e
commit
f566867f88
@ -151,11 +151,10 @@ void DevicePluginTune::tuneConnectionStatusChanged(const bool &connected)
|
|||||||
void DevicePluginTune::updateMood(const QVariantMap &message)
|
void DevicePluginTune::updateMood(const QVariantMap &message)
|
||||||
{
|
{
|
||||||
QVariantMap mood = message.value("mood").toMap();
|
QVariantMap mood = message.value("mood").toMap();
|
||||||
qDebug () << QJsonDocument::fromVariant(message).toJson();
|
//qDebug () << QJsonDocument::fromVariant(message).toJson();
|
||||||
Device *device = deviceManager()->findConfiguredDevice(DeviceId(mood.value("deviceId").toString()));
|
Device *device = deviceManager()->findConfiguredDevice(DeviceId(mood.value("deviceId").toString()));
|
||||||
if (device) {
|
if (device) {
|
||||||
QVariantMap states = mood.value("states").toMap();
|
QVariantMap states = mood.value("states").toMap();
|
||||||
//qDebug() << "======>" << device->name() << states.value("active").toBool() << states.value("value").toInt();
|
|
||||||
device->setStateValue(activeStateTypeId, states.value("active").toBool());
|
device->setStateValue(activeStateTypeId, states.value("active").toBool());
|
||||||
device->setStateValue(valueStateTypeId, states.value("value").toInt());
|
device->setStateValue(valueStateTypeId, states.value("value").toInt());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,6 +92,12 @@
|
|||||||
This signal is emitted when a \a rule was added to the system.
|
This signal is emitted when a \a rule was added to the system.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*! \fn void ruleActiveChanged(const Rule &rule);
|
||||||
|
This signal is emitted when a \a rule changed the active state.
|
||||||
|
A \l{Rule} is active, when all \l{State}{States} match with the \l{StateDescriptor} conditions.
|
||||||
|
|
||||||
|
\sa Rule::active()
|
||||||
|
*/
|
||||||
|
|
||||||
#include "guhcore.h"
|
#include "guhcore.h"
|
||||||
#include "jsonrpcserver.h"
|
#include "jsonrpcserver.h"
|
||||||
@ -431,7 +437,7 @@ void GuhCore::gotEvent(const Event &event)
|
|||||||
if (action.isEventBased()) {
|
if (action.isEventBased()) {
|
||||||
eventBasedActions.append(action);
|
eventBasedActions.append(action);
|
||||||
} else {
|
} else {
|
||||||
actions.append(rule.actions());
|
actions.append(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -454,12 +460,13 @@ void GuhCore::gotEvent(const Event &event)
|
|||||||
if (event.eventTypeId() == ruleActionParam.eventTypeId()) {
|
if (event.eventTypeId() == ruleActionParam.eventTypeId()) {
|
||||||
QVariant eventValue = event.params().first().value();
|
QVariant eventValue = event.params().first().value();
|
||||||
|
|
||||||
// TODO: get param names...
|
// TODO: get param names...when an event has more than one parameter
|
||||||
|
|
||||||
// TODO: limits / scale calculation -> actionValue = eventValue * x
|
// TODO: limits / scale calculation -> actionValue = eventValue * x
|
||||||
|
// something like a EventParamDescriptor
|
||||||
|
|
||||||
ruleActionParam.setValue(eventValue);
|
ruleActionParam.setValue(eventValue);
|
||||||
qDebug() << ruleActionParam.value();
|
qDebug() << "take over event param value" << ruleActionParam.value();
|
||||||
}
|
}
|
||||||
newParams.append(ruleActionParam);
|
newParams.append(ruleActionParam);
|
||||||
}
|
}
|
||||||
@ -476,10 +483,13 @@ void GuhCore::gotEvent(const Event &event)
|
|||||||
case DeviceManager::DeviceErrorNoError:
|
case DeviceManager::DeviceErrorNoError:
|
||||||
break;
|
break;
|
||||||
case DeviceManager::DeviceErrorSetupFailed:
|
case DeviceManager::DeviceErrorSetupFailed:
|
||||||
qDebug() << "Error executing action. Device setup failed.";
|
qWarning() << "Error executing action. Device setup failed.";
|
||||||
|
break;
|
||||||
|
case DeviceManager::DeviceErrorAsync:
|
||||||
|
qDebug() << "Executing asynchronous action.";
|
||||||
break;
|
break;
|
||||||
case DeviceManager::DeviceErrorInvalidParameter:
|
case DeviceManager::DeviceErrorInvalidParameter:
|
||||||
qDebug() << "Error executing action. Invalid action parameter.";
|
qWarning() << "Error executing action. Invalid action parameter.";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qDebug() << "Error executing action:" << status;
|
qDebug() << "Error executing action:" << status;
|
||||||
|
|||||||
Reference in New Issue
Block a user