Skip to content

Commit

Permalink
Merge branch 'ubisys_s2'
Browse files Browse the repository at this point in the history
  • Loading branch information
manup committed Jan 27, 2022
2 parents 3bdf256 + 7fc53a9 commit 56239c2
Show file tree
Hide file tree
Showing 5 changed files with 434 additions and 12 deletions.
7 changes: 3 additions & 4 deletions bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2898,7 +2898,7 @@ bool DeRestPluginPrivate::checkSensorBindingsForAttributeReporting(Sensor *senso
// ubisys
sensor->modelId().startsWith(QLatin1String("D1")) ||
sensor->modelId().startsWith(QLatin1String("S1-R")) ||
sensor->modelId().startsWith(QLatin1String("S2")) ||
sensor->modelId().startsWith(QLatin1String("S2-R")) ||
// IKEA
sensor->modelId().startsWith(QLatin1String("TRADFRI")) ||
sensor->modelId().startsWith(QLatin1String("Remote Control N2")) || // STYRBAR
Expand Down Expand Up @@ -3941,7 +3941,7 @@ bool DeRestPluginPrivate::checkSensorBindingsForClientClusters(Sensor *sensor)
}
sensor->setMgmtBindSupported(true);
}
else if (sensor->modelId().startsWith(QLatin1String("S2")))
else if (sensor->modelId().startsWith(QLatin1String("S2-R")))
{
clusters.push_back(ONOFF_CLUSTER_ID);
clusters.push_back(LEVEL_CLUSTER_ID);
Expand Down Expand Up @@ -4445,13 +4445,12 @@ 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")))
else if (sensor->modelId().startsWith(QLatin1String("S2-R")))
{
DBG_Assert(sensor->fingerPrint().endpoint == 0x03);

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

}
else
{
Expand Down
2 changes: 1 addition & 1 deletion button_maps.json
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@
"ubisysS2Map": {
"vendor": "Ubisys",
"doc": "Power switch S2",
"modelids": ["S2"],
"modelids": ["S2 (5502)", "S2", "S2-R"],
"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
13 changes: 7 additions & 6 deletions de_web_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ static const SupportedDevice supportedDevices[] = {
{ VENDOR_UBISYS, "D1", ubisysMacPrefix },
{ VENDOR_UBISYS, "J1", ubisysMacPrefix },
{ VENDOR_UBISYS, "S1", ubisysMacPrefix },
{ VENDOR_UBISYS, "S2", ubisysMacPrefix },
{ VENDOR_UBISYS, "S2-R", 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 @@ -1222,6 +1222,7 @@ void DeRestPluginPrivate::apsdeDataIndication(const deCONZ::ApsDataIndication &i

if ((ind.profileId() == HA_PROFILE_ID) || (ind.profileId() == ZLL_PROFILE_ID))
{
const bool devManaged = device && device->managed();
{
QDataStream stream(ind.asdu());
stream.setByteOrder(QDataStream::LittleEndian);
Expand Down Expand Up @@ -1260,11 +1261,11 @@ void DeRestPluginPrivate::apsdeDataIndication(const deCONZ::ApsDataIndication &i
break;

case METERING_CLUSTER_ID:
if (!DEV_TestStrict()) { handleSimpleMeteringClusterIndication(ind, zclFrame); }
if (!DEV_TestStrict() && !devManaged) { handleSimpleMeteringClusterIndication(ind, zclFrame); }
break;

case ELECTRICAL_MEASUREMENT_CLUSTER_ID:
if (!DEV_TestStrict()) { handleElectricalMeasurementClusterIndication(ind, zclFrame); }
if (!DEV_TestStrict() && !devManaged) { handleElectricalMeasurementClusterIndication(ind, zclFrame); }
break;

case IAS_ZONE_CLUSTER_ID:
Expand Down Expand Up @@ -1300,7 +1301,7 @@ void DeRestPluginPrivate::apsdeDataIndication(const deCONZ::ApsDataIndication &i
break;

case WINDOW_COVERING_CLUSTER_ID:
if (!DEV_TestStrict()) { handleWindowCoveringClusterIndication(ind, zclFrame); }
if (!DEV_TestStrict() && !devManaged) { handleWindowCoveringClusterIndication(ind, zclFrame); }
break;

case TUYA_CLUSTER_ID:
Expand Down Expand Up @@ -6521,7 +6522,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-R")) && i->endpoint() == 0x02) ||
(modelId.startsWith(QLatin1String("S2")) && i->endpoint() == 0x03))
(modelId.startsWith(QLatin1String("S2-R")) && i->endpoint() == 0x03))
{
// Combine multiple switch endpoints into a single ZHASwitch resource
fpSwitch.outClusters.push_back(ci->id());
Expand Down Expand Up @@ -10774,7 +10775,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-R")) ||
sensorNode->modelId().startsWith(QLatin1String("S2")) || sensorNode->manufacturer().startsWith(QLatin1String("BEGA")))
sensorNode->modelId().startsWith(QLatin1String("S2-R")) || sensorNode->manufacturer().startsWith(QLatin1String("BEGA")))
{
ok = true;
}
Expand Down
Loading

0 comments on commit 56239c2

Please sign in to comment.