Skip to content

Commit

Permalink
Add support for LifeControl smart plug
Browse files Browse the repository at this point in the history
Signed-off-by: bastshoes <alaptev@gemalto.com>
  • Loading branch information
bastshoes committed Aug 1, 2019
1 parent 254f1a8 commit 2980e84
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() ||
Expand Down
17 changes: 17 additions & 0 deletions de_web_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
};

Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 2980e84

Please sign in to comment.