Skip to content

Commit

Permalink
DDF add ubisys S2
Browse files Browse the repository at this point in the history
The DDF replaces most part of the C++ implmentation.
S2 was broken since a few releases due code changes.

Note that the Electrical Measurement cluster doesn't support reporting, and Simple Metering cluster only for attribute 0x0400. The rest gets polled.

Like the C4 the button_maps.json was broken due modelid and startsWith() problem.
  • Loading branch information
manup committed Jan 22, 2022
1 parent 14d012f commit 6e094c9
Show file tree
Hide file tree
Showing 5 changed files with 426 additions and 23 deletions.
17 changes: 0 additions & 17 deletions bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2898,7 +2898,6 @@ bool DeRestPluginPrivate::checkSensorBindingsForAttributeReporting(Sensor *senso
// ubisys
sensor->modelId().startsWith(QLatin1String("D1")) ||
sensor->modelId().startsWith(QLatin1String("S1")) ||
sensor->modelId().startsWith(QLatin1String("S2")) ||
// IKEA
sensor->modelId().startsWith(QLatin1String("TRADFRI")) ||
sensor->modelId().startsWith(QLatin1String("Remote Control N2")) || // STYRBAR
Expand Down Expand Up @@ -3941,14 +3940,6 @@ bool DeRestPluginPrivate::checkSensorBindingsForClientClusters(Sensor *sensor)
}
sensor->setMgmtBindSupported(true);
}
else if (sensor->modelId().startsWith(QLatin1String("S2")))
{
clusters.push_back(ONOFF_CLUSTER_ID);
clusters.push_back(LEVEL_CLUSTER_ID);
srcEndpoints.push_back(0x03);
srcEndpoints.push_back(0x04);
sensor->setMgmtBindSupported(true);
}
// Bitron remote control
else if (sensor->modelId().startsWith(QLatin1String("902010/23")))
{
Expand Down Expand Up @@ -4445,14 +4436,6 @@ void DeRestPluginPrivate::processUbisysBinding(Sensor *sensor, const Binding &bn
if (bnd.srcEndpoint == 0x02) { pos = 0; }
else if (bnd.srcEndpoint == 0x03) { pos = 1; } // S1-R only
}
else if (sensor->modelId().startsWith(QLatin1String("S2")))
{
DBG_Assert(sensor->fingerPrint().endpoint == 0x03);

if (bnd.srcEndpoint == 0x03) { pos = 0; }
else if (bnd.srcEndpoint == 0x04) { pos = 1; }

}
else
{
return;
Expand Down
2 changes: 1 addition & 1 deletion button_maps.json
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@
"ubisysS2Map": {
"vendor": "Ubisys",
"doc": "Power switch S2",
"modelids": ["S2"],
"modelids": ["S2 (5502)", "S2"],
"map": [
[1, "0x03", "ONOFF", "TOGGLE", "0", "S_BUTTON_1", "S_BUTTON_ACTION_SHORT_RELEASED", "Toggle"],
[1, "0x03", "LEVEL_CONTROL", "MOVE_WITH_ON_OFF", "0", "S_BUTTON_1", "S_BUTTON_ACTION_HOLD", "Move up (with on/off)"],
Expand Down
6 changes: 2 additions & 4 deletions de_web_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ static const SupportedDevice supportedDevices[] = {
{ VENDOR_UBISYS, "D1", ubisysMacPrefix },
{ VENDOR_UBISYS, "J1", ubisysMacPrefix },
{ VENDOR_UBISYS, "S1", ubisysMacPrefix },
{ VENDOR_UBISYS, "S2", ubisysMacPrefix },
{ VENDOR_NONE, "Z716A", netvoxMacPrefix },
// { VENDOR_OSRAM_STACK, "Plug", osramMacPrefix }, // OSRAM plug - exposed only as light
{ VENDOR_OSRAM, "Lightify Switch Mini", emberMacPrefix }, // Osram 3 button remote
Expand Down Expand Up @@ -6516,8 +6515,7 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const deCONZ::
{
if ((modelId.startsWith(QLatin1String("D1")) && i->endpoint() == 0x02) ||
(modelId.startsWith(QLatin1String("J1")) && i->endpoint() == 0x02) ||
(modelId.startsWith(QLatin1String("S1")) && i->endpoint() == 0x02) ||
(modelId.startsWith(QLatin1String("S2")) && i->endpoint() == 0x03))
(modelId.startsWith(QLatin1String("S1")) && i->endpoint() == 0x02))
{
// Combine multiple switch endpoints into a single ZHASwitch resource
fpSwitch.outClusters.push_back(ci->id());
Expand Down Expand Up @@ -10770,7 +10768,7 @@ bool DeRestPluginPrivate::processZclAttributes(Sensor *sensorNode)
// whitelist by Model ID
if (sensorNode->modelId().startsWith(QLatin1String("FLS-NB")) ||
sensorNode->modelId().startsWith(QLatin1String("D1")) || sensorNode->modelId().startsWith(QLatin1String("S1")) ||
sensorNode->modelId().startsWith(QLatin1String("S2")) || sensorNode->manufacturer().startsWith(QLatin1String("BEGA")))
sensorNode->manufacturer().startsWith(QLatin1String("BEGA")))
{
ok = true;
}
Expand Down
Loading

0 comments on commit 6e094c9

Please sign in to comment.