Skip to content
Permalink
Browse files

Add siren support to Bitron Smoke Detector with siren.

  • Loading branch information
ma-ca authored and manup committed Jun 14, 2019
1 parent 630ac20 commit e3870e1309dbd76123946b283c9726f4d7b2c348
Showing with 39 additions and 2 deletions.
  1. +12 −0 de_web_plugin.cpp
  2. +5 −0 light_node.cpp
  3. +22 −2 rest_lights.cpp
@@ -1399,13 +1399,15 @@ void DeRestPluginPrivate::addLightNode(const deCONZ::Node *node)
bool hasServerOnOff = false;
bool hasServerLevel = false;
bool hasServerColor = false;
bool hasIASWDCluster = false;

for (int c = 0; c < i->inClusters().size(); c++)
{
if (i->inClusters()[c].id() == ONOFF_CLUSTER_ID) { hasServerOnOff = true; }
else if (i->inClusters()[c].id() == LEVEL_CLUSTER_ID) { hasServerLevel = true; }
else if (i->inClusters()[c].id() == COLOR_CLUSTER_ID) { hasServerColor = true; }
else if (i->inClusters()[c].id() == WINDOW_COVERING_CLUSTER_ID) { hasServerOnOff = true; }
else if (i->inClusters()[c].id() == IAS_WD_CLUSTER_ID) { hasIASWDCluster = true; }
}

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

case DEV_ID_IAS_ZONE:
{
if (hasIASWDCluster)
{
lightNode.setHaEndpoint(*i);
}
}
break;

case DEV_ID_IAS_WARNING_DEVICE:
{
lightNode.setHaEndpoint(*i);
@@ -2078,6 +2089,7 @@ LightNode *DeRestPluginPrivate::updateLightNode(const deCONZ::NodeEvent &event)
case DEV_ID_HA_WINDOW_COVERING_DEVICE:
case DEV_ID_ZLL_ONOFF_SENSOR:
case DEV_ID_XIAOMI_SMART_PLUG:
case DEV_ID_IAS_ZONE:
case DEV_ID_IAS_WARNING_DEVICE:
case DEV_ID_FAN:
break;
@@ -476,6 +476,11 @@ void LightNode::setHaEndpoint(const deCONZ::SimpleDescriptor &endpoint)
else if (i->id() == FAN_CONTROL_CLUSTER_ID) {
addItem(DataTypeUInt8, RStateSpeed);
}
else if (i->id() == IAS_WD_CLUSTER_ID)
{
removeItem(RStateOn);
ltype = QLatin1String("Warning device");
}
}
}

@@ -1293,6 +1293,14 @@ int DeRestPluginPrivate::setLightState(const ApiRequest &req, ApiResponse &rsp)
QString alert = map["alert"].toString();
bool isWarningDevice = taskRef.lightNode->type() == QLatin1String("Warning device");

bool isSmokeDetector = false;
if (taskRef.lightNode->modelId() == QLatin1String("902010/24") // Bitron Smoke Detector with siren
)
{
isSmokeDetector = true;
taskRef.lightNode->rx(); // otherwise device is marked as zombie and task is dropped
}

if (alert == "none")
{
if (isWarningDevice)
@@ -1309,7 +1317,13 @@ int DeRestPluginPrivate::setLightState(const ApiRequest &req, ApiResponse &rsp)
}
else if (alert == "select")
{
if (isWarningDevice)
if (isWarningDevice && isSmokeDetector)
{
task.taskType = TaskWarning;
task.options = 0x12; // Warning mode 2 (fire), strobe
task.duration = 1;
}
else if (isWarningDevice)
{
task.taskType = TaskWarning;
task.options = 0x14; // Warning mode 1 (burglar), Strobe
@@ -1323,7 +1337,13 @@ int DeRestPluginPrivate::setLightState(const ApiRequest &req, ApiResponse &rsp)
}
else if (alert == "lselect")
{
if (isWarningDevice)
if (isWarningDevice && isSmokeDetector)
{
task.taskType = TaskWarning;
task.options = 0x12; // Warning mode 2 (fire), strobe
task.duration = 300;
}
else if (isWarningDevice)
{
task.taskType = TaskWarning;
task.options = 0x14; // Warning mode 1 (burglar), Strobe

0 comments on commit e3870e1

Please sign in to comment.
You can’t perform that action at this time.