From 901fe77cc469cfe799e2b958596c09ac77935349 Mon Sep 17 00:00:00 2001 From: SwoopX Date: Sun, 20 Feb 2022 00:33:53 +0100 Subject: [PATCH] Add DDF for Niko connected socket outlet 170-33505/170-33605 --- bindings.cpp | 5 - database.cpp | 1 - de_web_plugin.cpp | 2 - .../170-33505_170-33605_smart_socket.json | 259 ++++++++++++++++++ electrical_measurement.cpp | 7 - simple_metering.cpp | 3 +- 6 files changed, 260 insertions(+), 17 deletions(-) create mode 100644 devices/niko/170-33505_170-33605_smart_socket.json diff --git a/bindings.cpp b/bindings.cpp index f30351ef70..5a5607fd79 100644 --- a/bindings.cpp +++ b/bindings.cpp @@ -2013,7 +2013,6 @@ bool DeRestPluginPrivate::sendConfigureReportingRequest(BindingTask &bt) modelId == QLatin1String("SKHMP30-I1") || // GS smart plug modelId.startsWith(QLatin1String("E13-")) || // Sengled PAR38 Bulbs modelId.startsWith(QLatin1String("Z01-A19")) || // Sengled smart led - modelId == QLatin1String("Connected socket outlet")) // Niko smart socket { rq.reportableChange48bit = 10; // 0.001 kWh (1 Wh) } @@ -2065,7 +2064,6 @@ bool DeRestPluginPrivate::sendConfigureReportingRequest(BindingTask &bt) if (modelId == QLatin1String("SmartPlug") || // Heiman modelId == QLatin1String("SKHMP30-I1") || // GS smart plug modelId == QLatin1String("SZ-ESW01-AU") || // Sercomm / Telstra smart plug - modelId == QLatin1String("Connected socket outlet") || // Niko smart socket modelId.startsWith(QLatin1String("ROB_200")) || // ROBB Smarrt micro dimmer modelId.startsWith(QLatin1String("Micro Smart Dimmer")) || // Sunricher Micro Smart Dimmer modelId.startsWith(QLatin1String("lumi.plug.maeu")) || // Xiaomi Aqara ZB3.0 smart plug @@ -2099,7 +2097,6 @@ bool DeRestPluginPrivate::sendConfigureReportingRequest(BindingTask &bt) } else if (modelId.startsWith(QLatin1String("ROB_200")) || // ROBB Smarrt micro dimmer modelId.startsWith(QLatin1String("Micro Smart Dimmer")) || // Sunricher Micro Smart Dimmer - modelId == QLatin1String("Connected socket outlet") || // Niko smart socket modelId.startsWith(QLatin1String("TH112"))) // Sinope Thermostats { rq2.reportableChange16bit = 10; // 1 V @@ -2120,7 +2117,6 @@ bool DeRestPluginPrivate::sendConfigureReportingRequest(BindingTask &bt) modelId.startsWith(QLatin1String("SPLZB-1")) || // Develco smart plug modelId == QLatin1String("Smart16ARelay51AU") || // Aurora (Develco) smart plug modelId == QLatin1String("SZ-ESW01-AU") || // Sercomm / Telstra smart plug - modelId == QLatin1String("Connected socket outlet") || // Niko smart socket modelId == QLatin1String("SMRZB-1") || // Develco smart cable modelId == QLatin1String("TS0121")) // Tuya / Blitzwolf { @@ -3164,7 +3160,6 @@ bool DeRestPluginPrivate::checkSensorBindingsForAttributeReporting(Sensor *senso sensor->modelId().startsWith(QLatin1String("FNB56-")) || sensor->modelId().startsWith(QLatin1String("FB56-")) || // Niko - sensor->modelId() == QLatin1String("Connected socket outlet") || sensor->modelId() == QLatin1String("Smart plug Zigbee PE") || // Sage sensor->modelId() == QLatin1String("Bell") || diff --git a/database.cpp b/database.cpp index d7d58d8bf8..e06b6848fd 100644 --- a/database.cpp +++ b/database.cpp @@ -3684,7 +3684,6 @@ static int sqliteLoadAllSensorsCallback(void *user, int ncols, char **colval , c (sensor.modelId() != QLatin1String("Plug-230V-ZB3.0")) && (sensor.modelId() != QLatin1String("lumi.switch.b1naus01")) && (sensor.modelId() != QLatin1String("lumi.switch.n0agl1")) && - (sensor.modelId() != QLatin1String("Connected socket outlet")) && (!sensor.modelId().startsWith(QLatin1String("SPW35Z")))) { item = sensor.addItem(DataTypeInt16, RStatePower); diff --git a/de_web_plugin.cpp b/de_web_plugin.cpp index 056fff3ebb..26bb9874c8 100644 --- a/de_web_plugin.cpp +++ b/de_web_plugin.cpp @@ -512,7 +512,6 @@ static const SupportedDevice supportedDevices[] = { { VENDOR_EMBERTEC, "BQZ10-AU", embertecMacPrefix }, // Embertec smart plug { VENDOR_MUELLER, "ZBT-Remote-ALL-RGBW", jennicMacPrefix }, // Tint remote control { VENDOR_PLUGWISE_BV, "160-01", emberMacPrefix }, // Plugwise smart plug - { VENDOR_NIKO_NV, "Connected socket outlet", konkeMacPrefix }, // Niko smart socket 170-33505 { VENDOR_NIKO_NV, "Smart plug Zigbee PE", silabs9MacPrefix }, // Niko Smart Plug 552-80699 { VENDOR_ATMEL, "Bell", dishMacPrefix }, // Sage doorbell sensor { VENDOR_UNIVERSAL2, "4655BC0", emberMacPrefix }, // Ecolink contact sensor @@ -7515,7 +7514,6 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const SensorFi (modelId != QLatin1String("lumi.switch.n2aeu1")) && (modelId != QLatin1String("lumi.switch.b1naus01")) && (modelId != QLatin1String("lumi.switch.n0agl1")) && - (modelId != QLatin1String("Connected socket outlet")) && (!modelId.startsWith(QLatin1String("SPW35Z")))) { item = sensorNode.addItem(DataTypeInt16, RStatePower); diff --git a/devices/niko/170-33505_170-33605_smart_socket.json b/devices/niko/170-33505_170-33605_smart_socket.json new file mode 100644 index 0000000000..b0f234348c --- /dev/null +++ b/devices/niko/170-33505_170-33605_smart_socket.json @@ -0,0 +1,259 @@ +{ + "schema": "devcap1.schema.json", + "manufacturername": "NIKO NV", + "modelid": "Connected socket outlet", + "vendor": "Niko NV", + "product": "170-33505/170-33605", + "sleeper": false, + "status": "Gold", + "subdevices": [ + { + "type": "$TYPE_ON_OFF_PLUGIN_UNIT", + "restapi": "/lights", + "uuid": [ + "$address.ext", + "0x01" + ], + "items": [ + { + "name": "attr/id" + }, + { + "name": "attr/lastannounced" + }, + { + "name": "attr/lastseen" + }, + { + "name": "attr/manufacturername" + }, + { + "name": "attr/modelid" + }, + { + "name": "attr/name" + }, + { + "name": "attr/swversion" + }, + { + "name": "attr/type" + }, + { + "name": "attr/uniqueid" + }, + { + "name": "state/alert" + }, + { + "name": "state/on" + }, + { + "name": "state/reachable" + } + ] + }, + { + "type": "$TYPE_POWER_SENSOR", + "restapi": "/sensors", + "uuid": [ + "$address.ext", + "0x01", + "0x0b04" + ], + "fingerprint": { + "profile": "0x0104", + "device": "0x010A", + "endpoint": "0x01", + "in": [ + "0x0000", + "0x0B04" + ] + }, + "items": [ + { + "name": "attr/id" + }, + { + "name": "attr/lastannounced" + }, + { + "name": "attr/lastseen" + }, + { + "name": "attr/manufacturername" + }, + { + "name": "attr/modelid" + }, + { + "name": "attr/name" + }, + { + "name": "attr/swversion" + }, + { + "name": "attr/type" + }, + { + "name": "attr/uniqueid" + }, + { + "name": "config/on" + }, + { + "name": "config/reachable" + }, + { + "name": "state/current" + }, + { + "name": "state/lastupdated" + }, + { + "name": "state/power", + "parse": { + "at": "0x050B", + "cl": "0x0B04", + "ep": 1, + "eval": "Item.val = Math.round((Attr.val * 1123) / 10000);", + "fn": "zcl" + } + }, + { + "name": "state/voltage", + "parse": { + "at": "0x0505", + "cl": "0x0B04", + "ep": 1, + "eval": "Item.val = Math.round(Attr.val / 10);", + "fn": "zcl" + } + } + ] + }, + { + "type": "$TYPE_CONSUMPTION_SENSOR", + "restapi": "/sensors", + "uuid": [ + "$address.ext", + "0x01", + "0x0702" + ], + "fingerprint": { + "profile": "0x0104", + "device": "0x010A", + "endpoint": "0x01", + "in": [ + "0x0000", + "0x0702" + ] + }, + "items": [ + { + "name": "attr/id" + }, + { + "name": "attr/lastannounced" + }, + { + "name": "attr/lastseen" + }, + { + "name": "attr/manufacturername" + }, + { + "name": "attr/modelid" + }, + { + "name": "attr/name" + }, + { + "name": "attr/swversion" + }, + { + "name": "attr/type" + }, + { + "name": "attr/uniqueid" + }, + { + "name": "config/on" + }, + { + "name": "config/reachable" + }, + { + "name": "state/consumption", + "parse": { + "at": "0x0000", + "cl": "0x0702", + "ep": 1, + "eval": "Item.val = Math.round(Attr.val / 10);", + "fn": "zcl" + } + }, + { + "name": "state/lastupdated" + } + ] + } + ], + "bindings": [ + { + "bind": "unicast", + "src.ep": 1, + "cl": "0x0006", + "report": [ + { + "at": "0x0000", + "dt": "0x10", + "min": 1, + "max": 300 + } + ] + }, + { + "bind": "unicast", + "src.ep": 1, + "cl": "0x0702", + "report": [ + { + "at": "0x0000", + "dt": "0x25", + "min": 1, + "max": 300, + "change": "0x0000000A" + } + ] + }, + { + "bind": "unicast", + "src.ep": 1, + "cl": "0x0B04", + "report": [ + { + "at": "0x0505", + "dt": "0x21", + "min": 1, + "max": 300, + "change": "0x0000000A" + }, + { + "at": "0x0508", + "dt": "0x21", + "min": 1, + "max": 300, + "change": "0x00000064" + }, + { + "at": "0x050B", + "dt": "0x29", + "min": 1, + "max": 300, + "change": "0x0000000B" + } + ] + } + ] +} \ No newline at end of file diff --git a/electrical_measurement.cpp b/electrical_measurement.cpp index 0b6cfeccdb..6c9b5aa7ea 100644 --- a/electrical_measurement.cpp +++ b/electrical_measurement.cpp @@ -110,11 +110,6 @@ void DeRestPluginPrivate::handleElectricalMeasurementClusterIndication(const deC power = static_cast(round(((double)power * 128) / 1000.0)); DDF_AnnoteZclParse(sensor, item, ind.srcEndpoint(), ind.clusterId(), attrId, "if (Attr.val != -32768) { Item.val = Math.round(Attr.val * 128 / 1000); } "); } - else if (modelId == QLatin1String("Connected socket outlet")) // Niko smart socket - { - power = static_cast(round(((double)power * 1123) / 10000.0)); - DDF_AnnoteZclParse(sensor, item, ind.srcEndpoint(), ind.clusterId(), attrId, "if (Attr.val != -32768) { Item.val = Math.round(Attr.val * 1123 / 10000); } "); - } else if (modelId.startsWith(QLatin1String("lumi.relay.c2acn"))) // Xiaomi relay { continue; // Device seems to always report -1 via this cluster/attribute @@ -158,7 +153,6 @@ void DeRestPluginPrivate::handleElectricalMeasurementClusterIndication(const deC modelId.startsWith(QLatin1String("outlet")) || // Samsung SmartThings IM6001-OTP/IM6001-OTP01 modelId.startsWith(QLatin1String("ROB_200")) || // ROBB Smarrt micro dimmer modelId.startsWith(QLatin1String("Micro Smart Dimmer")) || // Sunricher Micro Smart Dimmer - modelId == QLatin1String("Connected socket outlet") || // Niko smart socket modelId.startsWith(QLatin1String("TH112"))) // Sinope Thermostats { voltage = static_cast(round((double)voltage / 10.0)); // 0.1V -> V @@ -203,7 +197,6 @@ void DeRestPluginPrivate::handleElectricalMeasurementClusterIndication(const deC modelId == QLatin1String("TS0121") || // Tuya smart plug modelId.startsWith(QLatin1String("ROB_200")) || // ROBB Smarrt micro dimmer modelId.startsWith(QLatin1String("Micro Smart Dimmer")) || // Sunricher Micro Smart Dimmer - modelId == QLatin1String("Connected socket outlet") || // Niko smart socket modelId == QLatin1String("SMRZB-1") || // Develco smart cable modelId == QLatin1String("PoP") || // Apex Smart Plug modelId == QLatin1String("TS011F") || // Tuya plugs diff --git a/simple_metering.cpp b/simple_metering.cpp index 78321f1785..a2cda91af8 100644 --- a/simple_metering.cpp +++ b/simple_metering.cpp @@ -88,8 +88,7 @@ void DeRestPluginPrivate::handleSimpleMeteringClusterIndication(const deCONZ::Ap modelId.startsWith(QLatin1String("PSMP5_")) || // Climax modelId.startsWith(QLatin1String("SKHMP30")) || // GS smart plug modelId.startsWith(QLatin1String("E13-")) || // Sengled PAR38 Bulbs - modelId.startsWith(QLatin1String("Z01-A19")) || // Sengled smart led - modelId == QLatin1String("Connected socket outlet")) // Niko smart socket + modelId.startsWith(QLatin1String("Z01-A19"))) // Sengled smart led { consumption = static_cast(round((double)consumption / 10.0)); // 0.1 Wh -> Wh DDF_AnnoteZclParse(sensor, item, ind.srcEndpoint(), ind.clusterId(), attrId, "Item.val = Math.round(Attr.val / 10)");