Skip to content

Commit 7a49819

Browse files
committed
Merge remote-tracking branch 'Smanar/master'
2 parents b89afbf + 9b16689 commit 7a49819

6 files changed

+132
-21
lines changed

bindings.cpp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,8 +1980,11 @@ bool DeRestPluginPrivate::checkSensorBindingsForAttributeReporting(Sensor *senso
19801980
sensor->modelId() == QLatin1String("Dimmer switch w/o neutral") || //Legrand dimmer wired
19811981
sensor->modelId() == QLatin1String("Cable outlet") || //Legrand Cable outlet
19821982
sensor->modelId() == QLatin1String("Remote switch") || //Legrand wireless switch
1983+
sensor->modelId() == QLatin1String("Double gangs remote switch") || //Legrand wireless double switch
19831984
sensor->modelId() == QLatin1String("Shutters central remote switch") || //Legrand wireless shutter switch
19841985
sensor->modelId() == QLatin1String("DIN power consumption module") || //Legrand DIN power consumption module
1986+
sensor->modelId() == QLatin1String("Remote motion sensor") || //Legrand Motion detector
1987+
sensor->modelId() == QLatin1String("Remote toggle switch") || //Legrand switch module
19851988
// ORVIBO
19861989
sensor->modelId().startsWith(QLatin1String("SN10ZW")) ||
19871990
sensor->modelId().startsWith(QLatin1String("SF2")) ||
@@ -2117,9 +2120,9 @@ bool DeRestPluginPrivate::checkSensorBindingsForAttributeReporting(Sensor *senso
21172120
{
21182121
continue; // process only once
21192122
}
2120-
if (sensor->modelId() == QLatin1String("Remote switch") || sensor->modelId() == QLatin1String("Shutters central remote switch") )
2123+
if (sensor->modelId() == QLatin1String("Remote switch") || sensor->modelId() == QLatin1String("Shutters central remote switch") || sensor->modelId() == QLatin1String("Double gangs remote switch") )
21212124
{
2122-
//This device don't support report attribute
2125+
//Those device don't support report attribute
21232126
continue;
21242127
}
21252128
if (sensor->manufacturer().startsWith(QLatin1String("Climax")) ||
@@ -2136,6 +2139,7 @@ bool DeRestPluginPrivate::checkSensorBindingsForAttributeReporting(Sensor *senso
21362139
sensor->modelId() == QLatin1String("Zen-01") ||
21372140
sensor->modelId() == QLatin1String("Remote switch") ||
21382141
sensor->modelId() == QLatin1String("Shutters central remote switch") ||
2142+
sensor->modelId() == QLatin1String("Double gangs remote switch") ||
21392143
sensor->modelId().startsWith(QLatin1String("ZHMS101")) ||
21402144
sensor->modelId().endsWith(QLatin1String("86opcn01")) || // Aqara Opple
21412145
sensor->modelId().startsWith(QLatin1String("1116-S")) ||
@@ -2478,8 +2482,9 @@ bool DeRestPluginPrivate::checkSensorBindingsForClientClusters(Sensor *sensor)
24782482
// clusters.push_back(LEVEL_CLUSTER_ID);
24792483
// srcEndpoints.push_back(sensor->fingerPrint().endpoint);
24802484
// }
2481-
// LEGRAND Remote switch
2482-
else if (sensor->modelId() == QLatin1String("Remote switch"))
2485+
// LEGRAND Remote switch, simple and double
2486+
else if (sensor->modelId() == QLatin1String("Remote switch") ||
2487+
sensor->modelId() == QLatin1String("Double gangs remote switch"))
24832488
{
24842489
clusters.push_back(ONOFF_CLUSTER_ID);
24852490
clusters.push_back(LEVEL_CLUSTER_ID);
@@ -2491,6 +2496,12 @@ bool DeRestPluginPrivate::checkSensorBindingsForClientClusters(Sensor *sensor)
24912496
clusters.push_back(WINDOW_COVERING_CLUSTER_ID);
24922497
srcEndpoints.push_back(sensor->fingerPrint().endpoint);
24932498
}
2499+
else if (sensor->modelId() == QLatin1String("Remote toggle switch") || // LEGRAND switch micro module
2500+
sensor->modelId() == QLatin1String("Remote motion sensor")) //Legrand motion sensor
2501+
{
2502+
clusters.push_back(ONOFF_CLUSTER_ID);
2503+
srcEndpoints.push_back(sensor->fingerPrint().endpoint);
2504+
}
24942505
else if (sensor->modelId().startsWith(QLatin1String("RC 110")))
24952506
{
24962507
clusters.push_back(ONOFF_CLUSTER_ID);
@@ -2692,7 +2703,10 @@ void DeRestPluginPrivate::checkSensorGroup(Sensor *sensor)
26922703

26932704
}
26942705
else if (sensor->modelId() == QLatin1String("Remote switch") ||
2695-
sensor->modelId() == QLatin1String("Shutters central remote switch"))
2706+
sensor->modelId() == QLatin1String("Double gangs remote switch") ||
2707+
sensor->modelId() == QLatin1String("Shutters central remote switch") ||
2708+
sensor->modelId() == QLatin1String("Remote toggle switch") ||
2709+
sensor->modelId() == QLatin1String("Remote motion sensor"))
26962710
{
26972711
//Make group but without uniqueid
26982712
}

de_web_plugin.cpp

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ const quint64 heimanMacPrefix = 0x0050430000000000ULL;
8585
const quint64 xiaomiMacPrefix = 0x04cf8c0000000000ULL;
8686
const quint64 konkeMacPrefix = 0x086bd70000000000ULL;
8787
const quint64 ikea2MacPrefix = 0x14b4570000000000ULL;
88+
const quint64 profaluxMacPrefix = 0x20918a0000000000ULL;
8889
const quint64 stMacPrefix = 0x24fd5b0000000000ULL;
8990
const quint64 samjinMacPrefix = 0x286d970000000000ULL;
9091
const quint64 sinopeMacPrefix = 0x500b910000000000ULL;
@@ -267,8 +268,11 @@ static const SupportedDevice supportedDevices[] = {
267268
{ VENDOR_LEGRAND, "Dimmer switch w/o neutral", legrandMacPrefix }, // Legrand Dimmer switch wired
268269
{ VENDOR_LEGRAND, "Connected outlet", legrandMacPrefix }, // Legrand Plug
269270
{ VENDOR_LEGRAND, "Shutter switch with neutral", legrandMacPrefix }, // Legrand Shutter switch
271+
{ VENDOR_LEGRAND, "Remote toggle switch", legrandMacPrefix }, // Legrand switch module
270272
{ VENDOR_LEGRAND, "Cable outlet", legrandMacPrefix }, // Legrand Cable outlet
271273
{ VENDOR_LEGRAND, "Remote switch", legrandMacPrefix }, // Legrand wireless switch
274+
{ VENDOR_LEGRAND, "Double gangs remote switch", legrandMacPrefix }, // Legrand wireless double switch
275+
{ VENDOR_LEGRAND, "Remote motion sensor", legrandMacPrefix }, // Legrand motion sensor
272276
{ VENDOR_LEGRAND, "Shutters central remote switch", legrandMacPrefix }, // Legrand wireless shutter switch (battery)
273277
{ VENDOR_LEGRAND, "DIN power consumption module", legrandMacPrefix }, // Legrand DIN power consumption module
274278
{ VENDOR_NETVOX, "Z809AE3R", netvoxMacPrefix }, // Netvox smartplug
@@ -1816,6 +1820,15 @@ void DeRestPluginPrivate::addLightNode(const deCONZ::Node *node)
18161820
}
18171821
break;
18181822

1823+
case DEV_ID_CONSUMPTION_AWARENESS_DEVICE:
1824+
{
1825+
if (node->nodeDescriptor().manufacturerCode() == VENDOR_LEGRAND)
1826+
{
1827+
lightNode.setHaEndpoint(*i);
1828+
}
1829+
}
1830+
break;
1831+
18191832
default:
18201833
{
18211834
}
@@ -1971,6 +1984,18 @@ void DeRestPluginPrivate::addLightNode(const deCONZ::Node *node)
19711984
{ q->nodeUpdated(lightNode.address().ext(), QLatin1String("modelid"), lightNode.modelId()); }
19721985
}
19731986

1987+
//Add missing values for Profalux device
1988+
if (checkMacVendor(node->address(), VENDOR_PROFALUX))
1989+
{
1990+
//Shutter ?
1991+
if (i->deviceId() == DEV_ID_ZLL_COLOR_LIGHT)
1992+
{
1993+
lightNode.setManufacturerName(QLatin1String("Profalux"));
1994+
lightNode.setModelId(QLatin1String("PFLX Shutter"));
1995+
lightNode.setNeedSaveDatabase(true);
1996+
}
1997+
}
1998+
19741999
// "translate" ORVIBO vendor name
19752000
if (lightNode.manufacturer() == QString("欧瑞博"))
19762001
{
@@ -3332,12 +3357,11 @@ void DeRestPluginPrivate::checkSensorButtonEvent(Sensor *sensor, const deCONZ::A
33323357
sensor->previousSequenceNumber = zclFrame.sequenceNumber();
33333358
checkReporting = true;
33343359
}
3335-
else if (sensor->modelId() == QLatin1String("Remote switch")) // legrand switch
3336-
{
3337-
checkReporting = true;
3338-
checkClientCluster = true;
3339-
}
3340-
else if (sensor->modelId() == QLatin1String("Shutters central remote switch")) // legrand shutter switch
3360+
else if (sensor->modelId() == QLatin1String("Remote switch") || //legrand switch
3361+
sensor->modelId() == QLatin1String("Double gangs remote switch") || //Legrand micro module
3362+
sensor->modelId() == QLatin1String("Shutters central remote switch") || // legrand shutter switch
3363+
sensor->modelId() == QLatin1String("Remote motion sensor") || // legrand motion sensor
3364+
sensor->modelId() == QLatin1String("Remote toggle switch")) // legrand switch simple and double
33413365
{
33423366
checkReporting = true;
33433367
checkClientCluster = true;
@@ -4263,10 +4287,12 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const deCONZ::
42634287

42644288
case BINARY_INPUT_CLUSTER_ID:
42654289
{
4266-
if (modelId.startsWith(QLatin1String("tagv4"))) // SmartThings Arrival sensor
4290+
if ( (modelId.startsWith(QLatin1String("tagv4"))) || // SmartThings Arrival sensor
4291+
( modelId == QLatin1String("Remote motion sensor") )) // Legrand motion sensor
42674292
{
42684293
fpPresenceSensor.inClusters.push_back(ci->id());
42694294
}
4295+
42704296
}
42714297
break;
42724298

@@ -5513,7 +5539,7 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const SensorFi
55135539
else if (*ci == POWER_CONFIGURATION_CLUSTER_ID)
55145540
{
55155541
//This device make a Rejoin every time, you trigger it, it's the only moment where you can read attribute.
5516-
if (sensorNode.modelId() == QLatin1String("Remote switch") || sensorNode.modelId() == QLatin1String("Shutters central remote switch") )
5542+
if (sensorNode.modelId() == QLatin1String("Remote switch") || sensorNode.modelId() == QLatin1String("Shutters central remote switch") || sensorNode.modelId() == QLatin1String("Double gangs remote switch") )
55175543
{
55185544
//Ask for battery but only every day max
55195545
//int diff = idleTotalCounter - sensorNode.lastRead(READ_BATTERY);
@@ -6084,7 +6110,10 @@ void DeRestPluginPrivate::updateSensorNode(const deCONZ::NodeEvent &event)
60846110
i->modelId().startsWith(QLatin1String("motionv4")) ||// SmartThings motion sensor
60856111
i->modelId().startsWith(QLatin1String("3305-S")) || // SmartThings 2014 motion sensor
60866112
i->modelId() == QLatin1String("Remote switch") || // Legrand switch
6087-
i->modelId() == QLatin1String("Shutters central remote switch") || //Legrand shutter switch
6113+
i->modelId() == QLatin1String("Double gangs remote switch") || // Legrand switch double
6114+
i->modelId() == QLatin1String("Shutters central remote switch") || // Legrand switch module
6115+
i->modelId() == QLatin1String("Remote toggle switch") || //Legrand shutter switch
6116+
i->modelId() == QLatin1String("Remote motion sensor") || //Legrand motion sensor
60886117
i->modelId() == QLatin1String("Zen-01") || // Zen thermostat
60896118
i->modelId() == QLatin1String("Thermostat") || // eCozy thermostat
60906119
i->modelId() == QLatin1String("Motion Sensor-A") || // Osram motion sensor
@@ -9819,8 +9848,8 @@ void DeRestPluginPrivate::handleZclAttributeReportIndication(const deCONZ::ApsDa
98199848
sendZclDefaultResponse(ind, zclFrame, deCONZ::ZclSuccessStatus);
98209849
}
98219850
else if (checkMacVendor(ind.srcAddress(), VENDOR_PHILIPS) ||
9822-
macPrefix == tiMacPrefix ||
9823-
checkMacVendor(ind.srcAddress(), VENDOR_DDEL) ||
9851+
macPrefix == tiMacPrefix ||
9852+
checkMacVendor(ind.srcAddress(), VENDOR_DDEL) ||
98249853
checkMacVendor(ind.srcAddress(), VENDOR_IKEA) ||
98259854
checkMacVendor(ind.srcAddress(), VENDOR_OSRAM_STACK) ||
98269855
checkMacVendor(ind.srcAddress(), VENDOR_JENNIC) ||
@@ -14649,7 +14678,10 @@ void DeRestPluginPrivate::delayedFastEnddeviceProbe(const deCONZ::NodeEvent *eve
1464914678
}
1465014679
}
1465114680
else if (sensor->modelId() == QLatin1String("Remote switch") || // Legrand switch
14652-
sensor->modelId() == QLatin1String("Shutters central remote switch")) // Legrand switch
14681+
sensor->modelId() == QLatin1String("Double gangs remote switch") || // Legrand switch double
14682+
sensor->modelId() == QLatin1String("Remote toggle switch") || // Legrand switch module
14683+
sensor->modelId() == QLatin1String("Remote motion sensor") || // Legrand motion sensor
14684+
sensor->modelId() == QLatin1String("Shutters central remote switch")) // Legrand shutter switch
1465314685
{
1465414686
checkSensorGroup(sensor);
1465514687
checkSensorBindingsForClientClusters(sensor);

de_web_plugin_private.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@
288288
#define VENDOR_BEGA 0x1105
289289
#define VENDOR_PHYSICAL 0x110A // Used by SmartThings
290290
#define VENDOR_OSRAM 0x110C
291+
#define VENDOR_PROFALUX 0x1110
291292
#define VENDOR_JASCO 0x1124 // Used by GE
292293
#define VENDOR_BUSCH_JAEGER 0x112E
293294
#define VENDOR_SERCOMM 0x1131
@@ -432,6 +433,7 @@ extern const quint64 ubisysMacPrefix;
432433
extern const quint64 xalMacPrefix;
433434
extern const quint64 develcoMacPrefix;
434435
extern const quint64 legrandMacPrefix;
436+
extern const quint64 profaluxMacPrefix;
435437
extern const quint64 xiaomiMacPrefix;
436438
extern const quint64 computimeMacPrefix;
437439
extern const quint64 konkeMacPrefix;
@@ -530,6 +532,8 @@ inline bool checkMacVendor(quint64 addr, quint16 vendor)
530532
return prefix == develcoMacPrefix;
531533
case VENDOR_LEGRAND:
532534
return prefix == legrandMacPrefix;
535+
case VENDOR_PROFALUX:
536+
return prefix == profaluxMacPrefix;
533537
case VENDOR_NETVOX:
534538
return prefix == netvoxMacPrefix;
535539
case VENDOR_AURORA:

light_node.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,8 @@ void LightNode::setHaEndpoint(const deCONZ::SimpleDescriptor &endpoint)
546546
case DEV_ID_Z30_COLOR_TEMPERATURE_LIGHT: ltype = QLatin1String("Color temperature light"); break;
547547
case DEV_ID_ZLL_COLOR_TEMPERATURE_LIGHT: ltype = QLatin1String("Color temperature light"); break;
548548
case DEV_ID_XIAOMI_SMART_PLUG: ltype = QLatin1String("Smart plug"); break;
549-
case DEV_ID_CONSUMPTION_AWARENESS_DEVICE: ltype = QLatin1String("Consumption awareness device"); break;
549+
case DEV_ID_CONSUMPTION_AWARENESS_DEVICE: ltype = QLatin1String("Consumption awareness device");
550+
removeItem(RStateOn); break;
550551
case DEV_ID_IAS_ZONE: removeItem(RStateOn);
551552
ltype = QLatin1String("Warning device"); break;
552553
case DEV_ID_IAS_WARNING_DEVICE: removeItem(RStateOn);

rest_lights.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,7 @@ int DeRestPluginPrivate::setLightState(const ApiRequest &req, ApiResponse &rsp)
553553
bool hasOn = false;
554554
bool targetOn = false;
555555
bool hasBri = false;
556+
bool hasStop = false;
556557
quint8 targetBri = 0;
557558
bool hasBriInc = false;
558559
qint16 targetBriInc = 0;
@@ -597,11 +598,12 @@ int DeRestPluginPrivate::setLightState(const ApiRequest &req, ApiResponse &rsp)
597598
{
598599
paramOk = true;
599600
hasCmd = true;
600-
if (map[param].type() == QVariant::String && map[param].toString() == "stop") // FIXME deprecate this nonsense
601+
if (map[param].type() == QVariant::String && map[param].toString() == "stop")
601602
{
602603
valueOk = true;
603604
hasBriInc = true;
604605
targetBriInc = 0;
606+
hasStop = true;
605607
}
606608
else if (map[param].type() == QVariant::Double)
607609
{
@@ -881,7 +883,24 @@ int DeRestPluginPrivate::setLightState(const ApiRequest &req, ApiResponse &rsp)
881883
TaskItem task;
882884
copyTaskReq(taskRef, task);
883885

884-
if (!isOn)
886+
//Profalux shutter use Stop command but the device can be on (opening) or off (closing) So using this hack
887+
if (hasStop)
888+
{
889+
if (addTaskStopBrightness(task))
890+
{
891+
taskToLocalData(task);
892+
QVariantMap rspItem;
893+
QVariantMap rspItemState;
894+
rspItemState[QString("/groups/%1/action/bri").arg(id)] = map["bri"];
895+
rspItem["success"] = rspItemState;
896+
rsp.list.append(rspItem);
897+
}
898+
else
899+
{
900+
rsp.list.append(errorToMap(ERR_INTERNAL_ERROR, QString("/lights/%1/state/bri").arg(id), QString("Internal error, %1").arg(ERR_BRIDGE_BUSY)));
901+
}
902+
}
903+
else if (!isOn)
885904
{
886905
rsp.list.append(errorToMap(ERR_DEVICE_OFF, QString("/lights/%1/state").arg(id), QString("parameter, bri, is not modifiable. Device is set to off.")));
887906
}

0 commit comments

Comments
 (0)