mirror of https://github.com/nymea/nymea.git
fixed rule connection
parent
42d2489334
commit
a89ae7bdff
|
|
@ -21,6 +21,7 @@ DeviceManager::DeviceManager(QObject *parent) :
|
|||
QObject(parent)
|
||||
{
|
||||
m_radio433 = new Radio433(this);
|
||||
connect(m_radio433, &Radio433::dataReceived, this, &DeviceManager::radio433SignalReceived);
|
||||
|
||||
QMetaObject::invokeMethod(this, "loadPlugins", Qt::QueuedConnection);
|
||||
QMetaObject::invokeMethod(this, "loadConfiguredDevices", Qt::QueuedConnection);
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
|
||||
QUuid elroRemote = QUuid("d85c1ef4-197c-4053-8e40-707aa671d302");
|
||||
QUuid elroDevicePlugin = QUuid("308ae6e6-38b3-4b3a-a513-3199da2764f8");
|
||||
QUuid elroRemoteId = QUuid("d85c1ef4-197c-4053-8e40-707aa671d302");
|
||||
QUuid elroSwitchId = QUuid("308ae6e6-38b3-4b3a-a513-3199da2764f8");
|
||||
|
||||
DevicePluginElro::DevicePluginElro()
|
||||
{
|
||||
|
|
@ -20,8 +20,8 @@ QList<DeviceClass> DevicePluginElro::supportedDevices() const
|
|||
QList<DeviceClass> ret;
|
||||
|
||||
// Remote
|
||||
DeviceClass deviceClassDevicePluginElro(pluginId(), elroRemote);
|
||||
deviceClassDevicePluginElro.setName("Elro Remote");
|
||||
DeviceClass deviceClassElroRemote(pluginId(), elroRemoteId);
|
||||
deviceClassElroRemote.setName("Elro Remote");
|
||||
|
||||
QVariantList deviceParamsRemote;
|
||||
QVariantMap channelParam;
|
||||
|
|
@ -41,7 +41,7 @@ QList<DeviceClass> DevicePluginElro::supportedDevices() const
|
|||
channelParam.insert("type", "bool");
|
||||
deviceParamsRemote.append(channelParam);
|
||||
|
||||
deviceClassDevicePluginElro.setParams(deviceParamsRemote);
|
||||
deviceClassElroRemote.setParams(deviceParamsRemote);
|
||||
|
||||
QList<TriggerType> buttonTriggers;
|
||||
|
||||
|
|
@ -76,12 +76,12 @@ QList<DeviceClass> DevicePluginElro::supportedDevices() const
|
|||
buttonETrigger.setParameters(paramsRemote);
|
||||
buttonTriggers.append(buttonETrigger);
|
||||
|
||||
deviceClassDevicePluginElro.setTriggers(buttonTriggers);
|
||||
ret.append(deviceClassDevicePluginElro);
|
||||
deviceClassElroRemote.setTriggers(buttonTriggers);
|
||||
ret.append(deviceClassElroRemote);
|
||||
|
||||
// Switch
|
||||
DeviceClass deviceClassRfSwitchMumbi(pluginId(), elroDevicePlugin);
|
||||
deviceClassRfSwitchMumbi.setName("Elro Power Switch");
|
||||
DeviceClass deviceClassElroSwitch(pluginId(), elroSwitchId);
|
||||
deviceClassElroSwitch.setName("Elro Power Switch");
|
||||
|
||||
QVariantList deviceParamsSwitch;
|
||||
QVariantMap paramSwitch;
|
||||
|
|
@ -116,22 +116,24 @@ QList<DeviceClass> DevicePluginElro::supportedDevices() const
|
|||
paramSwitch.insert("type", "bool");
|
||||
deviceParamsSwitch.append(paramSwitch);
|
||||
|
||||
QVariantList paramsSwitch;
|
||||
deviceClassElroSwitch.setParams(deviceParamsSwitch);
|
||||
|
||||
|
||||
QVariantList actionParamsSwitch;
|
||||
QVariantMap actionParamSwitch;
|
||||
actionParamSwitch.insert("name", "power");
|
||||
actionParamSwitch.insert("type", "bool");
|
||||
paramsSwitch.append(actionParamSwitch);
|
||||
|
||||
actionParamsSwitch.append(actionParamSwitch);
|
||||
|
||||
QList<ActionType> switchActions;
|
||||
|
||||
ActionType powerAction(QUuid("31c9758e-6567-4f89-85bb-29e1a7c55d44"));
|
||||
powerAction.setName("power");
|
||||
powerAction.setParameters(paramsSwitch);
|
||||
powerAction.setParameters(actionParamsSwitch);
|
||||
switchActions.append(powerAction);
|
||||
|
||||
deviceClassRfSwitchMumbi.setActions(switchActions);
|
||||
ret.append(deviceClassRfSwitchMumbi);
|
||||
deviceClassElroSwitch.setActions(switchActions);
|
||||
ret.append(deviceClassElroSwitch);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -332,7 +334,7 @@ void DevicePluginElro::receiveData(QList<int> rawData)
|
|||
}
|
||||
|
||||
Device *device = 0;
|
||||
QList<Device*> deviceList = deviceManager()->findConfiguredDevices(elroRemote);
|
||||
QList<Device*> deviceList = deviceManager()->findConfiguredDevices(elroRemoteId);
|
||||
foreach (Device *dev, deviceList) {
|
||||
if (dev->params().contains("channel1") && dev->params().value("channel1").toBool() == group.at(0) &&
|
||||
dev->params().contains("channel2") && dev->params().value("channel2").toBool() == group.at(1) &&
|
||||
|
|
|
|||
|
|
@ -136,4 +136,6 @@ void DevicePluginMeisterAnker::receiveData(QList<int> rawData)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ if [ -z $1 ]; then
|
|||
echo "usage $0 host"
|
||||
else
|
||||
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClass": "{d85c1ef4-197c-4053-8e40-707aa671d302}","deviceParams":{"channel1":"false", "channel2":"false", "channel3":"false", "channel4": "false", "channel5":"false" }}}'; sleep 1) | nc $1 1234
|
||||
# (echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClass": "{308ae6e6-38b3-4b3a-a513-3199da2764f8}","deviceParams":{"channel1":"false","channel2":"false", "channel3":"false", "channel4": "false","channel5":"false","A":"false","B":"true","C":"false","D":"false","E":"false" }}}'; sleep 1) | nc $1 1234
|
||||
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClass": "{308ae6e6-38b3-4b3a-a513-3199da2764f8}","deviceParams":{"channel1":"false","channel2":"false", "channel3":"false", "channel4": "false","channel5":"false","A":"false","B":"true","C":"false","D":"false","E":"false" }}}'; sleep 1) | nc $1 1234
|
||||
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClass": "{ab73ad2f-6594-45a3-9063-8f72d365c5e5}","deviceParams":{"familycode":"J"}}}'; sleep 1) | nc $1 1234
|
||||
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@
|
|||
if test -z $3; then
|
||||
echo "usage: $1 host triggerId actionId"
|
||||
else
|
||||
(echo '{"id":1, "method":"Rules.AddRule", "params":{"triggerId": "'$2'", "actionId": "'$3'" }}'; sleep 1) | nc $1 1234
|
||||
(echo '{"id":1, "method":"Rules.AddRule", "params":{"triggerTypeId": "'$2'", "action":{ "deviceId":"'$3'", "name":"rule 1", "actionParams":{"power":"on"}}}}'; sleep 1) | nc $1 1234
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in New Issue