added configuration support for rdp and rlp

This commit is contained in:
Bruce Eckstein 2021-11-04 16:07:46 -04:00
parent a7df246250
commit ba752dc130
3 changed files with 45 additions and 7 deletions

View File

@ -34,17 +34,21 @@ nymea operation:
on the Garadget detail window (uppre righthand corner), you can tune the Garadget configuration for:
Refection Threshold
Button Press Time
Door Moving Time. (you should adjust to the time it takes your door to open)
Door Moving Time. (you should adjust to the time it takes your door to open to prevent garadget indicating stopped unnecessarily)
on the Configure Things page for Garadget, you can tune the Garadget configuration for:
sensor scan interval
multi button press delay (garadget manual labels this consecutive button presses delay)
when changed it takes a couple seconds for Garadget to respond and update the values shown in the nymea window.
notes:
DECKO Garage Door opener requires a ~ 3.3 Volt zener diode in series of the connection between the Garadget and the DECKO
Garadget manual indicates the range of mtt is 1000 to 12000 ms but testing on v1.24 shows it currently only accepts 5000 to 60000 ms (nymea will request other values but Garadget may reject)
Issues: Garadget operating a DECKO garage door opener (may not be issue with other garage door openers)
the Garadget can get confused on the correct relay actions to take if you hit "stop" and then either "open" or "close" when operating a DECKO
It is best to be in direct view of the door if you hit "stop" (the plugin image will be halfway up) to be sure you know where the door will go next.
This confusion is an issue of the Garadget and not of nymea-plugin.
This confusion is an issue of the Garadget device and not of nymea-plugin.
The plugin will show connected as soon as the Garadget connects to the broker.
The plugin will detect if the device is commanded to change broker connection and therefore set state to disconnected.
The plugin will detect if the device is commanded to change broker connection or topic name and therefore set state to disconnected.
The plugin may take 1 minute to show disconnects (power down or breakage).

View File

@ -80,7 +80,7 @@ void IntegrationPluginGaradget::postSetupThing(Thing *thing)
if (name.endsWith("/#")) {
name.chop(2);
}
name = name + "/command";
qCDebug(dcGaradget) << "inside m_pluginTimer with" << name ;
uint updatetime = 30;
m_pluginTimer = hardwareManager()->pluginTimerManager()->registerTimer(updatetime);
@ -91,10 +91,26 @@ void IntegrationPluginGaradget::postSetupThing(Thing *thing)
thing->setStateValue(garadgetConnectedStateTypeId, false);
}
if (thing->stateValue(garadgetConnectedStateTypeId).toBool() == true) {
m_mqttClients.value(thing)->publish(name, "get-status");
m_mqttClients.value(thing)->publish(name + "/command", "get-status");
}
}
});
connect(thing, &Thing::settingChanged, this, [=](const ParamTypeId &settingTypeId, const QVariant &value){
foreach (Thing *thing, myThings()) {
QJsonObject garadgetobj;
if ((thing->stateValue(garadgetConnectedStateTypeId).toBool() == true) && (settingTypeId == garadgetSettingsRdtParamTypeId)){
garadgetobj.insert("rdt", value.toInt());
garadgetobj.insert("rlp", thing->setting(garadgetSettingsRlpParamTypeId).toInt());
QJsonDocument garadgetdoc(garadgetobj);
QByteArray garadgetdata = garadgetdoc.toJson(QJsonDocument::Compact);
QString jsonDoc(garadgetdata);
qCDebug(dcGaradget()) << "Changing Configuration" << garadgetdata;
m_mqttClients.value(thing)->publish(name + "/set-config", garadgetdata);
}
}
});
}
}
@ -247,10 +263,12 @@ void IntegrationPluginGaradget::publishReceived(const QString &topic, const QByt
thing->setStateValue(garadgetSrtStateTypeId,jo.value(QString("srt")).toInt());
thing->setStateValue(garadgetRltStateTypeId,jo.value(QString("rlt")).toInt());
thing->setStateValue(garadgetMttStateTypeId,jo.value(QString("mtt")).toInt());
qCDebug(dcGaradget) << "System Configuration" << "srt =" << thing->stateValue(garadgetSrtStateTypeId).toInt() << "rlt =" << thing->stateValue(garadgetRltStateTypeId).toInt()<< "mtt =" << thing->stateValue(garadgetMttStateTypeId).toInt() * 1000;
thing->setSettingValue(garadgetSettingsRdtParamTypeId,jo.value(QString("rdt")).toInt());
thing->setSettingValue(garadgetSettingsRlpParamTypeId,jo.value(QString("rlp")).toInt());
qCDebug(dcGaradget) << "System Configuration" << "srt =" << thing->stateValue(garadgetSrtStateTypeId).toInt() << "rlt =" << thing->stateValue(garadgetRltStateTypeId).toInt()<< "mtt =" << thing->stateValue(garadgetMttStateTypeId).toInt() << "rdt =" << thing->setting(garadgetSettingsRdtParamTypeId).toUInt() << "rlp =" << thing->setting(garadgetSettingsRlpParamTypeId).toUInt();
}
if (topic.endsWith("/set-config")){
if ( (payload.contains("mqip")) or (payload.contains("mqpt")) ) {
if ( (payload.contains("mqip")) or (payload.contains("mqpt")) or (payload.contains("nme")) ) {
thing->setStateValue(garadgetConnectedStateTypeId, false);
qCDebug(dcGaradget) << "Detected change of Broker msg - set connected to false";
}

View File

@ -25,6 +25,22 @@
}
],
"settingsTypes": [
{
"id": "13ad28d6-15e5-4e20-862b-51062344b576",
"name": "rdt",
"displayName": "sensor scan interval in mS 200-60,000",
"type": "uint",
"defaultValue": 1000
},
{
"id": "6be83c99-cbf0-4d1d-b838-697e442ebb43",
"name": "rlp",
"displayName": "multi button press delay mS 10-5,000",
"type": "uint",
"defaultValue": 1000
}
],
"stateTypes": [
{
"id": "a3d7e6eb-82d0-47ee-b95f-4dde931eb7e2",