Skip to content

Commit

Permalink
EveHistory
Browse files Browse the repository at this point in the history
  • Loading branch information
Luligu committed Mar 14, 2024
1 parent c908ec4 commit eb614ff
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
20 changes: 20 additions & 0 deletions src/EveHistoryCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@ import { TlvUInt32, TlvBoolean, TlvFloat, TlvByteString } from '@project-chip/ma
import { Identity } from '@project-chip/matter-node.js/util';

export namespace EveHistory {
export const enum WeatherTrend {
// on Weather 1-9=Sun 3-4-11=CloudSun 5-6-7=Rain 12-13-14-15=RainWind 0-2-8-10=Empty
BLANK = 0,
SUN = 1,
CLOUDS_SUN = 3,
RAIN = 5,
RAIN_WIND = 12,
}

export const enum Sensitivity {
HIGH = 0,
MEDIUM = 4,
LOW = 7,
}

export const enum TemperatureDisplayUnits {
CELSIUS = 0,
FAHRENHEIT = 1,
}

export const EveDoorComponent = MutableCluster.Component({
attributes: {
ConfigDataGet: Attribute(0x130a0000, TlvByteString),
Expand Down
13 changes: 7 additions & 6 deletions src/matterbridgeDevice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ import { ClusterId, EndpointNumber, VendorId } from '@project-chip/matter-node.j
import { Device, DeviceClasses, DeviceTypeDefinition, EndpointOptions } from '@project-chip/matter-node.js/device';
import { AtLeastOne, extendPublicHandlerMethods } from '@project-chip/matter-node.js/util';

import { MatterHistory, Sensitivity, EveHistoryCluster, WeatherTrend, TemperatureDisplayUnits } from 'matter-history';
import { MatterHistory, Sensitivity, WeatherTrend, TemperatureDisplayUnits } from 'matter-history';

import { AirQuality, AirQualityCluster } from './AirQualityCluster.js';
import { AnsiLogger } from 'node-ansi-logger';
import { createHash } from 'crypto';
import { TvocMeasurement, TvocMeasurementCluster } from './TvocCluster.js';
import { EveHistory, EveHistoryCluster } from './EveHistoryCluster.js';

type MakeMandatory<T> = Exclude<T, undefined>;

Expand Down Expand Up @@ -182,7 +183,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods<typeof Device
history.setMatterHystoryType('room', this.serialNumber);
this.addClusterServer(
ClusterServer(
EveHistoryCluster,
EveHistoryCluster.with(EveHistory.Feature.EveRoom),
{
// Dynamic attributes
ConfigDataGet: Uint8Array.fromHex(''),
Expand Down Expand Up @@ -253,7 +254,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods<typeof Device
history.setMatterHystoryType('weather', this.serialNumber);
this.addClusterServer(
ClusterServer(
EveHistoryCluster,
EveHistoryCluster.with(EveHistory.Feature.EveWeather),
{
// Dynamic attributes
ConfigDataGet: Uint8Array.fromHex(''),
Expand Down Expand Up @@ -327,7 +328,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods<typeof Device
history.setMatterHystoryType('energy');
this.addClusterServer(
ClusterServer(
EveHistoryCluster,
EveHistoryCluster.with(EveHistory.Feature.EveEnergy),
{
// Dynamic attributes
ConfigDataGet: Uint8Array.fromHex(''),
Expand Down Expand Up @@ -419,7 +420,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods<typeof Device
history.setMatterHystoryType('motion');
this.addClusterServer(
ClusterServer(
EveHistoryCluster,
EveHistoryCluster.with(EveHistory.Feature.EveMotion),
{
// Dynamic attributes
ConfigDataGet: Uint8Array.fromHex(''),
Expand Down Expand Up @@ -496,7 +497,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods<typeof Device
history.setMatterHystoryType('door');
this.addClusterServer(
ClusterServer(
EveHistoryCluster,
EveHistoryCluster.with(EveHistory.Feature.EveDoor),
{
// Dynamic attributes
ConfigDataGet: Uint8Array.fromHex(''),
Expand Down

0 comments on commit eb614ff

Please sign in to comment.