Skip to content

Commit

Permalink
Expose voltage and current for Xiaomi smart plug lumi.plug.mmeu01
Browse files Browse the repository at this point in the history
  • Loading branch information
SwoopX committed Apr 9, 2020
1 parent b0dcad6 commit 2100d64
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3193,7 +3193,10 @@ static int sqliteLoadAllSensorsCallback(void *user, int ncols, char **colval , c
else if (sensor.fingerPrint().hasInCluster(ANALOG_INPUT_CLUSTER_ID))
{
clusterId = clusterId ? clusterId : ANALOG_INPUT_CLUSTER_ID;
hasVoltage = false;
if (!sensor.modelId().startsWith(QLatin1String("lumi.plug.mm"))) // Only available for new ZB3.0 Mi smart plugs?
{
hasVoltage = false;
}
}
item = sensor.addItem(DataTypeInt16, RStatePower);
item->setValue(0);
Expand Down
5 changes: 5 additions & 0 deletions de_web_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5026,6 +5026,11 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const SensorFi
{
clusterId = ANALOG_INPUT_CLUSTER_ID;
item = sensorNode.addItem(DataTypeInt16, RStatePower);
if (modelId.startsWith(QLatin1String("lumi.plug.mm"))) // Only available for new ZB3.0 Mi smart plugs?
{
item = sensorNode.addItem(DataTypeUInt16, RStateVoltage);
item = sensorNode.addItem(DataTypeUInt16, RStateCurrent);
}
}
}
else if (sensorNode.type().endsWith(QLatin1String("Thermostat")))
Expand Down

0 comments on commit 2100d64

Please sign in to comment.