Skip to content

Commit

Permalink
Merge pull request #5813 from SwoopX/niko
Browse files Browse the repository at this point in the history
Add DDF for Niko connected socket outlet 170-33505/170-33605
  • Loading branch information
manup authored Feb 26, 2022
2 parents 2674663 + 901fe77 commit 770f0d9
Show file tree
Hide file tree
Showing 6 changed files with 260 additions and 17 deletions.
5 changes: 0 additions & 5 deletions bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -2119,7 +2116,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
{
Expand Down Expand Up @@ -3163,7 +3159,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") ||
Expand Down
1 change: 0 additions & 1 deletion database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3683,7 +3683,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);
Expand Down
2 changes: 0 additions & 2 deletions de_web_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,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
Expand Down Expand Up @@ -7513,7 +7512,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);
Expand Down
259 changes: 259 additions & 0 deletions devices/niko/170-33505_170-33605_smart_socket.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
]
}
7 changes: 0 additions & 7 deletions electrical_measurement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,6 @@ void DeRestPluginPrivate::handleElectricalMeasurementClusterIndication(const deC
power = static_cast<qint16>(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<qint16>(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
Expand Down Expand Up @@ -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<quint16>(round((double)voltage / 10.0)); // 0.1V -> V
Expand Down Expand Up @@ -202,7 +196,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
Expand Down
3 changes: 1 addition & 2 deletions simple_metering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<quint64>(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)");
Expand Down

0 comments on commit 770f0d9

Please sign in to comment.