homebridge-pvs6 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,7 @@
1
1
  # homebridge-pvs6
2
+ [![License: MIT](https://img.shields.io/github/license/dacarson/homebridge-pvs6)](LICENSE)
3
+ [![Version](https://img.shields.io/github/v/release/dacarson/homebridge-pvs6)](https://github.com/dacarson/homebridge-pvs6/releases)
4
+ [![npm downloads](https://img.shields.io/npm/dt/homebridge-pvs6)](https://www.npmjs.com/package/homebridge-pvs6)
2
5
 
3
6
  A [Homebridge](https://homebridge.io) plugin for the [SunStrong PVS6](https://sunstrong.com) solar monitoring system. Exposes solar production and grid metering as **Eve Energy** accessories in Apple HomeKit, with real-time power, cumulative energy, and native Eve app history.
4
7
 
@@ -26,7 +29,7 @@ A [Homebridge](https://homebridge.io) plugin for the [SunStrong PVS6](https://su
26
29
  - Polls the PVS6 **local** FCGI API — no SunStrong Connect, no cloud dependency
27
30
  - **Auto-discovers** the PVS6 on your local network via mDNS — no IP address or serial number required in config
28
31
  - Automatically identifies production and consumption CT meters from the PVS6 device list
29
- - Designed to complement [homebridge-rainforest-eagle3](https://github.com/dacarson/homebridge-rainforest-eagle3) for a complete solar + grid picture in Apple Home
32
+ - Optional: live watts in the Apple Home **Energy** view via Matter (see [Apple Home Energy & Matter](#apple-home-energy--matter))
30
33
 
31
34
  ---
32
35
 
@@ -62,7 +65,7 @@ Grid Import and Grid Export are always registered together — enabling `accesso
62
65
 
63
66
  ## Requirements
64
67
 
65
- - [Homebridge](https://homebridge.io) v2.0 or later
68
+ - [Homebridge](https://homebridge.io) v2.0 or later (v2.3.0+ if you want the optional Apple Home Energy view via Matter)
66
69
  - Node.js 18 or later
67
70
  - SunStrong PVS6 on the same local network as your Homebridge host
68
71
 
@@ -132,6 +135,7 @@ Uncheck **Auto Discover** and supply the host and serial number directly. This s
132
135
  "host": "pvs.local",
133
136
  "serialNumber": "ZT231385000549A1234",
134
137
  "pollInterval": 10,
138
+ "matter": true,
135
139
  "accessories": {
136
140
  "grid": true,
137
141
  "homeConsumption": true
@@ -154,6 +158,7 @@ Uncheck **Auto Discover** and supply the host and serial number directly. This s
154
158
  | `host` | string | no* | — | IP address or hostname of the PVS6. Used only when `autoDiscover` is `false` |
155
159
  | `serialNumber` | string | no* | — | Full PVS6 serial number. The last 5 characters are used as the API password. Used only when `autoDiscover` is `false` |
156
160
  | `pollInterval` | integer | no | `10` | Seconds between polls. Minimum enforced: `5` |
161
+ | `matter` | boolean | no | `false` | Also publish each enabled meter over Matter with live electrical measurements, so it shows watts on its tile in the Apple Home Energy view (see [Apple Home Energy & Matter](#apple-home-energy--matter)) |
157
162
  | `accessories.grid` | boolean | no | `true` | Enable the Grid Import + Grid Export accessory pair. Set `false` to disable both |
158
163
  | `accessories.homeConsumption` | boolean | no | `false` | Enable the Home Consumption accessory. Opt-in; off by default |
159
164
  | `solarName` | string | no | `"Solar Production"` | HomeKit display name for the Solar Production accessory |
@@ -213,6 +218,39 @@ The derived kWh formula is exact without a battery: solar energy either goes to
213
218
 
214
219
  ---
215
220
 
221
+ ## Apple Home Energy & Matter
222
+
223
+ Apple Home's native **Energy** view is driven by **Matter** electrical-measurement clusters, **not** by classic HomeKit/HAP characteristics. HAP has no power or energy characteristic at all, so the Eve characteristics above (which only Eve-class apps read) can never populate it — no matter how the HomeKit accessory is shaped.
224
+
225
+ With `"matter": true`, this plugin publishes an **`ElectricalSensor`** Matter accessory for Solar Production and Grid, carrying live power and cumulative/periodic energy — no on/off, no controllable state, purely metering:
226
+
227
+ | Meter | Matter accessory | Matter power attribute | Matter energy attributes |
228
+ |---|---|---|---|
229
+ | Solar Production | "Solar Production" | `electricalPowerMeasurement.activePower` (always negative — see below) | `electricalEnergyMeasurement.cumulativeEnergyExported` |
230
+ | Grid | "Grid" | `electricalPowerMeasurement.activePower` (signed: positive = importing, negative = exporting) | `electricalEnergyMeasurement.cumulativeEnergyImported` **and** `cumulativeEnergyExported`, together |
231
+
232
+ Power is sent in milliwatts, energy in milliwatt-hours, per the Matter spec. Matter's `activePower` sign convention is positive = the accessory is *drawing* power, negative = it's *supplying* power — Solar Production only ever supplies (so its wattage is negated before being sent), and Grid does both depending on live direction.
233
+
234
+ **Home Consumption is intentionally not published over Matter.** Its energy is mathematically derived from the other two (`homeConsumptionKWh = pvEnergyKWh + gridImportKWh − gridExportKWh`, see [How It Works](#how-it-works)) rather than an independent measurement, so exposing all three to Apple Home's own aggregate power total risked double-counting rather than isolating grid draw. Home Consumption still works exactly as before in Eve/HomeKit.
235
+
236
+ **Grid Import and Grid Export stay two separate accessories in Eve/HomeKit** (see [HomeKit Accessories](#homekit-accessories) below) — that split exists only because Eve's custom Energy characteristic can't represent a negative wattage. Matter's `activePower` attribute *is* signed, so on the Matter side the grid meter is published as a single **"Grid"** accessory instead, with power flipping sign as the meter crosses between importing and exporting. Matter's cumulative/periodic *energy* attributes have no equivalent signed "net" value — Imported and Exported are always separate running totals per the Matter spec — so the Grid accessory reports both simultaneously on the one accessory rather than needing two.
237
+
238
+ **Why a pure sensor and not an outlet:** this device type has no on/off cluster, so its tile in the Home app shows "Not Supported" as its headline status — Home's tile face wants a primary characteristic (on/off, a reading, etc.) to display, and a pure measurement cluster doesn't provide one. An earlier version of this feature used Matter's `OnOffOutlet` device type specifically to get a tile headline (the same approach [homebridge-chargepoint](https://github.com/dacarson/homebridge-chargepoint) uses), at the cost of declaring a fake on/off state that couldn't actually be switched. That tradeoff was reversed: the tile headline isn't worth carrying dead on/off state for, as long as the wattage still rolls into the Home aggregate and — via periodic energy, below — into each accessory's own Energy-view attribution, which it does either way.
239
+
240
+ **Cumulative and periodic energy:** each meter reports both the lifetime total (`cumulativeEnergyImported`/`Exported`) and a periodic delta (`periodicEnergyImported`/`Exported`, at most once a minute) with its own start/end timestamps. The periodic figure is what drives Apple Home's per-device energy attribution in the Energy view, not the cumulative total alone.
241
+
242
+ Requirements:
243
+
244
+ - **Homebridge 2.3.0 or later**
245
+ - **Matter enabled on this plugin's child bridge** — in the Homebridge UI: plugin settings → **Bridge Settings** → enable Matter, then pair the Matter bridge in the Home app
246
+ - An Apple Home setup on **iOS/tvOS 26 or later** for the Energy view itself
247
+
248
+ If the Matter API isn't available (older Homebridge, or Matter not enabled), the plugin detects that, logs a single informational line, and continues to work exactly as before over HomeKit/Eve.
249
+
250
+ **Upgrading from an earlier version:** since this changes the Matter device type (and merges Grid Import/Export into one accessory), Apple Home will likely need the old Matter tiles removed and the Matter bridge re-paired to pick up the new endpoints cleanly.
251
+
252
+ ---
253
+
216
254
  ## Error Handling
217
255
 
218
256
  The plugin is designed to be resilient to transient PVS6 failures:
@@ -35,6 +35,12 @@
35
35
  "minimum": 5,
36
36
  "description": "How often to poll the PVS6 for new data. Minimum 5 seconds."
37
37
  },
38
+ "matter": {
39
+ "title": "Show in the Apple Home Energy view (via Matter)",
40
+ "type": "boolean",
41
+ "default": false,
42
+ "description": "Also publish Solar and Grid (import/export combined) over Matter as electrical sensors with live power and cumulative/periodic energy, feeding your Apple Home Energy view. Home Consumption is not published over Matter, since its energy is derived from Solar + Grid rather than an independent measurement. Requires Homebridge 2.3.0+ with Matter enabled on this plugin's child bridge; skipped safely otherwise."
43
+ },
38
44
  "accessories": {
39
45
  "title": "Accessories",
40
46
  "type": "object",
@@ -0,0 +1,152 @@
1
+ /**
2
+ * matterEnergy.ts
3
+ *
4
+ * Publishes a PVS6 meter (solar, grid, home consumption) to Matter
5
+ * controllers as an ElectricalSensor reporting live power and cumulative /
6
+ * periodic energy, so it feeds the Apple Home Energy view (iOS 26+).
7
+ *
8
+ * Background
9
+ * ----------
10
+ * Apple Home's Energy view is driven by Matter electrical-measurement
11
+ * clusters, not by classic HomeKit/HAP characteristics. HAP has no native
12
+ * power/energy characteristic, so the Eve custom characteristics this plugin
13
+ * also exposes (see eveCharacteristics.ts) are only ever read by Eve-class
14
+ * apps and never populate the native Energy tile.
15
+ *
16
+ * Device type: ElectricalSensor, not OnOffOutlet
17
+ * -----------------------------------------------
18
+ * An earlier version of this feature declared these accessories as
19
+ * OnOffOutlet so their tile would show a headline status (a pure metering
20
+ * device type like ElectricalSensor has no actionable primary cluster, and
21
+ * its tile showed "Not Supported" as a result — confirmed live). That's
22
+ * reverted here: none of these meters are actually controllable, the on/off
23
+ * state was only ever a workaround for the tile headline, and the "Not
24
+ * Supported" tile is an accepted tradeoff as long as the wattage still rolls
25
+ * into the Home aggregate and (via PeriodicEnergy, below) into this
26
+ * accessory's own Energy-view attribution — which it does.
27
+ *
28
+ * powerW -> electricalPowerMeasurement.activePower (mW, signed)
29
+ * energyKWh -> electricalEnergyMeasurement.cumulativeEnergyImported.energy (mWh)
30
+ * and/or .cumulativeEnergyExported.energy, depending on this
31
+ * meter's direction (see EnergyDirection below).
32
+ *
33
+ * Matter expresses power in milliwatts and energy in milliwatt-hours, hence
34
+ * the x1000 / x1,000,000 conversions. cumulativeEnergyImported/Exported are
35
+ * themselves structs (EnergyMeasurementStruct — { energy, startTimestamp?,
36
+ * endTimestamp?, ... }), not plain numbers: Homebridge's updateAccessoryState()
37
+ * accepts and normalizes a flat number for convenience, but the *initial*
38
+ * state passed at registration goes straight to matter.js's struct-typed
39
+ * attribute and must already be an object, or registration fails with
40
+ * "Cannot manage number because it is not a struct".
41
+ *
42
+ * Homebridge derives the mandatory cluster attributes (powerMode, accuracy,
43
+ * numberOfMeasurementTypes) and the feature-gated ElectricalEnergyMeasurement
44
+ * features from the declared state — declaring `cumulativeEnergyImported`
45
+ * selects the ImportedEnergy + CumulativeEnergy features, `cumulativeEnergyExported`
46
+ * selects ExportedEnergy + CumulativeEnergy, and both together (for a
47
+ * bidirectional meter) select both pairs at once. No voltage/current data is
48
+ * available from the PVS6 varserver reliably enough to publish, so only
49
+ * activePower is declared; voltage/activeCurrent are optional per the
50
+ * Matter spec and are simply omitted.
51
+ *
52
+ * Imported vs. exported energy is always two separate attributes
53
+ * ------------------------------------------------------------
54
+ * `activePower` is a signed attribute (positive = importing, negative =
55
+ * exporting), so a single bidirectional meter — the grid meter — can report
56
+ * live direction with one accessory. Cumulative/periodic *energy* has no
57
+ * equivalent signed "net" attribute, though: Imported and Exported are
58
+ * distinct lifetime running totals per the Matter spec (you don't want a
59
+ * day's production and consumption cancelling each other out), so a
60
+ * bidirectional meter still declares both `cumulativeEnergyImported` and
61
+ * `cumulativeEnergyExported` (and their periodic counterparts) together on
62
+ * the same cluster. See EnergyDirection's 'bidirectional' case below — this
63
+ * is how the grid meter is published as a single Matter accessory even
64
+ * though it remains two separate accessories in Eve/HomeKit (Grid Import /
65
+ * Grid Export), since that split is purely about Eve's inability to
66
+ * represent a negative watt value, not a Matter limitation.
67
+ *
68
+ * Cumulative vs. periodic energy
69
+ * ------------------------------
70
+ * Alongside the cumulative (lifetime) total, this module also declares the
71
+ * PeriodicEnergy feature (`periodicEnergyImported`/`periodicEnergyExported`)
72
+ * — a per-interval delta with its own start/end timestamps. Per prior art in
73
+ * homebridge-shelly-matter (github.com/keremerkan/homebridge-shelly-matter,
74
+ * shellyAccessory.ts), this is what drives Apple Home's per-device energy
75
+ * attribution in the Energy view, not the cumulative total alone. Matter
76
+ * features compose once at registration, so PeriodicEnergy must already be
77
+ * present in the *initial* cluster state passed to registerPlatformAccessories()
78
+ * — declaring it for the first time in a later updateAccessoryState() call
79
+ * would not retroactively add the feature. buildClusters() therefore seeds a
80
+ * zero-energy periodic fragment (no timestamps yet) on its very first call,
81
+ * which is always the one register() makes, before any real reading exists
82
+ * to diff against; every call after that computes a real delta against the
83
+ * last *periodic* baseline (not the last poll), throttled to at most once
84
+ * per MIN_PERIODIC_INTERVAL_S so a short poll interval (default 10s, minimum
85
+ * 5s) doesn't turn into excessive Matter event/state churn compared to a
86
+ * device that naturally reports once a minute. A bidirectional meter tracks
87
+ * imported and exported baselines independently, since either can advance
88
+ * while the other sits idle.
89
+ *
90
+ * Requirements
91
+ * ------------
92
+ * - Homebridge 2.3.0+
93
+ * - Matter enabled on this plugin's child bridge (Homebridge UI ->
94
+ * plugin settings -> Bridge Settings -> enable Matter)
95
+ *
96
+ * Everything here is feature-detected and guarded: on a Homebridge build
97
+ * without the Matter API, or with Matter disabled, isSupported() returns
98
+ * false and the plugin runs HAP/Eve-only exactly as before.
99
+ */
100
+ import type { API, Logger } from 'homebridge';
101
+ export type EnergyDirection = 'imported' | 'exported' | 'bidirectional';
102
+ export interface EnergyReadings {
103
+ /** Signed for a 'bidirectional' meter (positive = importing, negative = exporting). */
104
+ powerW: number;
105
+ /** Required when direction is 'imported' or 'bidirectional'. */
106
+ importedEnergyKWh?: number;
107
+ /** Required when direction is 'exported' or 'bidirectional'. */
108
+ exportedEnergyKWh?: number;
109
+ }
110
+ export declare class MatterEnergyBridge {
111
+ private readonly log;
112
+ private readonly direction;
113
+ private static readonly MIN_PERIODIC_INTERVAL_S;
114
+ private readonly api;
115
+ private uuid;
116
+ private registered;
117
+ private warnedUpdate;
118
+ private periodicState;
119
+ constructor(api: API, log: Logger, direction: EnergyDirection);
120
+ /**
121
+ * Whether this Homebridge build exposes everything needed to publish this
122
+ * meter. Logs at debug level so unsupported builds stay quiet.
123
+ */
124
+ isSupported(): boolean;
125
+ private buildClusters;
126
+ /**
127
+ * Compute (or, between periodic reports, just return the last computed)
128
+ * periodic-energy fragment for one energy kind. The very first call —
129
+ * always from register(), before any real reading exists — seeds a
130
+ * zero-energy fragment with no timestamps, purely so the PeriodicEnergy
131
+ * feature composes at registration. Every call after that reports a real
132
+ * delta against the last periodic baseline once MIN_PERIODIC_INTERVAL_S
133
+ * has elapsed.
134
+ */
135
+ private computePeriodic;
136
+ /**
137
+ * Register this meter as a Matter electrical sensor.
138
+ *
139
+ * @param seedKey - unique per-meter key used to derive this accessory's
140
+ * Matter UUID, distinct from the HAP accessory's UUID
141
+ * @param displayName
142
+ * @param serialNumber
143
+ * @param readings - initial readings to seed the clusters with
144
+ */
145
+ register(seedKey: string, displayName: string, serialNumber: string, readings: EnergyReadings): Promise<boolean>;
146
+ /**
147
+ * Push fresh readings to the registered Matter accessory. No-op until
148
+ * registration has succeeded.
149
+ */
150
+ update(readings: EnergyReadings): Promise<void>;
151
+ }
152
+ //# sourceMappingURL=matterEnergy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matterEnergy.d.ts","sourceRoot":"","sources":["../src/matterEnergy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkGG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAqB9C,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,UAAU,GAAG,eAAe,CAAC;AAExE,MAAM,WAAW,cAAc;IAC7B,uFAAuF;IACvF,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAmDD,qBAAa,kBAAkB;IAkB3B,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAlB5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAAM;IAErD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgB;IACpC,OAAO,CAAC,IAAI,CAAuB;IACnC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,YAAY,CAAS;IAK7B,OAAO,CAAC,aAAa,CAGnB;gBAGA,GAAG,EAAE,GAAG,EACS,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,eAAe;IAK7C;;;OAGG;IACH,WAAW,IAAI,OAAO;IAiBtB,OAAO,CAAC,aAAa;IAkBrB;;;;;;;;OAQG;IACH,OAAO,CAAC,eAAe;IAwBvB;;;;;;;;OAQG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IA2BtH;;;OAGG;IACG,MAAM,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAwBtD"}
@@ -0,0 +1,263 @@
1
+ "use strict";
2
+ /**
3
+ * matterEnergy.ts
4
+ *
5
+ * Publishes a PVS6 meter (solar, grid, home consumption) to Matter
6
+ * controllers as an ElectricalSensor reporting live power and cumulative /
7
+ * periodic energy, so it feeds the Apple Home Energy view (iOS 26+).
8
+ *
9
+ * Background
10
+ * ----------
11
+ * Apple Home's Energy view is driven by Matter electrical-measurement
12
+ * clusters, not by classic HomeKit/HAP characteristics. HAP has no native
13
+ * power/energy characteristic, so the Eve custom characteristics this plugin
14
+ * also exposes (see eveCharacteristics.ts) are only ever read by Eve-class
15
+ * apps and never populate the native Energy tile.
16
+ *
17
+ * Device type: ElectricalSensor, not OnOffOutlet
18
+ * -----------------------------------------------
19
+ * An earlier version of this feature declared these accessories as
20
+ * OnOffOutlet so their tile would show a headline status (a pure metering
21
+ * device type like ElectricalSensor has no actionable primary cluster, and
22
+ * its tile showed "Not Supported" as a result — confirmed live). That's
23
+ * reverted here: none of these meters are actually controllable, the on/off
24
+ * state was only ever a workaround for the tile headline, and the "Not
25
+ * Supported" tile is an accepted tradeoff as long as the wattage still rolls
26
+ * into the Home aggregate and (via PeriodicEnergy, below) into this
27
+ * accessory's own Energy-view attribution — which it does.
28
+ *
29
+ * powerW -> electricalPowerMeasurement.activePower (mW, signed)
30
+ * energyKWh -> electricalEnergyMeasurement.cumulativeEnergyImported.energy (mWh)
31
+ * and/or .cumulativeEnergyExported.energy, depending on this
32
+ * meter's direction (see EnergyDirection below).
33
+ *
34
+ * Matter expresses power in milliwatts and energy in milliwatt-hours, hence
35
+ * the x1000 / x1,000,000 conversions. cumulativeEnergyImported/Exported are
36
+ * themselves structs (EnergyMeasurementStruct — { energy, startTimestamp?,
37
+ * endTimestamp?, ... }), not plain numbers: Homebridge's updateAccessoryState()
38
+ * accepts and normalizes a flat number for convenience, but the *initial*
39
+ * state passed at registration goes straight to matter.js's struct-typed
40
+ * attribute and must already be an object, or registration fails with
41
+ * "Cannot manage number because it is not a struct".
42
+ *
43
+ * Homebridge derives the mandatory cluster attributes (powerMode, accuracy,
44
+ * numberOfMeasurementTypes) and the feature-gated ElectricalEnergyMeasurement
45
+ * features from the declared state — declaring `cumulativeEnergyImported`
46
+ * selects the ImportedEnergy + CumulativeEnergy features, `cumulativeEnergyExported`
47
+ * selects ExportedEnergy + CumulativeEnergy, and both together (for a
48
+ * bidirectional meter) select both pairs at once. No voltage/current data is
49
+ * available from the PVS6 varserver reliably enough to publish, so only
50
+ * activePower is declared; voltage/activeCurrent are optional per the
51
+ * Matter spec and are simply omitted.
52
+ *
53
+ * Imported vs. exported energy is always two separate attributes
54
+ * ------------------------------------------------------------
55
+ * `activePower` is a signed attribute (positive = importing, negative =
56
+ * exporting), so a single bidirectional meter — the grid meter — can report
57
+ * live direction with one accessory. Cumulative/periodic *energy* has no
58
+ * equivalent signed "net" attribute, though: Imported and Exported are
59
+ * distinct lifetime running totals per the Matter spec (you don't want a
60
+ * day's production and consumption cancelling each other out), so a
61
+ * bidirectional meter still declares both `cumulativeEnergyImported` and
62
+ * `cumulativeEnergyExported` (and their periodic counterparts) together on
63
+ * the same cluster. See EnergyDirection's 'bidirectional' case below — this
64
+ * is how the grid meter is published as a single Matter accessory even
65
+ * though it remains two separate accessories in Eve/HomeKit (Grid Import /
66
+ * Grid Export), since that split is purely about Eve's inability to
67
+ * represent a negative watt value, not a Matter limitation.
68
+ *
69
+ * Cumulative vs. periodic energy
70
+ * ------------------------------
71
+ * Alongside the cumulative (lifetime) total, this module also declares the
72
+ * PeriodicEnergy feature (`periodicEnergyImported`/`periodicEnergyExported`)
73
+ * — a per-interval delta with its own start/end timestamps. Per prior art in
74
+ * homebridge-shelly-matter (github.com/keremerkan/homebridge-shelly-matter,
75
+ * shellyAccessory.ts), this is what drives Apple Home's per-device energy
76
+ * attribution in the Energy view, not the cumulative total alone. Matter
77
+ * features compose once at registration, so PeriodicEnergy must already be
78
+ * present in the *initial* cluster state passed to registerPlatformAccessories()
79
+ * — declaring it for the first time in a later updateAccessoryState() call
80
+ * would not retroactively add the feature. buildClusters() therefore seeds a
81
+ * zero-energy periodic fragment (no timestamps yet) on its very first call,
82
+ * which is always the one register() makes, before any real reading exists
83
+ * to diff against; every call after that computes a real delta against the
84
+ * last *periodic* baseline (not the last poll), throttled to at most once
85
+ * per MIN_PERIODIC_INTERVAL_S so a short poll interval (default 10s, minimum
86
+ * 5s) doesn't turn into excessive Matter event/state churn compared to a
87
+ * device that naturally reports once a minute. A bidirectional meter tracks
88
+ * imported and exported baselines independently, since either can advance
89
+ * while the other sits idle.
90
+ *
91
+ * Requirements
92
+ * ------------
93
+ * - Homebridge 2.3.0+
94
+ * - Matter enabled on this plugin's child bridge (Homebridge UI ->
95
+ * plugin settings -> Bridge Settings -> enable Matter)
96
+ *
97
+ * Everything here is feature-detected and guarded: on a Homebridge build
98
+ * without the Matter API, or with Matter disabled, isSupported() returns
99
+ * false and the plugin runs HAP/Eve-only exactly as before.
100
+ */
101
+ Object.defineProperty(exports, "__esModule", { value: true });
102
+ exports.MatterEnergyBridge = void 0;
103
+ const PLUGIN_NAME = 'homebridge-pvs6';
104
+ const PLATFORM_NAME = 'PVS6';
105
+ /** Matter expresses power in milliwatts. */
106
+ function wToMilliW(value) {
107
+ const n = Number(value);
108
+ return Number.isFinite(n) ? Math.round(n * 1000) : 0;
109
+ }
110
+ /** Matter expresses energy in milliwatt-hours; PVS6 readings are in kWh. */
111
+ function kWhToMilliWh(value) {
112
+ const n = Number(value);
113
+ return Number.isFinite(n) ? Math.round(Math.max(0, n) * 1000000) : 0;
114
+ }
115
+ class MatterEnergyBridge {
116
+ constructor(api, log, direction) {
117
+ this.log = log;
118
+ this.direction = direction;
119
+ this.uuid = null;
120
+ this.registered = false;
121
+ this.warnedUpdate = false;
122
+ // Periodic-energy bookkeeping — see the "Cumulative vs. periodic energy"
123
+ // note at the top of this file. Tracked per energy kind so a bidirectional
124
+ // meter can advance its imported and exported deltas independently.
125
+ this.periodicState = {
126
+ imported: { baselineKWh: null, timestampS: null, last: { energy: 0 } },
127
+ exported: { baselineKWh: null, timestampS: null, last: { energy: 0 } },
128
+ };
129
+ this.api = api;
130
+ }
131
+ /**
132
+ * Whether this Homebridge build exposes everything needed to publish this
133
+ * meter. Logs at debug level so unsupported builds stay quiet.
134
+ */
135
+ isSupported() {
136
+ const matter = this.api.matter;
137
+ if (!matter) {
138
+ this.log.debug('[matter] api.matter unavailable — Matter energy export disabled. Requires Homebridge 2.3.0+ with Matter enabled on this plugin\'s child bridge.');
139
+ return false;
140
+ }
141
+ if (!matter.deviceTypes?.ElectricalSensor) {
142
+ this.log.debug('[matter] api.matter.deviceTypes.ElectricalSensor unavailable — Matter energy export disabled. Requires a newer Homebridge build.');
143
+ return false;
144
+ }
145
+ if (typeof matter.registerPlatformAccessories !== 'function' || typeof matter.updateAccessoryState !== 'function') {
146
+ this.log.debug('[matter] Matter registration/update API unavailable — Matter energy export disabled.');
147
+ return false;
148
+ }
149
+ return true;
150
+ }
151
+ buildClusters(r) {
152
+ const energyField = {};
153
+ if (this.direction === 'imported' || this.direction === 'bidirectional') {
154
+ energyField.cumulativeEnergyImported = { energy: kWhToMilliWh(r.importedEnergyKWh ?? 0) };
155
+ energyField.periodicEnergyImported = this.computePeriodic('imported', r.importedEnergyKWh ?? 0);
156
+ }
157
+ if (this.direction === 'exported' || this.direction === 'bidirectional') {
158
+ energyField.cumulativeEnergyExported = { energy: kWhToMilliWh(r.exportedEnergyKWh ?? 0) };
159
+ energyField.periodicEnergyExported = this.computePeriodic('exported', r.exportedEnergyKWh ?? 0);
160
+ }
161
+ return {
162
+ electricalPowerMeasurement: { activePower: wToMilliW(r.powerW) },
163
+ electricalEnergyMeasurement: energyField,
164
+ };
165
+ }
166
+ /**
167
+ * Compute (or, between periodic reports, just return the last computed)
168
+ * periodic-energy fragment for one energy kind. The very first call —
169
+ * always from register(), before any real reading exists — seeds a
170
+ * zero-energy fragment with no timestamps, purely so the PeriodicEnergy
171
+ * feature composes at registration. Every call after that reports a real
172
+ * delta against the last periodic baseline once MIN_PERIODIC_INTERVAL_S
173
+ * has elapsed.
174
+ */
175
+ computePeriodic(kind, energyKWh) {
176
+ const state = this.periodicState[kind];
177
+ const nowS = Math.floor(Date.now() / 1000);
178
+ if (state.baselineKWh === null || state.timestampS === null) {
179
+ state.baselineKWh = energyKWh;
180
+ state.timestampS = nowS;
181
+ return state.last;
182
+ }
183
+ if (nowS - state.timestampS >= MatterEnergyBridge.MIN_PERIODIC_INTERVAL_S) {
184
+ const deltaKWh = Math.max(0, energyKWh - state.baselineKWh);
185
+ state.last = {
186
+ energy: kWhToMilliWh(deltaKWh),
187
+ startTimestamp: state.timestampS,
188
+ endTimestamp: nowS,
189
+ };
190
+ state.baselineKWh = energyKWh;
191
+ state.timestampS = nowS;
192
+ }
193
+ return state.last;
194
+ }
195
+ /**
196
+ * Register this meter as a Matter electrical sensor.
197
+ *
198
+ * @param seedKey - unique per-meter key used to derive this accessory's
199
+ * Matter UUID, distinct from the HAP accessory's UUID
200
+ * @param displayName
201
+ * @param serialNumber
202
+ * @param readings - initial readings to seed the clusters with
203
+ */
204
+ async register(seedKey, displayName, serialNumber, readings) {
205
+ if (!this.isSupported())
206
+ return false;
207
+ const matter = this.api.matter;
208
+ this.uuid = matter.uuid.generate(`${PLUGIN_NAME}:matter:${seedKey}`);
209
+ const accessory = {
210
+ UUID: this.uuid,
211
+ displayName,
212
+ deviceType: matter.deviceTypes.ElectricalSensor,
213
+ serialNumber,
214
+ manufacturer: 'SunStrong',
215
+ model: 'PVS6',
216
+ clusters: this.buildClusters(readings),
217
+ };
218
+ try {
219
+ await matter.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
220
+ this.registered = true;
221
+ this.log.info(`[matter] Published "${displayName}" as a Matter electrical sensor — live power should feed the Apple Home Energy view.`);
222
+ return true;
223
+ }
224
+ catch (err) {
225
+ this.log.warn(`[matter] Failed to register Matter accessory for "${displayName}" (${err instanceof Error ? err.message : err}). Continuing with HomeKit/Eve only.`);
226
+ this.registered = false;
227
+ return false;
228
+ }
229
+ }
230
+ /**
231
+ * Push fresh readings to the registered Matter accessory. No-op until
232
+ * registration has succeeded.
233
+ */
234
+ async update(readings) {
235
+ if (!this.registered || !this.uuid)
236
+ return;
237
+ const matter = this.api.matter;
238
+ if (!matter)
239
+ return;
240
+ const clusters = this.buildClusters(readings);
241
+ try {
242
+ await Promise.all([
243
+ matter.updateAccessoryState(this.uuid, 'electricalPowerMeasurement', clusters.electricalPowerMeasurement),
244
+ matter.updateAccessoryState(this.uuid, 'electricalEnergyMeasurement', clusters.electricalEnergyMeasurement),
245
+ ]);
246
+ }
247
+ catch (err) {
248
+ // Log the first failure at warn, the rest at debug, so a persistently
249
+ // unhappy Matter server can't flood the log on every poll.
250
+ const message = `[matter] Failed to update Matter state: ${err instanceof Error ? err.message : err}`;
251
+ if (!this.warnedUpdate) {
252
+ this.warnedUpdate = true;
253
+ this.log.warn(message);
254
+ }
255
+ else {
256
+ this.log.debug(message);
257
+ }
258
+ }
259
+ }
260
+ }
261
+ exports.MatterEnergyBridge = MatterEnergyBridge;
262
+ MatterEnergyBridge.MIN_PERIODIC_INTERVAL_S = 60;
263
+ //# sourceMappingURL=matterEnergy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matterEnergy.js","sourceRoot":"","sources":["../src/matterEnergy.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkGG;;;AAIH,MAAM,WAAW,GAAG,iBAAiB,CAAC;AACtC,M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M;YAAE,OAAO;QAEpB,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAE9C,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,GAAG,CAAC;gBAChB,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,4BAA4B,EAAE,QAAQ,CAAC,0BAA0B,CAAC;gBACzG,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,6BAA6B,EAAE,QAAQ,CAAC,2BAA2B,CAAC;aAC5G,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,sEAAsE;YACtE,2DAA2D;YAC3D,MAAM,OAAO,GAAG,2CAA2C,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;YACtG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;gBACvB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;gBACzB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACzB,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;IACH,CAAC;;AA/JH,gDAgKC;AA/JyB,0CAAuB,GAAG,EAAE,AAAL,CAAM"}
@@ -14,6 +14,7 @@ export declare class PVS6Platform implements DynamicPlatformPlugin {
14
14
  private gridImportAccessory?;
15
15
  private gridExportAccessory?;
16
16
  private homeConsumptionAccessory?;
17
+ private gridMatterBridge;
17
18
  private pollTimer?;
18
19
  private pollInFlight;
19
20
  private backedOff;
@@ -1 +1 @@
1
- {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,cAAc,EACd,qBAAqB,EACrB,MAAM,EACN,iBAAiB,EACjB,cAAc,E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AM,EAAE,cAAc,EACtB,GAAG,EAAE,GAAG;IA2CV,kBAAkB,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI;YAexC,aAAa;YA0Bb,iBAAiB;IAW/B,OAAO,CAAC,gBAAgB;IAsExB,OAAO,CAAC,oBAAoB;IAiB5B,OAAO,KAAK,gBAAgB,GAE3B;IAID,OAAO,CAAC,gBAAgB;YAQV,kBAAkB;IA0BhC,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,mBAAmB;IAsB3B,OAAO,CAAC,YAAY;IAiEpB,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,YAAY;CASrB"}
package/dist/platform.js CHANGED
@@ -8,6 +8,7 @@ const gridImportAccessory_1 = require("./gridImportAccessory");
8
8
  const gridExportAccessory_1 = require("./gridExportAccessory");
9
9
  const homeConsumptionAccessory_1 = require("./homeConsumptionAccessory");
10
10
  const eveCharacteristics_1 = require("./eveCharacteristics");
11
+ const matterEnergy_1 = require("./matterEnergy");
11
12
  const pvs6Discovery_1 = require("./pvs6Discovery");
12
13
  const pvs6DiscoveryCache_1 = require("./pvs6DiscoveryCache");
13
14
  const MIN_POLL_INTERVAL = 5;
@@ -19,6 +20,12 @@ const NETWORK_ERROR_LOG_INTERVAL_MS = 5 * 60 * 1000; // suppress repeat network
19
20
  class PVS6Platform {
20
21
  constructor(log, config, api) {
21
22
  this.accessories = [];
23
+ // Optional: publishes the grid meter over Matter as a single bidirectional
24
+ // accessory (signed activePower, both imported/exported energy on one
25
+ // cluster) — see matterEnergy.ts. Grid Import/Export stay separate
26
+ // accessories in Eve/HomeKit only, since that split is purely for Eve's
27
+ // characteristic limitation, not a Matter one.
28
+ this.gridMatterBridge = null;
22
29
  this.pollInFlight = false;
23
30
  this.backedOff = false;
24
31
  this.consecutiveNetworkErrors = 0;
@@ -112,10 +119,11 @@ class PVS6Platform {
112
119
  setupAccessories(
113
120
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
114
121
  FakeGatoHistoryService, serialNumber) {
122
+ const matterEnabled = this.config.matter === true;
115
123
  // Solar Production is always registered.
116
124
  const solarName = this.config.solarName ?? 'Solar Production';
117
125
  const solarUuid = this.api.hap.uuid.generate(`${serialNumber}-solar`);
118
- this.solarAccessory = new solarAccessory_1.SolarAccessory(this, this.getOrCreateAccessory(solarUuid, solarName), FakeGatoHistoryService, solarName, serialNumber);
126
+ this.solarAccessory = new solarAccessory_1.SolarAccessory(this, this.getOrCreateAccessory(solarUuid, solarName), FakeGatoHistoryService, solarName, serialNumber, matterEnabled);
119
127
  // Grid Import + Grid Export are registered together as an optional pair (default: enabled).
120
128
  if (this.config.accessories?.grid !== false) {
121
129
  const importName = this.config.gridName ?? 'Grid Meter - Import';
@@ -124,6 +132,20 @@ class PVS6Platform {
124
132
  const exportName = this.config.gridExportName ?? 'Grid Meter - Export';
125
133
  const exportUuid = this.api.hap.uuid.generate(`${serialNumber}-grid-export`);
126
134
  this.gridExportAccessory = new gridExportAccessory_1.GridExportAccessory(this, this.getOrCreateAccessory(exportUuid, exportName), FakeGatoHistoryService, exportName, serialNumber);
135
+ if (matterEnabled) {
136
+ const bridge = new matterEnergy_1.MatterEnergyBridge(this.api, this.log, 'bidirectional');
137
+ if (bridge.isSupported()) {
138
+ this.gridMatterBridge = bridge;
139
+ bridge.register(`${serialNumber}-grid-net`, 'Grid', `${serialNumber}-grid`, {
140
+ powerW: 0,
141
+ importedEnergyKWh: 0,
142
+ exportedEnergyKWh: 0,
143
+ }).catch(() => { });
144
+ }
145
+ else {
146
+ this.log.info('[matter] Config option "matter" is enabled, but the Matter API is unavailable. It needs a Homebridge build with the ElectricalSensor device type, with Matter enabled on this plugin\'s child bridge. Continuing with HomeKit/Eve only.');
147
+ }
148
+ }
127
149
  }
128
150
  // Home Consumption is optional (default: disabled).
129
151
  if (this.config.accessories?.homeConsumption === true) {
@@ -240,6 +262,11 @@ class PVS6Platform {
240
262
  this.gridImportAccessory?.updateValues(reading);
241
263
  this.gridExportAccessory?.updateValues(reading);
242
264
  this.homeConsumptionAccessory?.updateValues(reading);
265
+ this.gridMatterBridge?.update({
266
+ powerW: reading.netPowerW,
267
+ importedEnergyKWh: reading.gridImportKWh,
268
+ exportedEnergyKWh: reading.gridExportKWh,
269
+ }).catch(() => { });
243
270
  }
244
271
  catch (err) {
245
272
  if (err instanceof pvs6Client_1.HttpError) {
@@ -1 +1 @@
1
- {"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":";;;AAUA,yCAAoE;AACpE,6CAAqD;AACrD,qDAAkD;AAClD,+DAA4D;AAC5D,+DAA4D;AAC5D,yEAAsE;AACtE,6DAA0E;AAC1E,mDAAoE;AACpE,6DAA8E;AAE9E,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,aAAa,GAAG,KAAM,CAAC;AAC7B,MAAM,eAAe,GAAG,KAAM,CAAC;AAC/B,MAAM,mBAAmB,GAAG,KAAM,CAAC;AACnC,MAAM,wBAAwB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,UAAU;AAC/D,MAAM,6BAA6B,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,kDAAkD;AAEvG,MAAa,YAAY;IAgCvB,YACE,GAAW,EACX,MAAsB,EACtB,GAAQ;QA5BM,gBAAW,GAAwB,EAAE,CAAC;QAa9C,iBAAY,GAAG,KAAK,CAAC;QACrB,cAAS,GAAG,KAAK,CAAC;QAClB,6BAAwB,GAAG,CAAC,CAAC;QAC7B,4BAAuB,GAAG,CAAC,CAAC;QAEpC,kFAAkF;QAC1E,mBAAc,GAAG,CAAC,CAAC;QAE3B,mFAAmF;QAC3E,2BAAsB,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACpC,kBAAa,GAAG,KAAK,CAAC;QAO5B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,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AAS,EAAE,CAAC;gBACnB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;YACzD,CAAC;YACD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACzB,CAAC,EAAE,UAAU,CAAC,CAAC;IACjB,CAAC;CACF;AA7XD,oCA6XC"}
@@ -6,6 +6,7 @@ export interface PVS6Config extends PlatformConfig {
6
6
  host?: string;
7
7
  serialNumber?: string;
8
8
  pollInterval?: number;
9
+ matter?: boolean;
9
10
  accessories?: {
10
11
  grid?: boolean;
11
12
  homeConsumption?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,aAAa,SAAS,CAAC;AACpC,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAE7C,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE;QACZ,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B"}
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,aAAa,SAAS,CAAC;AACpC,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAE7C,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE;QACZ,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B"}
@@ -7,7 +7,8 @@ export declare class SolarAccessory {
7
7
  private readonly historyService;
8
8
  private lastPowerW;
9
9
  private lastEnergyKWh;
10
- constructor(platform: PVS6Platform, accessory: PlatformAccessory, FakeGatoHistoryService: any, displayName: string, serialNumber: string);
10
+ private matter;
11
+ constructor(platform: PVS6Platform, accessory: PlatformAccessory, FakeGatoHistoryService: any, displayName: string, serialNumber: string, matterEnabled?: boolean);
11
12
  updateValues(reading: PVS6Reading): void;
12
13
  }
13
14
  //# sourceMappingURL=solarAccessory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"solarAccessory.d.ts","sourceRoot":"","sources":["../src/solarAccessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAW,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,qBAAa,cAAc;IASvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAR3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAElC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAM;IAErC,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,aAAa,CAAK;gBAGP,QAAQ,EAAE,YAAY,EACvC,SAAS,EAAE,iBAAiB,EAE5B,sBAAsB,EAAE,GAAG,EAC3B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM;IA+CtB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;CAmBzC"}
1
+ {"version":3,"file":"solarAccessory.d.ts","sourceRoot":"","sources":["../src/solarAccessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAW,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,qBAAa,cAAc;IAcvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAb3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAElC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAM;IAErC,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,aAAa,CAAK;IAK1B,OAAO,CAAC,MAAM,CAAmC;gBAG9B,QAAQ,EAAE,YAAY,EACvC,SAAS,EAAE,iBAAiB,EAE5B,sBAAsB,EAAE,GAAG,EAC3B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,aAAa,UAAQ;IAgEvB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;CAqBzC"}
@@ -2,13 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SolarAccessory = void 0;
4
4
  const eveCharacteristics_1 = require("./eveCharacteristics");
5
+ const matterEnergy_1 = require("./matterEnergy");
5
6
  class SolarAccessory {
6
7
  constructor(platform, accessory,
7
8
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
- FakeGatoHistoryService, displayName, serialNumber) {
9
+ FakeGatoHistoryService, displayName, serialNumber, matterEnabled = false) {
9
10
  this.platform = platform;
10
11
  this.lastPowerW = 0;
11
12
  this.lastEnergyKWh = 0;
13
+ // Optional: publishes this meter over Matter for the Apple Home Energy
14
+ // view. Null when the "matter" config option is off; also cleared when the
15
+ // Homebridge build doesn't support it. See matterEnergy.ts.
16
+ this.matter = null;
12
17
  const { Characteristic } = platform;
13
18
  const { EveWatts, EveKWh } = platform.eveChars;
14
19
  const infoService = accessory.getService(platform.Service.AccessoryInformation) ??
@@ -42,6 +47,23 @@ class SolarAccessory {
42
47
  .onGet(() => this.lastEnergyKWh);
43
48
  // fakegato history — 'energy' type records { time, power } in Watts
44
49
  this.historyService = new FakeGatoHistoryService('energy', accessory, { storage: 'fs' });
50
+ if (matterEnabled) {
51
+ // Solar production flows out of the meter — reported as exported energy.
52
+ // Matter's activePower sign convention is positive = drawing power,
53
+ // negative = supplying it, so a generation-only meter like this one
54
+ // must negate its (always non-negative) wattage for Matter.
55
+ const bridge = new matterEnergy_1.MatterEnergyBridge(platform.api, platform.log, 'exported');
56
+ if (bridge.isSupported()) {
57
+ this.matter = bridge;
58
+ bridge.register(`${serialNumber}-solar`, displayName, `${serialNumber}-solar`, {
59
+ powerW: -this.lastPowerW,
60
+ exportedEnergyKWh: this.lastEnergyKWh,
61
+ }).catch(() => { });
62
+ }
63
+ else {
64
+ platform.log.info('[matter] Config option "matter" is enabled, but the Matter API is unavailable. It needs a Homebridge build with the ElectricalSensor device type, with Matter enabled on this plugin\'s child bridge. Continuing with HomeKit/Eve only.');
65
+ }
66
+ }
45
67
  }
46
68
  updateValues(reading) {
47
69
  const { Characteristic } = this.platform;
@@ -56,6 +78,7 @@ class SolarAccessory {
56
78
  time: Math.round(Date.now() / 1000),
57
79
  power: this.lastPowerW,
58
80
  });
81
+ this.matter?.update({ powerW: -this.lastPowerW, exportedEnergyKWh: this.lastEnergyKWh }).catch(() => { });
59
82
  this.platform.log.debug(`Solar: ${this.lastPowerW}W ${this.lastEnergyKWh}kWh`);
60
83
  }
61
84
  }
@@ -1 +1 @@
1
- {"version":3,"file":"solarAccessory.js","sourceRoot":"","sources":["../src/sol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oB,CAAC,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;QAC1E,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,cAAc,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QACpE,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7D,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE9D,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC;YAC3B,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;YACnC,KAAK,EAAE,IAAI,CAAC,UAAU;SACvB,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,iBAAiB,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAEzG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,IAAI,CAAC,UAAU,MAAM,IAAI,CAAC,aAAa,KAAK,CAAC,CAAC;IAClF,CAAC;CACF;AAzGD,wCAyGC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-pvs6",
3
3
  "displayName": "PVS6 Solar",
4
- "version": "1.3.0",
4
+ "version": "1.4.0",
5
5
  "description": "Homebridge plugin for SunStrong PVS6 solar monitoring — Eve Energy accessories with fakegato history.",
6
6
  "author": {
7
7
  "name": "David Carson",