Skip to content

Commit e3870e1

Browse files
ma-camanup
authored andcommitted
Add siren support to Bitron Smoke Detector with siren.
1 parent 630ac20 commit e3870e1

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

de_web_plugin.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,13 +1399,15 @@ void DeRestPluginPrivate::addLightNode(const deCONZ::Node *node)
13991399
bool hasServerOnOff = false;
14001400
bool hasServerLevel = false;
14011401
bool hasServerColor = false;
1402+
bool hasIASWDCluster = false;
14021403

14031404
for (int c = 0; c < i->inClusters().size(); c++)
14041405
{
14051406
if (i->inClusters()[c].id() == ONOFF_CLUSTER_ID) { hasServerOnOff = true; }
14061407
else if (i->inClusters()[c].id() == LEVEL_CLUSTER_ID) { hasServerLevel = true; }
14071408
else if (i->inClusters()[c].id() == COLOR_CLUSTER_ID) { hasServerColor = true; }
14081409
else if (i->inClusters()[c].id() == WINDOW_COVERING_CLUSTER_ID) { hasServerOnOff = true; }
1410+
else if (i->inClusters()[c].id() == IAS_WD_CLUSTER_ID) { hasIASWDCluster = true; }
14091411
}
14101412

14111413
// check if node already exist
@@ -1595,6 +1597,15 @@ void DeRestPluginPrivate::addLightNode(const deCONZ::Node *node)
15951597
}
15961598
break;
15971599

1600+
case DEV_ID_IAS_ZONE:
1601+
{
1602+
if (hasIASWDCluster)
1603+
{
1604+
lightNode.setHaEndpoint(*i);
1605+
}
1606+
}
1607+
break;
1608+
15981609
case DEV_ID_IAS_WARNING_DEVICE:
15991610
{
16001611
lightNode.setHaEndpoint(*i);
@@ -2078,6 +2089,7 @@ LightNode *DeRestPluginPrivate::updateLightNode(const deCONZ::NodeEvent &event)
20782089
case DEV_ID_HA_WINDOW_COVERING_DEVICE:
20792090
case DEV_ID_ZLL_ONOFF_SENSOR:
20802091
case DEV_ID_XIAOMI_SMART_PLUG:
2092+
case DEV_ID_IAS_ZONE:
20812093
case DEV_ID_IAS_WARNING_DEVICE:
20822094
case DEV_ID_FAN:
20832095
break;

light_node.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,11 @@ void LightNode::setHaEndpoint(const deCONZ::SimpleDescriptor &endpoint)
476476
else if (i->id() == FAN_CONTROL_CLUSTER_ID) {
477477
addItem(DataTypeUInt8, RStateSpeed);
478478
}
479+
else if (i->id() == IAS_WD_CLUSTER_ID)
480+
{
481+
removeItem(RStateOn);
482+
ltype = QLatin1String("Warning device");
483+
}
479484
}
480485
}
481486

rest_lights.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,14 @@ int DeRestPluginPrivate::setLightState(const ApiRequest &req, ApiResponse &rsp)
12931293
QString alert = map["alert"].toString();
12941294
bool isWarningDevice = taskRef.lightNode->type() == QLatin1String("Warning device");
12951295

1296+
bool isSmokeDetector = false;
1297+
if (taskRef.lightNode->modelId() == QLatin1String("902010/24") // Bitron Smoke Detector with siren
1298+
)
1299+
{
1300+
isSmokeDetector = true;
1301+
taskRef.lightNode->rx(); // otherwise device is marked as zombie and task is dropped
1302+
}
1303+
12961304
if (alert == "none")
12971305
{
12981306
if (isWarningDevice)
@@ -1309,7 +1317,13 @@ int DeRestPluginPrivate::setLightState(const ApiRequest &req, ApiResponse &rsp)
13091317
}
13101318
else if (alert == "select")
13111319
{
1312-
if (isWarningDevice)
1320+
if (isWarningDevice && isSmokeDetector)
1321+
{
1322+
task.taskType = TaskWarning;
1323+
task.options = 0x12; // Warning mode 2 (fire), strobe
1324+
task.duration = 1;
1325+
}
1326+
else if (isWarningDevice)
13131327
{
13141328
task.taskType = TaskWarning;
13151329
task.options = 0x14; // Warning mode 1 (burglar), Strobe
@@ -1323,7 +1337,13 @@ int DeRestPluginPrivate::setLightState(const ApiRequest &req, ApiResponse &rsp)
13231337
}
13241338
else if (alert == "lselect")
13251339
{
1326-
if (isWarningDevice)
1340+
if (isWarningDevice && isSmokeDetector)
1341+
{
1342+
task.taskType = TaskWarning;
1343+
task.options = 0x12; // Warning mode 2 (fire), strobe
1344+
task.duration = 300;
1345+
}
1346+
else if (isWarningDevice)
13271347
{
13281348
task.taskType = TaskWarning;
13291349
task.options = 0x14; // Warning mode 1 (burglar), Strobe

0 commit comments

Comments
 (0)