Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metering support for Sengled SMART LED Z01-A19NAE26 #4666

Merged
merged 1 commit into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1821,10 +1821,11 @@ bool DeRestPluginPrivate::sendConfigureReportingRequest(BindingTask &bt)
rq.attributeId = 0x0000; // Curent Summation Delivered
rq.minInterval = 1;
rq.maxInterval = 300;
if (sensor && (sensor->modelId() == QLatin1String("SmartPlug") || // Heiman
sensor->modelId() == QLatin1String("SKHMP30-I1") || // GS smart plug
sensor->modelId().startsWith(QLatin1String("E13-")) || // Sengled PAR38 Bulbs
sensor->modelId() == QLatin1String("Connected socket outlet"))) // Niko smart socket
if (sensor && (sensor->modelId() == QLatin1String("SmartPlug") || // Heiman
sensor->modelId() == QLatin1String("SKHMP30-I1") || // GS smart plug
sensor->modelId().startsWith(QLatin1String("E13-")) || // Sengled PAR38 Bulbs
sensor->modelId().startsWith(QLatin1String("Z01-A19")) || // Sengled smart led
sensor->modelId() == QLatin1String("Connected socket outlet"))) // Niko smart socket
{
rq.reportableChange48bit = 10; // 0.001 kWh (1 Wh)
}
Expand All @@ -1848,10 +1849,11 @@ bool DeRestPluginPrivate::sendConfigureReportingRequest(BindingTask &bt)
rq2.attributeId = 0x0400; // Instantaneous Demand
rq2.minInterval = 1;
rq2.maxInterval = 300;
if (sensor && (sensor->modelId() == QLatin1String("SmartPlug") || // Heiman
sensor->modelId() == QLatin1String("902010/25") || // Bitron
sensor->modelId() == QLatin1String("SKHMP30-I1") || // GS smart plug
sensor->modelId() == QLatin1String("160-01"))) // Plugwise smart plug
if (sensor && (sensor->modelId() == QLatin1String("SmartPlug") || // Heiman
sensor->modelId() == QLatin1String("902010/25") || // Bitron
sensor->modelId() == QLatin1String("SKHMP30-I1") || // GS smart plug
sensor->modelId().startsWith(QLatin1String("Z01-A19")) || // Sengled smart led
sensor->modelId() == QLatin1String("160-01"))) // Plugwise smart plug
{
rq2.reportableChange24bit = 10; // 1 W
}
Expand Down Expand Up @@ -2896,6 +2898,7 @@ bool DeRestPluginPrivate::checkSensorBindingsForAttributeReporting(Sensor *senso
sensor->modelId().startsWith(QLatin1String("E13-")) ||
sensor->modelId().startsWith(QLatin1String("E1D-")) ||
sensor->modelId().startsWith(QLatin1String("E1E-")) ||
sensor->modelId().startsWith(QLatin1String("Z01-A19")) ||
// Linkind
sensor->modelId() == QLatin1String("ZB-MotionSensor-D0003") ||
// Immax
Expand Down
23 changes: 13 additions & 10 deletions de_web_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ static const SupportedDevice supportedDevices[] = {
{ VENDOR_SENGLED_OPTOELEC, "E13-", zhejiangMacPrefix }, // Sengled PAR38 Bulbs
{ VENDOR_SENGLED_OPTOELEC, "E1D-", zhejiangMacPrefix }, // Sengled contact sensor
{ VENDOR_SENGLED_OPTOELEC, "E1E-", zhejiangMacPrefix }, // Sengled Smart Light Switch
{ VENDOR_SENGLED_OPTOELEC, "Z01-A19", zhejiangMacPrefix }, // Sengled SMART LED Z01-A19NAE26
{ VENDOR_JENNIC, "Plug-230V-ZB3.0", silabs2MacPrefix }, // Immax NEO ZB3.0 smart plug
{ VENDOR_JENNIC, "4in1-Sensor-ZB3.0", emberMacPrefix }, // Immax NEO ZB3.0 4 in 1 sensor
{ VENDOR_JENNIC, "Keyfob-ZB3.0", emberMacPrefix }, // Immax Keyfob
Expand Down Expand Up @@ -9278,11 +9279,12 @@ void DeRestPluginPrivate::updateSensorNode(const deCONZ::NodeEvent &event)
quint64 consumption = ia->numericValue().u64;
ResourceItem *item = i->item(RStateConsumption);

if (i->modelId() == QLatin1String("SmartPlug") || // Heiman
i->modelId().startsWith(QLatin1String("PSMP5_")) || // Climax
i->modelId().startsWith(QLatin1String("SKHMP30")) || // GS smart plug
i->modelId().startsWith(QLatin1String("E13-")) || // Sengled PAR38 Bulbs
i->modelId() == QLatin1String("Connected socket outlet")) // Niko smart socket
if (i->modelId() == QLatin1String("SmartPlug") || // Heiman
i->modelId().startsWith(QLatin1String("PSMP5_")) || // Climax
i->modelId().startsWith(QLatin1String("SKHMP30")) || // GS smart plug
i->modelId().startsWith(QLatin1String("E13-")) || // Sengled PAR38 Bulbs
i->modelId().startsWith(QLatin1String("Z01-A19")) || // Sengled smart led
i->modelId() == QLatin1String("Connected socket outlet")) // Niko smart socket
{
//consumption += 5; consumption /= 10; // 0.1 Wh -> Wh
consumption = static_cast<quint64>(round((double)consumption / 10.0)); // 0.1 Wh -> Wh
Expand Down Expand Up @@ -9324,11 +9326,12 @@ void DeRestPluginPrivate::updateSensorNode(const deCONZ::NodeEvent &event)
qint32 power = ia->numericValue().s32;
ResourceItem *item = i->item(RStatePower);

if (i->modelId() == QLatin1String("SmartPlug") || // Heiman
i->modelId() == QLatin1String("902010/25") || // Bitron
i->modelId().startsWith(QLatin1String("PSMP5_")) || // Climax
i->modelId().startsWith(QLatin1String("SKHMP30")) ||// GS smart plug
i->modelId().startsWith(QLatin1String("160-01"))) // Plugwise smart plug
if (i->modelId() == QLatin1String("SmartPlug") || // Heiman
i->modelId() == QLatin1String("902010/25") || // Bitron
i->modelId().startsWith(QLatin1String("Z01-A19")) || // Sengled smart led
i->modelId().startsWith(QLatin1String("PSMP5_")) || // Climax
i->modelId().startsWith(QLatin1String("SKHMP30")) || // GS smart plug
i->modelId().startsWith(QLatin1String("160-01"))) // Plugwise smart plug
{
//power += 5; power /= 10; // 0.1 W -> W
power = static_cast<qint32>(round((double)power / 10.0)); // 0.1W -> W
Expand Down