mirror of https://github.com/nymea/nymea.git
fix git chaos
Merge branch 'master' of https://github.com/HiveFive/Hive Conflicts: tests/addconfigureddevice.shpull/1/head
commit
23c1ba123f
|
|
@ -89,6 +89,18 @@ QList<Device *> DeviceManager::findConfiguredDevices(const QUuid &deviceClassId)
|
|||
return ret;
|
||||
}
|
||||
|
||||
DeviceClass DeviceManager::findDeviceClassforTrigger(const QUuid &triggerTypeId)
|
||||
{
|
||||
foreach (const DeviceClass &deviceClass, m_supportedDevices) {
|
||||
foreach (const TriggerType &triggerType, deviceClass.triggers()) {
|
||||
if (triggerType.id() == triggerTypeId) {
|
||||
return deviceClass;
|
||||
}
|
||||
}
|
||||
}
|
||||
return DeviceClass(QUuid(), QUuid());
|
||||
}
|
||||
|
||||
DeviceClass DeviceManager::findDeviceClass(const QUuid &deviceClassId)
|
||||
{
|
||||
foreach (const DeviceClass &deviceClass, m_supportedDevices) {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ public:
|
|||
|
||||
Device* findConfiguredDevice(const QUuid &id) const;
|
||||
QList<Device*> findConfiguredDevices(const QUuid &deviceClassId);
|
||||
DeviceClass findDeviceClassforTrigger(const QUuid &triggerTypeId);
|
||||
DeviceClass findDeviceClass(const QUuid &deviceClassId);
|
||||
|
||||
signals:
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Radio433::Radio433(QObject *parent) :
|
|||
m_transmitter->setDirection(OUTPUT);
|
||||
m_transmitter->setValue(LOW);
|
||||
|
||||
connect(m_receiver,SIGNAL(pinInterrupt()),this,SLOT(handleInterrupt()));
|
||||
connect(m_receiver, &Gpio::pinInterrupt, this, &Radio433::handleInterrupt);
|
||||
|
||||
m_receiver->start();
|
||||
}
|
||||
|
|
@ -46,6 +46,7 @@ void Radio433::sendData(QList<int> rawData)
|
|||
}
|
||||
m_transmitter->setValue(LOW);
|
||||
// re-enable it
|
||||
m_transmitter->setValue(LOW);
|
||||
m_receiver->start();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,7 +211,9 @@ void DevicePluginIntertechno::executeAction(Device *device, const Action &action
|
|||
}
|
||||
|
||||
void DevicePluginIntertechno::receiveData(QList<int> rawData)
|
||||
{
|
||||
{
|
||||
|
||||
|
||||
// filter right here a wrong signal length
|
||||
if(rawData.length() != 49){
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -120,9 +120,10 @@ void JsonRPCServer::handleRulesMessage(int clientId, int commandId, const QStrin
|
|||
QVariantMap triggerParams = triggerMap.value("params").toMap();
|
||||
Trigger trigger(triggerTypeId, triggerDeviceId, triggerParams);
|
||||
|
||||
Action action(params.value("deviceId").toString());
|
||||
action.setName(params.value("name").toString());
|
||||
action.setParams(params.value("params").toMap());
|
||||
QVariantMap actionMap = params.value("action").toMap();
|
||||
Action action(actionMap.value("deviceId").toString());
|
||||
action.setName(actionMap.value("name").toString());
|
||||
action.setParams(actionMap.value("params").toMap());
|
||||
|
||||
switch(HiveCore::instance()->ruleEngine()->addRule(trigger, action)) {
|
||||
case RuleEngine::RuleErrorNoError:
|
||||
|
|
|
|||
|
|
@ -51,13 +51,14 @@ QList<Action> RuleEngine::evaluateTrigger(const Trigger &trigger)
|
|||
|
||||
RuleEngine::RuleError RuleEngine::addRule(const Trigger &trigger, const Action &action)
|
||||
{
|
||||
|
||||
qDebug() << "adding rule: Trigger:" << trigger.triggerTypeId() << "deviceid:" << action.deviceId();
|
||||
Device *device = HiveCore::instance()->deviceManager()->findConfiguredDevice(trigger.deviceId());
|
||||
if (!device) {
|
||||
qWarning() << "Cannot create rule. No configured device for triggerTypeId" << trigger.triggerTypeId();
|
||||
return RuleErrorDeviceNotFound;
|
||||
}
|
||||
DeviceClass deviceClass = HiveCore::instance()->deviceManager()->findDeviceClass(device->deviceClassId());
|
||||
qDebug() << "found deviceClass" << deviceClass.name();
|
||||
|
||||
bool triggerTypeFound = false;
|
||||
foreach (const TriggerType &triggerType, deviceClass.triggers()) {
|
||||
|
|
|
|||
|
|
@ -2,12 +2,23 @@
|
|||
|
||||
# Creates a Mumbi remote
|
||||
if [ -z $1 ]; then
|
||||
echo "usage $0 host"
|
||||
echo "usage $0 host device"
|
||||
elif [ $1 == "list" ]; then
|
||||
echo "elroremote elroswitch intertechnoremote meisteranker"
|
||||
elif [ -z $2 ]; then
|
||||
echo "usage $0 host device"
|
||||
else
|
||||
# Adds an ELRO remote control on channel 00000
|
||||
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClass": "{d85c1ef4-197c-4053-8e40-707aa671d302}","params":{"channel1":"false", "channel2":"false", "channel3":"false", "channel4": "false", "channel5":"false" }}}'; sleep 1) | nc $1 1234
|
||||
# Adds a ELRO power switch on channel 00000 and group B
|
||||
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClass": "{308ae6e6-38b3-4b3a-a513-3199da2764f8}","params":{"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
|
||||
# Adds an intertechno remote control
|
||||
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClass": "{ab73ad2f-6594-45a3-9063-8f72d365c5e5}","params":{"familyCode":"J"}}}'; sleep 1) | nc $1 1234
|
||||
if [ $2 == "elroremote" ]; then
|
||||
# Adds an ELRO remote control on channel 00000
|
||||
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClass": "{d85c1ef4-197c-4053-8e40-707aa671d302}","params":{"channel1":"false", "channel2":"false", "channel3":"false", "channel4": "false", "channel5":"false" }}}'; sleep 1) | nc $1 1234
|
||||
elif [ $2 == "elroswitch" ]; then
|
||||
# Adds a ELRO power switch on channel 00000 and group E
|
||||
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClass": "{308ae6e6-38b3-4b3a-a513-3199da2764f8}","params":{"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
|
||||
elif [ $2 == "intertechnoremote" ]; then
|
||||
# Adds an intertechno remote control
|
||||
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClass": "{ab73ad2f-6594-45a3-9063-8f72d365c5e5}","params":{"familyCode":"J"}}}'; sleep 1) | nc $1 1234
|
||||
elif [ $2 == "meisteranker" ]; then
|
||||
# Adds an intertechno remote control
|
||||
(echo '{"id":1, "method":"Devices.AddConfiguredDevice", "params":{"deviceClass": "{e37e9f34-95b9-4a22-ae4f-e8b874eec871}","params":{"id":"1"}}}'; sleep 1) | nc $1 1234
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@
|
|||
if test -z $3; then
|
||||
echo "usage: $1 host triggerId actionId"
|
||||
else
|
||||
(echo '{"id":1, "method":"Rules.AddRule", "params":{"triggerTypeId": "'$2'", "action":{ "deviceId":"'$3'", "name":"rule 1", "actionParams":{"power":"true"}}}}'; sleep 1) | nc $1 1234
|
||||
(echo '{"id":2, "method":"Rules.AddRule", "params":{"triggerTypeId": "'$2'", "action":{ "deviceId":"'$3'", "name":"rule 2", "actionParams":{"power":"false"}}}}'; sleep 1) | nc $1 1234
|
||||
(echo '{"id":1, "method":"Rules.AddRule", "params":{"trigger": {"triggerTypeId": "'$2'", "deviceId":"'$3'", "params":{"power":"true"}}, "action":{ "deviceId":"'$4'", "name":"rule 1", "params":{"power":"true"}}}}'; sleep 1) | nc $1 1234
|
||||
(echo '{"id":1, "method":"Rules.AddRule", "params":{"trigger": {"triggerTypeId": "'$2'", "deviceId":"'$3'", "params":{"power":"false"}}, "action":{ "deviceId":"'$4'", "name":"rule 1", "params":{"power":"false"}}}}'; sleep 1) | nc $1 1234
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in New Issue