From d4f7f4c1eb48ab320cfca1134dc3a2fd7dfed8bd Mon Sep 17 00:00:00 2001 From: Luligu <132135057+Luligu@users.noreply.github.com> Date: Tue, 25 Jun 2024 09:37:50 +0200 Subject: [PATCH] Release 0.5.1 --- CHANGELOG.md | 1 + src/platform.ts | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 364c77a..4c09ce5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ### Added - [color]: Added ColorControl cluster to shelly device with rgb. +- [current]: Added the current value to EveHistory electrical cluster. ### Fixed diff --git a/src/platform.ts b/src/platform.ts index 5988d09..2d7b62c 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -283,6 +283,11 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { // this.log.warn(`Added EveHistory cluster to ${device.id} component ${key}`); } + // TODO: Add the WindowCovering attributes + /* + "pos_control": true, + "current_pos": 0 + */ // Set the WindowCovering attributes mbDevice.setWindowCoveringTargetAsCurrentAndStopped(child); // Add command handlers @@ -733,6 +738,12 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { const cluster = endpoint.getClusterServer(EveHistoryCluster.with(EveHistory.Feature.EveEnergy)); cluster?.setConsumptionAttribute(value as number); if (cluster) shellyDevice.log.info(`${db}Update endpoint ${or}${endpoint.number}${db} attribute ${hk}EveHistory-consumption${db} ${YELLOW}${value as number}${db}`); + const voltage = shellyComponent.getValue('voltage') as number; + if (voltage) { + const current = (value as number) / voltage; + cluster?.setCurrentAttribute(current as number); + shellyDevice.log.info(`${db}Update endpoint ${or}${endpoint.number}${db} attribute ${hk}EveHistory-current${db} ${YELLOW}${current as number}${db}`); + } } if (property === 'total') { const cluster = endpoint.getClusterServer(EveHistoryCluster.with(EveHistory.Feature.EveEnergy)); @@ -740,6 +751,14 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { if (cluster) shellyDevice.log.info(`${db}Update endpoint ${or}${endpoint.number}${db} attribute ${hk}EveHistory-totalConsumption${db} ${YELLOW}${(value as number) / 1000}${db}`); } + if (property === 'aenergy') { + const cluster = endpoint.getClusterServer(EveHistoryCluster.with(EveHistory.Feature.EveEnergy)); + cluster?.setTotalConsumptionAttribute(((value as ShellyData).total as number) / 1000); // convert to kWh + if (cluster) + shellyDevice.log.info( + `${db}Update endpoint ${or}${endpoint.number}${db} attribute ${hk}EveHistory-totalConsumption${db} ${YELLOW}${((value as ShellyData).total as number) / 1000}${db}`, + ); + } if (property === 'voltage') { const cluster = endpoint.getClusterServer(EveHistoryCluster.with(EveHistory.Feature.EveEnergy)); cluster?.setVoltageAttribute(value as number);