Skip to content
Permalink
Browse files

Add support for LifeControl smart plug

Signed-off-by: bastshoes <alaptev@gemalto.com>
  • Loading branch information
bastshoes
bastshoes committed Aug 1, 2019
1 parent 254f1a8 commit 2980e84b52ae798c482c6895965b0bdd4d210600
Showing with 23 additions and 1 deletion.
  1. +6 −1 bindings.cpp
  2. +17 −0 de_web_plugin.cpp
@@ -1513,6 +1513,9 @@ void DeRestPluginPrivate::checkLightBindingsForAttributeReporting(LightNode *lig
else if (lightNode->modelId().startsWith(QLatin1String("SMSZB-120"))) // Develco smoke sensor
{
}
else if (lightNode->modelId().startsWith(QLatin1String("RICI01"))) // LifeControl smart plug
{
}
else
{
return;
@@ -1717,7 +1720,9 @@ bool DeRestPluginPrivate::checkSensorBindingsForAttributeReporting(Sensor *senso
// LG
sensor->modelId() == QLatin1String("LG IP65 HMS") ||
// Sinope
sensor->modelId() == QLatin1String("WL4200S"))
sensor->modelId() == QLatin1String("WL4200S") ||
//LifeControl smart plug
sensor->modelID() == QLatin1String("RICI01"))
{
deviceSupported = true;
if (!sensor->node()->nodeDescriptor().receiverOnWhenIdle() ||
@@ -198,6 +198,7 @@ static const SupportedDevice supportedDevices[] = {
{ VENDOR_NONE, "RES001", tiMacPrefix }, // Hubitat environment sensor, see #1308
{ VENDOR_119C, "WL4200S", sinopeMacPrefix}, // Sinope water sensor
{ VENDOR_DEVELCO, "SMSZB-120", develcoMacPrefix }, // Develco smoke sensor
{ VENDOR_NONE, "RICI01", tiMacPrefix}, // LifeControl smart plug
{ 0, nullptr, 0 }
};

@@ -6387,6 +6388,10 @@ void DeRestPluginPrivate::updateSensorNode(const deCONZ::NodeEvent &event)
{
consumption *= 10; // 0.01 kWh = 10 Wh -> Wh
}
else if (i->modelId() == QLatin1String("RICI01")) // LifeControl smart plug
{
consumption /= 1000; // 0.001 Wh -> Wh
}

if (item)
{
@@ -6462,6 +6467,10 @@ void DeRestPluginPrivate::updateSensorNode(const deCONZ::NodeEvent &event)
{
power = power == 28000 ? 0 : power / 10;
}
else if (i->modelId() == QLatin1String("RICI01")) //LifeControl Smart Plug
{
power /= 10; // 0.1W -> W
}
item->setValue(power); // in W
enqueueEvent(Event(RSensors, RStatePower, i->id(), item));
updated = true;
@@ -6484,6 +6493,10 @@ void DeRestPluginPrivate::updateSensorNode(const deCONZ::NodeEvent &event)
{
voltage += 50; voltage /= 100; // 0.01V -> V
}
else if (i->modelId() == QLatin1String("RICI01")) //LifeControl Smart Plug
{
voltage /= 10; // 0.1V -> V
}
item->setValue(voltage); // in V
enqueueEvent(Event(RSensors, RStateVoltage, i->id(), item));
updated = true;
@@ -6510,6 +6523,10 @@ void DeRestPluginPrivate::updateSensorNode(const deCONZ::NodeEvent &event)
{
current *= 10; // 0.01A -> mA
}
else if (i->modelId() == QLatin1String("RICI01")) //LifeControl Smart Plug
{
current /= 1000; // uA -> mA
}
else
{
current *= 1000; // A -> mA

0 comments on commit 2980e84

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