From 4250c319330dca435a18ac0db7b9b4aa663ca95e Mon Sep 17 00:00:00 2001 From: heroprint <77639841+heroprint@users.noreply.github.com> Date: Mon, 5 Sep 2022 15:52:07 +0200 Subject: [PATCH] added power metering --- lib/devices/gen1/shellycolorbulb.js | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/lib/devices/gen1/shellycolorbulb.js b/lib/devices/gen1/shellycolorbulb.js index e48a5fda..f1e4c3c6 100644 --- a/lib/devices/gen1/shellycolorbulb.js +++ b/lib/devices/gen1/shellycolorbulb.js @@ -356,6 +356,42 @@ const shellycolorbulb = { 'read': false, 'write': true } + }, + }, + 'metering.power': { + coap: { + coap_publish: '4101', + coap_publish_funct: (value) => { return value }, + }, + mqtt: { + http_publish: '/status', + http_publish_funct: (value) => { return value ? JSON.parse(value).meters[0].power : undefined; }, + }, + common: { + 'name': 'Device Power status', + 'type': 'number', + 'role': 'value', + 'unit': 'W', + 'read': true, + 'write': false + } + }, + 'metering.energy': { + coap: { + coap_publish: '4103', + coap_publish_funct: (value) => { return value }, + }, + mqtt: { + http_publish: '/status', + http_publish_funct: (value) => { return value ? JSON.parse(value).meters[0].energy : undefined; }, + }, + common: { + 'name': 'Device Energy status', + 'type': 'number', + 'role': 'value', + 'unit': 'Wmin', + 'read': true, + 'write': false } };