fixed rule connection
This commit is contained in:
parent
42d2489334
commit
a89ae7bdff
@ -21,6 +21,7 @@ DeviceManager::DeviceManager(QObject *parent) :
|
|||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
m_radio433 = new Radio433(this);
|
m_radio433 = new Radio433(this);
|
||||||
|
connect(m_radio433, &Radio433::dataReceived, this, &DeviceManager::radio433SignalReceived);
|
||||||
|
|
||||||
QMetaObject::invokeMethod(this, "loadPlugins", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(this, "loadPlugins", Qt::QueuedConnection);
|
||||||
QMetaObject::invokeMethod(this, "loadConfiguredDevices", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(this, "loadConfiguredDevices", Qt::QueuedConnection);
|
||||||
|
|||||||
@ -7,8 +7,8 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
QUuid elroRemote = QUuid("d85c1ef4-197c-4053-8e40-707aa671d302");
|
QUuid elroRemoteId = QUuid("d85c1ef4-197c-4053-8e40-707aa671d302");
|
||||||
QUuid elroDevicePlugin = QUuid("308ae6e6-38b3-4b3a-a513-3199da2764f8");
|
QUuid elroSwitchId = QUuid("308ae6e6-38b3-4b3a-a513-3199da2764f8");
|
||||||
|
|
||||||
DevicePluginElro::DevicePluginElro()
|
DevicePluginElro::DevicePluginElro()
|
||||||
{
|
{
|
||||||
@ -20,8 +20,8 @@ QList<DeviceClass> DevicePluginElro::supportedDevices() const
|
|||||||
QList<DeviceClass> ret;
|
QList<DeviceClass> ret;
|
||||||
|
|
||||||
// Remote
|
// Remote
|
||||||
DeviceClass deviceClassDevicePluginElro(pluginId(), elroRemote);
|
DeviceClass deviceClassElroRemote(pluginId(), elroRemoteId);
|
||||||
deviceClassDevicePluginElro.setName("Elro Remote");
|
deviceClassElroRemote.setName("Elro Remote");
|
||||||
|
|
||||||
QVariantList deviceParamsRemote;
|
QVariantList deviceParamsRemote;
|
||||||
QVariantMap channelParam;
|
QVariantMap channelParam;
|
||||||
@ -41,7 +41,7 @@ QList<DeviceClass> DevicePluginElro::supportedDevices() const
|
|||||||
channelParam.insert("type", "bool");
|
channelParam.insert("type", "bool");
|
||||||
deviceParamsRemote.append(channelParam);
|
deviceParamsRemote.append(channelParam);
|
||||||
|
|
||||||
deviceClassDevicePluginElro.setParams(deviceParamsRemote);
|
deviceClassElroRemote.setParams(deviceParamsRemote);
|
||||||
|
|
||||||
QList<TriggerType> buttonTriggers;
|
QList<TriggerType> buttonTriggers;
|
||||||
|
|
||||||
@ -76,12 +76,12 @@ QList<DeviceClass> DevicePluginElro::supportedDevices() const
|
|||||||
buttonETrigger.setParameters(paramsRemote);
|
buttonETrigger.setParameters(paramsRemote);
|
||||||
buttonTriggers.append(buttonETrigger);
|
buttonTriggers.append(buttonETrigger);
|
||||||
|
|
||||||
deviceClassDevicePluginElro.setTriggers(buttonTriggers);
|
deviceClassElroRemote.setTriggers(buttonTriggers);
|
||||||
ret.append(deviceClassDevicePluginElro);
|
ret.append(deviceClassElroRemote);
|
||||||
|
|
||||||
// Switch
|
// Switch
|
||||||
DeviceClass deviceClassRfSwitchMumbi(pluginId(), elroDevicePlugin);
|
DeviceClass deviceClassElroSwitch(pluginId(), elroSwitchId);
|
||||||
deviceClassRfSwitchMumbi.setName("Elro Power Switch");
|
deviceClassElroSwitch.setName("Elro Power Switch");
|
||||||
|
|
||||||
QVariantList deviceParamsSwitch;
|
QVariantList deviceParamsSwitch;
|
||||||
QVariantMap paramSwitch;
|
QVariantMap paramSwitch;
|
||||||
@ -116,22 +116,24 @@ QList<DeviceClass> DevicePluginElro::supportedDevices() const
|
|||||||
paramSwitch.insert("type", "bool");
|
paramSwitch.insert("type", "bool");
|
||||||
deviceParamsSwitch.append(paramSwitch);
|
deviceParamsSwitch.append(paramSwitch);
|
||||||
|
|
||||||
QVariantList paramsSwitch;
|
deviceClassElroSwitch.setParams(deviceParamsSwitch);
|
||||||
|
|
||||||
|
|
||||||
|
QVariantList actionParamsSwitch;
|
||||||
QVariantMap actionParamSwitch;
|
QVariantMap actionParamSwitch;
|
||||||
actionParamSwitch.insert("name", "power");
|
actionParamSwitch.insert("name", "power");
|
||||||
actionParamSwitch.insert("type", "bool");
|
actionParamSwitch.insert("type", "bool");
|
||||||
paramsSwitch.append(actionParamSwitch);
|
actionParamsSwitch.append(actionParamSwitch);
|
||||||
|
|
||||||
|
|
||||||
QList<ActionType> switchActions;
|
QList<ActionType> switchActions;
|
||||||
|
|
||||||
ActionType powerAction(QUuid("31c9758e-6567-4f89-85bb-29e1a7c55d44"));
|
ActionType powerAction(QUuid("31c9758e-6567-4f89-85bb-29e1a7c55d44"));
|
||||||
powerAction.setName("power");
|
powerAction.setName("power");
|
||||||
powerAction.setParameters(paramsSwitch);
|
powerAction.setParameters(actionParamsSwitch);
|
||||||
switchActions.append(powerAction);
|
switchActions.append(powerAction);
|
||||||
|
|
||||||
deviceClassRfSwitchMumbi.setActions(switchActions);
|
deviceClassElroSwitch.setActions(switchActions);
|
||||||
ret.append(deviceClassRfSwitchMumbi);
|
ret.append(deviceClassElroSwitch);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,7 +252,7 @@ void DevicePluginElro::receiveData(QList<int> rawData)
|
|||||||
if(rawData.length() != 49){
|
if(rawData.length() != 49){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int delay = rawData.first()/31;
|
int delay = rawData.first()/31;
|
||||||
QByteArray binCode;
|
QByteArray binCode;
|
||||||
|
|
||||||
@ -332,7 +334,7 @@ void DevicePluginElro::receiveData(QList<int> rawData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Device *device = 0;
|
Device *device = 0;
|
||||||
QList<Device*> deviceList = deviceManager()->findConfiguredDevices(elroRemote);
|
QList<Device*> deviceList = deviceManager()->findConfiguredDevices(elroRemoteId);
|
||||||
foreach (Device *dev, deviceList) {
|
foreach (Device *dev, deviceList) {
|
||||||
if (dev->params().contains("channel1") && dev->params().value("channel1").toBool() == group.at(0) &&
|
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) &&
|
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"
|
echo "usage $0 host"
|
||||||
else
|
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": "{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
|
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClass": "{ab73ad2f-6594-45a3-9063-8f72d365c5e5}","deviceParams":{"familycode":"J"}}}'; sleep 1) | nc $1 1234
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -3,5 +3,5 @@
|
|||||||
if test -z $3; then
|
if test -z $3; then
|
||||||
echo "usage: $1 host triggerId actionId"
|
echo "usage: $1 host triggerId actionId"
|
||||||
else
|
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
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user