Skip to content

Commit d4f7f4c

Browse files
committed
Release 0.5.1
1 parent 93aab36 commit d4f7f4c

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
77
### Added
88

99
- [color]: Added ColorControl cluster to shelly device with rgb.
10+
- [current]: Added the current value to EveHistory electrical cluster.
1011

1112
### Fixed
1213

src/platform.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,11 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform {
283283
// this.log.warn(`Added EveHistory cluster to ${device.id} component ${key}`);
284284
}
285285

286+
// TODO: Add the WindowCovering attributes
287+
/*
288+
"pos_control": true,
289+
"current_pos": 0
290+
*/
286291
// Set the WindowCovering attributes
287292
mbDevice.setWindowCoveringTargetAsCurrentAndStopped(child);
288293
// Add command handlers
@@ -733,13 +738,27 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform {
733738
const cluster = endpoint.getClusterServer(EveHistoryCluster.with(EveHistory.Feature.EveEnergy));
734739
cluster?.setConsumptionAttribute(value as number);
735740
if (cluster) shellyDevice.log.info(`${db}Update endpoint ${or}${endpoint.number}${db} attribute ${hk}EveHistory-consumption${db} ${YELLOW}${value as number}${db}`);
741+
const voltage = shellyComponent.getValue('voltage') as number;
742+
if (voltage) {
743+
const current = (value as number) / voltage;
744+
cluster?.setCurrentAttribute(current as number);
745+
shellyDevice.log.info(`${db}Update endpoint ${or}${endpoint.number}${db} attribute ${hk}EveHistory-current${db} ${YELLOW}${current as number}${db}`);
746+
}
736747
}
737748
if (property === 'total') {
738749
const cluster = endpoint.getClusterServer(EveHistoryCluster.with(EveHistory.Feature.EveEnergy));
739750
cluster?.setTotalConsumptionAttribute((value as number) / 1000); // convert to kWh
740751
if (cluster)
741752
shellyDevice.log.info(`${db}Update endpoint ${or}${endpoint.number}${db} attribute ${hk}EveHistory-totalConsumption${db} ${YELLOW}${(value as number) / 1000}${db}`);
742753
}
754+
if (property === 'aenergy') {
755+
const cluster = endpoint.getClusterServer(EveHistoryCluster.with(EveHistory.Feature.EveEnergy));
756+
cluster?.setTotalConsumptionAttribute(((value as ShellyData).total as number) / 1000); // convert to kWh
757+
if (cluster)
758+
shellyDevice.log.info(
759+
`${db}Update endpoint ${or}${endpoint.number}${db} attribute ${hk}EveHistory-totalConsumption${db} ${YELLOW}${((value as ShellyData).total as number) / 1000}${db}`,
760+
);
761+
}
743762
if (property === 'voltage') {
744763
const cluster = endpoint.getClusterServer(EveHistoryCluster.with(EveHistory.Feature.EveEnergy));
745764
cluster?.setVoltageAttribute(value as number);

0 commit comments

Comments
 (0)