mirror of https://github.com/nymea/nymea.git
make use of actions in addconfigureddevice
parent
ee7b30696c
commit
3d3195419b
|
|
@ -62,6 +62,14 @@ DeviceManager::DeviceError DeviceManager::addConfiguredDevice(const QUuid &devic
|
|||
triggers.append(trigger);
|
||||
}
|
||||
device->setTriggers(triggers);
|
||||
QList<Action> actions;
|
||||
foreach (const ActionType &actionType, deviceClass.actions()) {
|
||||
Action action(QUuid::createUuid());
|
||||
action.setName(actionType.name());
|
||||
action.setParams(actionType.parameters());
|
||||
actions.append(action);
|
||||
}
|
||||
device->setActions(actions);
|
||||
m_configuredDevices.append(device);
|
||||
|
||||
storeConfiguredDevices();
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ QVariantMap JsonRPCServer::packDeviceClass(const DeviceClass &deviceClass)
|
|||
triggerTypes.append(triggerMap);
|
||||
}
|
||||
QVariantList actionTypes;
|
||||
qDebug() << "*******************" << deviceClass.actions().count();
|
||||
foreach (const ActionType &actionType, deviceClass.actions()) {
|
||||
QVariantMap actionMap;
|
||||
actionMap.insert("id", actionType.id().toString());
|
||||
|
|
@ -165,6 +166,11 @@ QVariantMap JsonRPCServer::packDevice(Device *device)
|
|||
triggers.append(trigger.id());
|
||||
}
|
||||
variant.insert("triggers", triggers);
|
||||
QVariantList actions;
|
||||
foreach (const Action &action, device->actions()) {
|
||||
actions.append(action.id());
|
||||
}
|
||||
variant.insert("actions", actions);
|
||||
variant.insert("params", device->params());
|
||||
return variant;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue