Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window Covering devices #5619

Merged
merged 36 commits into from
Feb 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1471c0d
Update general.xml
ebaauw Dec 28, 2021
c6718c0
Update light_node.cpp
ebaauw Dec 28, 2021
859dc18
Update rest_lights.cpp
ebaauw Dec 29, 2021
dd62ecc
ZHABattery for Aqara roller shade driver E1
ebaauw Dec 29, 2021
6d43ef7
Handle Aqara roller shade driver E1
ebaauw Dec 29, 2021
3a4f2c3
Remove deprecated state attributes from Window Covering devices
ebaauw Dec 29, 2021
cb419a9
Update bindings.cpp
ebaauw Dec 29, 2021
9f1f987
Update general.xml
ebaauw Dec 29, 2021
6c4ece0
Update de_web_plugin_private.h
ebaauw Dec 29, 2021
913d9a8
Update xiaomi.cpp
ebaauw Dec 29, 2021
4c58774
Update rest_lights.cpp
ebaauw Dec 29, 2021
4c06d59
Update rest_lights.cpp
ebaauw Dec 30, 2021
ac1621f
Update rest_lights.cpp
ebaauw Dec 30, 2021
722eb5d
Aqara Roller Shade Driver E1
ebaauw Dec 30, 2021
e99c070
Update rest_lights.cpp
ebaauw Dec 30, 2021
945f571
Update de_web_plugin.cpp
ebaauw Dec 30, 2021
78b0dba
Update xiaomi.cpp
ebaauw Dec 30, 2021
fbb180c
Update rest_lights.cpp
ebaauw Dec 30, 2021
2fb0ef5
Update de_web_plugin.cpp
ebaauw Dec 30, 2021
b43c6c0
Update de_web_plugin.cpp
ebaauw Dec 31, 2021
4ac4ebb
Update rest_lights.cpp
ebaauw Dec 31, 2021
43c4495
Update light_node.cpp
ebaauw Dec 31, 2021
2bb0531
Update xiaomi.cpp
ebaauw Dec 31, 2021
324e63c
Update de_web_plugin.cpp
ebaauw Dec 31, 2021
abff253
Update power_configuration.cpp
ebaauw Jan 2, 2022
8106901
Update rest_lights.cpp
ebaauw Jan 3, 2022
5a1b7ff
Update rest_lights.cpp
ebaauw Feb 15, 2022
90a29b9
Revert Remove deprecated state attributes from Window Covering devices
ebaauw Feb 16, 2022
3196acf
Update rest_lights.cpp
ebaauw Feb 16, 2022
8c21bcf
Update rest_sensors.cpp
ebaauw Feb 16, 2022
1289024
Merge remote-tracking branch 'upstream/master'
ebaauw Feb 16, 2022
3d7c363
Update general.xml
ebaauw Feb 17, 2022
1acddc6
Update general.xml
ebaauw Feb 17, 2022
37c47bf
Update button_maps.json
ebaauw Feb 18, 2022
0717e11
Update general.xml
ebaauw Feb 19, 2022
7b561f1
Update rest_lights.cpp
ebaauw Feb 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ bool DeRestPluginPrivate::sendConfigureReportingRequest(BindingTask &bt)
rq.minInterval = 1;
rq.maxInterval = 600;
rq.reportableChange16bit = 50;

ConfigureReportingRequest rq2;
rq2.dataType = deCONZ::Zcl8BitUint;
rq2.attributeId = 0x0008; // Pi heating demand
Expand Down Expand Up @@ -1551,7 +1551,7 @@ bool DeRestPluginPrivate::sendConfigureReportingRequest(BindingTask &bt)
rq.minInterval = 0;
rq.maxInterval = 300;
rq.reportableChange16bit = 10;

ConfigureReportingRequest rq2;
rq2.dataType = deCONZ::Zcl16BitInt;
rq2.attributeId = 0x0011; // Occupied cooling setpoint
Expand Down Expand Up @@ -2587,6 +2587,10 @@ void DeRestPluginPrivate::checkLightBindingsForAttributeReporting(LightNode *lig
}
else if (lightNode->manufacturerCode() == VENDOR_XIAOMI)
{
if (lightNode->modelId().startsWith(QLatin1String("lumi.curtain.acn002")))
{
return;
}
}
else if (lightNode->manufacturerCode() == VENDOR_STELPRO)
{
Expand Down Expand Up @@ -3071,7 +3075,7 @@ bool DeRestPluginPrivate::checkSensorBindingsForAttributeReporting(Sensor *senso
sensor->modelId().startsWith(QLatin1String("TS0041")) ||
sensor->modelId().startsWith(QLatin1String("TS0044")) ||
sensor->modelId().startsWith(QLatin1String("TS0203")) ||
sensor->modelId().startsWith(QLatin1String("TS0222")) || // TYZB01 light sensor
sensor->modelId().startsWith(QLatin1String("TS0222")) || // TYZB01 light sensor
sensor->modelId().startsWith(QLatin1String("TS004F")) || // 4 Gang Tuya ZigBee Wireless 12 Scene Switch
sensor->modelId().startsWith(QLatin1String("TS011F")) || // Plugs
// Tuyatec
Expand Down
4 changes: 2 additions & 2 deletions button_maps.json
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@
[1, "0x02", "LEVEL_CONTROL", "MOVE_WITH_ON_OFF", "0", "S_BUTTON_1", "S_BUTTON_ACTION_HOLD", "Move up (with on/off)"],
[1, "0x02", "LEVEL_CONTROL", "STOP_WITH_ON_OFF", "0", "S_BUTTON_1", "S_BUTTON_ACTION_LONG_RELEASED", "Stop_ (with on/off)"],
[1, "0x02", "LEVEL_CONTROL", "MOVE_WITH_ON_OFF", "1", "S_BUTTON_1", "S_BUTTON_ACTION_HOLD", "Move down (with on/off)"],
[1, "0x02", "LEVEL_CONTROL", "STOP_WITH_ON_OFF", "1", "S_BUTTON_1", "S_BUTTON_ACTION_LONG_RELEASED", "Stop_ (with on/off)"]
[1, "0x02", "LEVEL_CONTROL", "STOP_WITH_ON_OFF", "1", "S_BUTTON_1", "S_BUTTON_ACTION_LONG_RELEASED", "Stop_ (with on/off)"]
]
},
"ubisysD1Map": {
Expand Down Expand Up @@ -1076,7 +1076,7 @@
"sunricherMap": {
"vendor": "Sunricher",
"doc": "Wireless switches from Sunricher, Namron, SLC and EcoDim",
"modelids": ["ED-10010", "ED-10011", "ED-10012", "ED-10013", "ED-10014", "ED-10015", "ZG2833K8_EU05", "ZG2835", "4512700", "4512701", "4512702", "4512703", "4512705", "4512714", "4512719", "4512720", "4512721", "4512722", "4512729", "S57003", "ROB_200-008", "ROB_200-009-0", "ROB_200-008-0", "ROB_200-007-0"],
"modelids": ["ED-10010", "ED-10011", "ED-10012", "ED-10013", "ED-10014", "ED-10015", "ZG2833K8_EU05", "ZG2833K4_EU06", "ZG2835", "4512700", "4512701", "4512702", "4512703", "4512705", "4512714", "4512719", "4512720", "4512721", "4512722", "4512729", "S57003", "ROB_200-008", "ROB_200-009-0", "ROB_200-008-0", "ROB_200-007-0"],
"map": [
[1, "0x01", "ONOFF", "ON", "0", "S_BUTTON_1", "S_BUTTON_ACTION_SHORT_RELEASED", "On"],
[1, "0x01", "LEVEL_CONTROL", "MOVE_WITH_ON_OFF", "0", "S_BUTTON_1", "S_BUTTON_ACTION_HOLD", "Move up (with on/off)"],
Expand Down
12 changes: 10 additions & 2 deletions database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3625,7 +3625,7 @@ static int sqliteLoadAllSensorsCallback(void *user, int ncols, char **colval , c
clusterId = clusterId ? clusterId : TUYA_CLUSTER_ID;
sensor.addItem(DataTypeBool, RStateLowBattery)->setValue(false);
}

item = sensor.addItem(DataTypeBool, RStateFire);
item->setValue(false);
}
Expand Down Expand Up @@ -3989,12 +3989,20 @@ static int sqliteLoadAllSensorsCallback(void *user, int ncols, char **colval , c
{
clusterId = POWER_CONFIGURATION_CLUSTER_ID;
}
else if (sensor.fingerPrint().hasInCluster(XIAOMI_CLUSTER_ID))
{
clusterId = XIAOMI_CLUSTER_ID;
}
else if (sensor.fingerPrint().hasInCluster(TUYA_CLUSTER_ID))
{
clusterId = TUYA_CLUSTER_ID;
}
item = sensor.addItem(DataTypeUInt8, RStateBattery);
item->setValue(100);
if (sensor.modelId().startsWith(QLatin1String("lumi.curtain.acn002")))
{
sensor.addItem(DataTypeBool, RStateCharging);
}
}
else if (sensor.type() == QLatin1String("CLIPDaylightOffset"))
{
Expand Down Expand Up @@ -4148,7 +4156,7 @@ static int sqliteLoadAllSensorsCallback(void *user, int ncols, char **colval , c
item = sensor.addItem(DataTypeUInt16, RConfigPending);
item->setValue(item->toNumber() | R_PENDING_MODE);
}

if (sensor.modelId() == QLatin1String("lumi.switch.n0agl1"))
{
sensor.removeItem(RConfigBattery);
Expand Down
62 changes: 43 additions & 19 deletions de_web_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ static const SupportedDevice supportedDevices[] = {
{ VENDOR_XIAOMI, "lumi.plug", xiaomiMacPrefix }, // Xiaomi smart plugs (router)
{ VENDOR_XIAOMI, "lumi.switch.b1naus01", xiaomiMacPrefix }, // Xiaomi Aqara ZB3.0 Smart Wall Switch Single Rocker WS-USC03
// { VENDOR_XIAOMI, "lumi.curtain", jennicMacPrefix}, // Xiaomi curtain controller (router) - exposed only as light
{ VENDOR_XIAOMI, "lumi.curtain.acn002", lumiMacPrefix}, // Xiaomi roller shade driver E1
{ VENDOR_XIAOMI, "lumi.curtain.hagl04", xiaomiMacPrefix}, // Xiaomi B1 curtain controller
{ VENDOR_XIAOMI, "lumi.remote.cagl01", xiaomiMacPrefix }, // Xiaomi Aqara T1 Cube MFKZQ11LM
{ VENDOR_XIAOMI, "lumi.sensor_magnet.agl02", xiaomiMacPrefix}, // Xiaomi Aqara T1 open/close sensor MCCGQ12LM
Expand Down Expand Up @@ -498,7 +499,7 @@ static const SupportedDevice supportedDevices[] = {
{ VENDOR_ALERTME, "SLT3", computimeMacPrefix }, // Hive thermostat
{ VENDOR_DANFOSS, "TRV001", silabs2MacPrefix }, // Hive thermostat (From Danfoss)
{ VENDOR_SUNRICHER, "45127", silabs2MacPrefix }, // Namron 1/2/4-ch remote controller
{ VENDOR_SUNRICHER, "S57003", silabs2MacPrefix }, // SLC 4-ch remote controller
{ VENDOR_SUNRICHER, "S57003", silabs2MacPrefix }, // SLC 4-ch remote controller
{ VENDOR_SENGLED_OPTOELEC, "E13-", zhejiangMacPrefix }, // Sengled PAR38 Bulbs
{ VENDOR_SENGLED_OPTOELEC, "E1D-", zhejiangMacPrefix }, // Sengled contact sensor
{ VENDOR_SENGLED_OPTOELEC, "E1E-", zhejiangMacPrefix }, // Sengled Smart Light Switch
Expand Down Expand Up @@ -2435,7 +2436,7 @@ void DeRestPluginPrivate::addLightNode(const deCONZ::Node *node)
}
if (node->nodeDescriptor().manufacturerCode() == VENDOR_KEEN_HOME || // Keen Home Vent
node->nodeDescriptor().manufacturerCode() == VENDOR_JENNIC || // Xiaomi lumi.ctrl_neutral1, lumi.ctrl_neutral2
node->nodeDescriptor().manufacturerCode() == VENDOR_XIAOMI || // Xiaomi lumi.curtain.hagl04
node->nodeDescriptor().manufacturerCode() == VENDOR_XIAOMI || // Xiaomi lumi.curtain.hagl04, lumi.curtain.acn002
node->nodeDescriptor().manufacturerCode() == VENDOR_EMBER || // atsmart Z6-03 switch + Heiman plug + Tuya stuff
(!node->nodeDescriptor().isNull() && node->nodeDescriptor().manufacturerCode() == VENDOR_NONE) || // Climax Siren
node->nodeDescriptor().manufacturerCode() == VENDOR_DEVELCO || // Develco Smoke sensor with siren
Expand Down Expand Up @@ -3974,6 +3975,11 @@ LightNode *DeRestPluginPrivate::updateLightNode(const deCONZ::NodeEvent &event)
updated = true;
setLightNodeStaticCapabilities(lightNode);
enqueueEvent({lightNode->prefix(), item->descriptor().suffix, lightNode->id(), item, lightNode->address().ext()});

{
Q_Q(DeRestPlugin);
emit q->nodeUpdated(lightNode->address().ext(), QLatin1String("vendor"), str);
}
}
}
else if (ia->id() == 0x0005) // Model identifier
Expand Down Expand Up @@ -4017,6 +4023,11 @@ LightNode *DeRestPluginPrivate::updateLightNode(const deCONZ::NodeEvent &event)
setLightNodeStaticCapabilities(lightNode);
enqueueEvent({lightNode->prefix(), item->descriptor().suffix, lightNode->id(), item, lightNode->address().ext()});
}

{
Q_Q(DeRestPlugin);
emit q->nodeUpdated(lightNode->address().ext(), QLatin1String("modelid"), str);
}
}
else if (ia->id() == 0x0006) // Date code
{
Expand All @@ -4032,6 +4043,11 @@ LightNode *DeRestPluginPrivate::updateLightNode(const deCONZ::NodeEvent &event)
updated = true;
}
item->setValue(str); // always needed to refresh set timestamp

{
Q_Q(DeRestPlugin);
emit q->nodeUpdated(lightNode->address().ext(), QLatin1String("version"), str);
}
}
}
else if (ia->id() == 0x4000) // Software build identifier
Expand Down Expand Up @@ -5755,7 +5771,7 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const deCONZ::
{
fpDoorLockSensor.inClusters.push_back(DOOR_LOCK_CLUSTER_ID);
}

fpAirQualitySensor.inClusters.push_back(ci->id());
fpAlarmSensor.inClusters.push_back(ci->id());
fpBatterySensor.inClusters.push_back(ci->id());
Expand Down Expand Up @@ -5797,11 +5813,6 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const deCONZ::
{
fpBatterySensor.inClusters.push_back(ci->id());
}
if (node->nodeDescriptor().manufacturerCode() == VENDOR_XIAOMI &&
modelId.startsWith(QLatin1String("lumi.curtain.hagl04")))
{
fpBatterySensor.inClusters.push_back(ci->id());
}
if ((node->nodeDescriptor().manufacturerCode() == VENDOR_AXIS || node->nodeDescriptor().manufacturerCode() == VENDOR_MMB) &&
(modelId == QLatin1String("Gear")) && (i->endpoint() == 0x01))
{
Expand Down Expand Up @@ -6467,6 +6478,10 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const deCONZ::
fpSwitch.inClusters.push_back(ci->id());
fpTemperatureSensor.inClusters.push_back(ci->id());
fpThermostatSensor.inClusters.push_back(ci->id());
if (modelId.startsWith(QLatin1String("lumi.curtain")))
{
fpBatterySensor.inClusters.push_back(ci->id());
}
}
}
break;
Expand Down Expand Up @@ -6696,11 +6711,11 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const deCONZ::
checkSensorNodeReachable(sensor);
}
}

//ZHAAncillaryControl
if (fpAncillaryControlSensor.hasOutCluster(IAS_ACE_CLUSTER_ID))
{

fpAncillaryControlSensor.endpoint = i->endpoint();
fpAncillaryControlSensor.deviceId = i->deviceId();
fpAncillaryControlSensor.profileId = i->profileId();
Expand Down Expand Up @@ -6848,7 +6863,7 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const deCONZ::
checkSensorNodeReachable(sensor);
}
}

// ZHAMoisture
if (fpMoistureSensor.hasInCluster(SOIL_MOISTURE_CLUSTER_ID))
{
Expand Down Expand Up @@ -7044,6 +7059,7 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const deCONZ::

// ZHABattery
if (fpBatterySensor.hasInCluster(POWER_CONFIGURATION_CLUSTER_ID) ||
fpBatterySensor.hasInCluster(XIAOMI_CLUSTER_ID) ||
fpBatterySensor.hasInCluster(TUYA_CLUSTER_ID))
{
fpBatterySensor.endpoint = i->endpoint();
Expand Down Expand Up @@ -7313,7 +7329,7 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const SensorFi
sensorNode.addItem(DataTypeInt16, RStateTemperature);
item = sensorNode.addItem(DataTypeInt16, RConfigOffset);
item->setValue(0);

if (R_GetProductId(&sensorNode).startsWith(QLatin1String("Tuya_SEN")))
{
// Enable reporting in "blind mode"
Expand Down Expand Up @@ -7787,11 +7803,19 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const SensorFi
{
clusterId = POWER_CONFIGURATION_CLUSTER_ID;
}
else if (sensorNode.fingerPrint().hasInCluster(XIAOMI_CLUSTER_ID))
{
clusterId = XIAOMI_CLUSTER_ID;
}
else if (sensorNode.fingerPrint().hasInCluster(TUYA_CLUSTER_ID))
{
clusterId = TUYA_CLUSTER_ID;
}
sensorNode.addItem(DataTypeUInt8, RStateBattery);
if (modelId.startsWith(QLatin1String("lumi.curtain.")))
{
sensorNode.addItem(DataTypeBool, RStateCharging);
}
}
else if (sensorNode.type().endsWith(QLatin1String("Time")))
{
Expand Down Expand Up @@ -8991,7 +9015,7 @@ void DeRestPluginPrivate::updateSensorNode(const deCONZ::NodeEvent &event)
{
pressure += item2->toNumber();
}

item->setValue(pressure);
i->updateStateTimestamp();
i->setNeedSaveDatabase(true);
Expand Down Expand Up @@ -9242,7 +9266,7 @@ void DeRestPluginPrivate::updateSensorNode(const deCONZ::NodeEvent &event)
{
continue;
}

// Correct incomplete sensor fingerprint
if (!i->fingerPrint().hasInCluster(BASIC_CLUSTER_ID))
{
Expand Down Expand Up @@ -10958,12 +10982,12 @@ bool DeRestPluginPrivate::processZclAttributes(Sensor *sensorNode)
if (item)
{
quint64 sensitivity = item->toNumber();

if (nd.manufacturerCode() == VENDOR_PHILIPS)
{
deCONZ::ZclAttribute attr(0x0030, deCONZ::Zcl8BitUint, "sensitivity", deCONZ::ZclReadWrite, true);
attr.setValue(sensitivity);

if (writeAttribute(sensorNode, sensorNode->fingerPrint().endpoint, OCCUPANCY_SENSING_CLUSTER_ID, attr, VENDOR_PHILIPS))
{
sensorNode->setNextReadTime(WRITE_SENSITIVITY, tNow.addSecs(7200));
Expand All @@ -10974,7 +10998,7 @@ bool DeRestPluginPrivate::processZclAttributes(Sensor *sensorNode)
{
deCONZ::ZclAttribute attr(XIAOMI_ATTRID_MOTION_SENSITIVITY, deCONZ::Zcl8BitUint, "sensitivity", deCONZ::ZclReadWrite, true);
attr.setValue(sensitivity);

if (writeAttribute(sensorNode, sensorNode->fingerPrint().endpoint, XIAOMI_CLUSTER_ID, attr, VENDOR_XIAOMI))
{
sensorNode->setNextReadTime(WRITE_SENSITIVITY, tNow.addSecs(3300)); // Default special reporting intervall
Expand Down Expand Up @@ -15891,9 +15915,9 @@ void DeRestPluginPrivate::delayedFastEnddeviceProbe(const deCONZ::NodeEvent *eve
{
std::vector<uint16_t> attributes;
auto *item = sensor->item(RConfigSensitivity);

if (item) { attributes.push_back(XIAOMI_ATTRID_MOTION_SENSITIVITY); }

if (!attributes.empty() && readAttributes(sensor, sensor->fingerPrint().endpoint, XIAOMI_CLUSTER_ID, attributes, VENDOR_XIAOMI))
{
DBG_Printf(DBG_INFO, "Read 0x%016llX motion sensitivity attribute 0x010C...\n", sensor->address().ext());
Expand Down
2 changes: 2 additions & 0 deletions de_web_plugin_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ using namespace deCONZ::literals;
#define ANALOG_OUTPUT_CLUSTER_ID 0x000D
#define BINARY_INPUT_CLUSTER_ID 0x000F
#define MULTISTATE_INPUT_CLUSTER_ID 0x0012
#define MULTISTATE_OUTPUT_CLUSTER_ID 0x0013
#define OTAU_CLUSTER_ID 0x0019
#define POLL_CONTROL_CLUSTER_ID 0x0020
#define DOOR_LOCK_CLUSTER_ID 0x0101
Expand Down Expand Up @@ -223,6 +224,7 @@ using namespace deCONZ::literals;
#define DEVELCO_AIR_QUALITY_CLUSTER_ID 0xFC03
#define SENGLED_CLUSTER_ID 0xFC10
#define LEGRAND_CONTROL_CLUSTER_ID 0xFC40
#define XIAOMI_CLUSTER_ID 0xFCC0
#define ADUROLIGHT_CLUSTER_ID 0xFCCC
#define XAL_CLUSTER_ID 0xFCCE
#define BOSCH_AIR_QUALITY_CLUSTER_ID quint16(0xFDEF)
Expand Down
Loading