homebridge-sensus 1.1.0 → 1.1.1

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "pluginAlias": "SensusAnalytics",
3
3
  "pluginType": "platform",
4
- "singular": false,
4
+ "singular": true,
5
5
  "schema": {
6
6
  "type": "object",
7
7
  "properties": {
@@ -9,14 +9,17 @@ export declare class SensusWaterMeterAccessory {
9
9
  private readonly leakThreshold;
10
10
  private readonly pollIntervalMs;
11
11
  private readonly eveConsumptionChar;
12
- private readonly historyService;
12
+ private readonly eveTotalChar;
13
13
  private lastData;
14
- private lastLoggedTimestamps;
15
14
  constructor(platform: SensusAnalyticsPlatform, accessory: PlatformAccessory, apiClient: SensusAnalyticsApi);
15
+ /**
16
+ * Creates and registers a custom Characteristic on the LeakSensor service.
17
+ * If the characteristic already exists (restored from cache), it is returned as-is.
18
+ */
16
19
  private addEveCharacteristic;
20
+ /** Called by HomeKit to read the current leak state. */
17
21
  private handleLeakDetectedGet;
18
- /** Log hourly entries to fakegato, skipping already-logged timestamps. */
19
- private logHourlyHistory;
22
+ /** Fetch latest data from Sensus Analytics and push updates to HomeKit. */
20
23
  private poll;
21
24
  }
22
25
  //# sourceMappingURL=accessory.d.ts.map
package/dist/accessory.js CHANGED
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SensusWaterMeterAccessory = void 0;
4
- // Eve custom characteristic UUID for current consumption
5
- const EVE_UUID_WATER_CONSUMPTION = 'E863F10D-079E-48FF-8F27-9C2605A29F52';
4
+ // Eve for HomeKit custom characteristic UUIDs for water meters
5
+ const EVE_UUID_WATER_CONSUMPTION = 'E863F10D-079E-48FF-8F27-9C2605A29F52'; // daily usage
6
+ const EVE_UUID_TOTAL_WATER = 'E863F10C-079E-48FF-8F27-9C2605A29F52'; // odometer / total
6
7
  const DEFAULT_POLL_INTERVAL_MINUTES = 30;
7
8
  class SensusWaterMeterAccessory {
8
9
  constructor(platform, accessory, apiClient) {
@@ -10,7 +11,6 @@ class SensusWaterMeterAccessory {
10
11
  this.accessory = accessory;
11
12
  this.apiClient = apiClient;
12
13
  this.lastData = null;
13
- this.lastLoggedTimestamps = new Set();
14
14
  const { hap } = platform.api;
15
15
  const { Service: Svc, Characteristic: Char } = platform;
16
16
  this.leakThreshold = platform.config.leakThreshold ?? 150;
@@ -25,6 +25,7 @@ class SensusWaterMeterAccessory {
25
25
  .setCharacteristic(Char.Model, 'Smart Water Meter')
26
26
  .setCharacteristic(Char.SerialNumber, accessory.context.meterNumber ?? 'Unknown');
27
27
  // ── Leak Sensor (primary HomeKit service) ─────────────────────────────
28
+ // Visible in Apple Home app as a leak sensor tile with alert notifications
28
29
  this.leakService =
29
30
  this.accessory.getService(Svc.LeakSensor) ?? this.accessory.addService(Svc.LeakSensor);
30
31
  this.leakService.setCharacteristic(Char.Name, accessory.displayName);
@@ -34,25 +35,19 @@ class SensusWaterMeterAccessory {
34
35
  this.leakService
35
36
  .getCharacteristic(Char.StatusActive)
36
37
  .onGet(() => true);
37
- // ── Remove old Total Water characteristic if cached ───────────────────
38
- const oldTotalChar = this.leakService.characteristics.find((c) => c.UUID === 'E863F10C-079E-48FF-8F27-9C2605A29F52');
39
- if (oldTotalChar) {
40
- this.leakService.removeCharacteristic(oldTotalChar);
41
- }
42
- // ── Eve Consumption Characteristic ────────────────────────────────────
43
- this.eveConsumptionChar = this.addEveCharacteristic('Water Consumption', EVE_UUID_WATER_CONSUMPTION, "float" /* hap.Formats.FLOAT */, ["ev" /* hap.Perms.NOTIFY */, "pr" /* hap.Perms.PAIRED_READ */], 0, 1000000, 0.001);
44
- // ── Fakegato History Service ──────────────────────────────────────────
45
- // eslint-disable-next-line @typescript-eslint/no-require-imports
46
- const FakeGatoHistoryService = require('fakegato-history')(platform.api);
47
- this.historyService = new FakeGatoHistoryService('energy', this.accessory, {
48
- log: platform.log,
49
- storage: 'fs',
50
- size: 4032,
51
- });
38
+ // ── Eve Custom Characteristics ────────────────────────────────────────
39
+ // These are shown in the Eve for HomeKit app as consumption graphs.
40
+ // They are attached to the LeakSensor service so they share one accessory tile.
41
+ this.eveConsumptionChar = this.addEveCharacteristic('Water Consumption', EVE_UUID_WATER_CONSUMPTION, hap.Formats.FLOAT, [hap.Perms.NOTIFY, hap.Perms.PAIRED_READ], 0, 1000000, 0.001);
42
+ this.eveTotalChar = this.addEveCharacteristic('Total Water Consumption', EVE_UUID_TOTAL_WATER, hap.Formats.FLOAT, [hap.Perms.NOTIFY, hap.Perms.PAIRED_READ], 0, 1000000000, 0.001);
52
43
  // ── Start polling ─────────────────────────────────────────────────────
53
44
  this.poll();
54
45
  setInterval(() => this.poll(), this.pollIntervalMs);
55
46
  }
47
+ /**
48
+ * Creates and registers a custom Characteristic on the LeakSensor service.
49
+ * If the characteristic already exists (restored from cache), it is returned as-is.
50
+ */
56
51
  addEveCharacteristic(displayName, uuid, format, perms, minValue, maxValue, minStep) {
57
52
  const { hap } = this.platform.api;
58
53
  const existing = this.leakService.characteristics.find((c) => c.UUID === uuid);
@@ -66,6 +61,7 @@ class SensusWaterMeterAccessory {
66
61
  this.leakService.addCharacteristic(char);
67
62
  return char;
68
63
  }
64
+ /** Called by HomeKit to read the current leak state. */
69
65
  handleLeakDetectedGet() {
70
66
  const { LEAK_DETECTED, LEAK_NOT_DETECTED } = this.platform.Characteristic.LeakDetected;
71
67
  if (!this.lastData) {
@@ -75,27 +71,7 @@ class SensusWaterMeterAccessory {
75
71
  ? LEAK_DETECTED
76
72
  : LEAK_NOT_DETECTED;
77
73
  }
78
- /** Log hourly entries to fakegato, skipping already-logged timestamps. */
79
- logHourlyHistory(hourly) {
80
- for (const entry of hourly) {
81
- if (this.lastLoggedTimestamps.has(entry.timestamp)) {
82
- continue;
83
- }
84
- this.historyService.addEntry({
85
- time: Math.floor(entry.timestamp / 1000),
86
- power: entry.usage,
87
- });
88
- this.lastLoggedTimestamps.add(entry.timestamp);
89
- }
90
- // Keep only the last 48 hours of timestamps to avoid unbounded growth
91
- if (this.lastLoggedTimestamps.size > 48) {
92
- const sorted = [...this.lastLoggedTimestamps].sort((a, b) => a - b);
93
- const toRemove = sorted.slice(0, sorted.length - 48);
94
- for (const ts of toRemove) {
95
- this.lastLoggedTimestamps.delete(ts);
96
- }
97
- }
98
- }
74
+ /** Fetch latest data from Sensus Analytics and push updates to HomeKit. */
99
75
  async poll() {
100
76
  this.platform.log.debug('Sensus Analytics: polling for new data...');
101
77
  const data = await this.apiClient.fetchData();
@@ -109,17 +85,14 @@ class SensusWaterMeterAccessory {
109
85
  const isLeaking = daily.dailyUsage > this.leakThreshold;
110
86
  // Push updates to HomeKit
111
87
  this.leakService.updateCharacteristic(this.platform.Characteristic.LeakDetected, isLeaking ? LEAK_DETECTED : LEAK_NOT_DETECTED);
112
- // Update current consumption value
88
+ // Eve consumption characteristics
113
89
  this.eveConsumptionChar.updateValue(daily.dailyUsage);
114
- // Log hourly data to fakegato history for Eve graphs
115
- if (hourly.length > 0) {
116
- this.logHourlyHistory(hourly);
117
- this.platform.log.debug(`Logged ${hourly.length} hourly entries to history`);
118
- }
90
+ this.eveTotalChar.updateValue(daily.odometer);
119
91
  // Log a summary
120
92
  const lastHour = hourly.at(-1);
121
93
  this.platform.log.info(`[${this.accessory.displayName}] ` +
122
94
  `daily=${daily.dailyUsage} ${daily.usageUnit} | ` +
95
+ `odometer=${daily.odometer} ${daily.usageUnit} | ` +
123
96
  `billing=${daily.billingUsage} ${daily.usageUnit} | ` +
124
97
  `leak=${isLeaking}` +
125
98
  (lastHour ? ` | lastHourUsage=${lastHour.usage} | temp=${lastHour.temp}°F` : ''));
package/dist/index.js CHANGED
@@ -2,6 +2,6 @@
2
2
  const platform_1 = require("./platform");
3
3
  const settings_1 = require("./settings");
4
4
  module.exports = (api) => {
5
- api.registerPlatform(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, platform_1.SensusAnalyticsPlatform);
5
+ api.registerPlatform(settings_1.PLATFORM_NAME, platform_1.SensusAnalyticsPlatform);
6
6
  };
7
7
  //# sourceMappingURL=index.js.map
package/dist/sensusApi.js CHANGED
@@ -4,8 +4,6 @@ exports.SensusAnalyticsApi = void 0;
4
4
  const axios_1 = require("axios");
5
5
  const axios_cookiejar_support_1 = require("axios-cookiejar-support");
6
6
  const tough_cookie_1 = require("tough-cookie");
7
- // 1 CCF (hundred cubic feet) = 748.052 gallons
8
- const CCF_TO_GALLONS = 748.052;
9
7
  class SensusAnalyticsApi {
10
8
  constructor(baseUrl, username, password, accountNumber, meterNumber, log) {
11
9
  this.baseUrl = baseUrl;
@@ -91,18 +89,16 @@ class SensusAnalyticsApi {
91
89
  this.log.warn('Sensus Analytics: unexpected daily data structure');
92
90
  return null;
93
91
  }
94
- const rawUnit = (device.usageUnit || 'CCF').toUpperCase();
95
- const toGallons = rawUnit === 'CCF' ? CCF_TO_GALLONS : 1;
96
92
  return {
97
- dailyUsage: Math.round(((parseFloat(device.dailyUsage) || 0) * toGallons) * 100) / 100,
98
- usageUnit: 'GAL',
93
+ dailyUsage: parseFloat(device.dailyUsage) || 0,
94
+ usageUnit: device.usageUnit || 'CCF',
99
95
  meterAddress: device.meterAddress1 || '',
100
96
  lastRead: device.lastRead || '',
101
97
  meterId: String(device.meterId || ''),
102
98
  meterLat: parseFloat(device.meterLat) || 0,
103
99
  meterLong: parseFloat(device.meterLong) || 0,
104
- odometer: Math.round(((parseFloat(device.latestReadUsage) || 0) * toGallons) * 100) / 100,
105
- billingUsage: Math.round(((parseFloat(device.billingUsage) || 0) * toGallons) * 100) / 100,
100
+ odometer: parseFloat(device.latestReadUsage) || 0,
101
+ billingUsage: parseFloat(device.billingUsage) || 0,
106
102
  };
107
103
  }
108
104
  async fetchHourlyData() {
@@ -131,15 +127,14 @@ class SensusAnalyticsApi {
131
127
  return [];
132
128
  }
133
129
  // First element is units row: [usageUnit, rainUnit, tempUnit, altUnit]
134
- const [rawUsageUnit, rainUnit, tempUnit] = usageArray[0];
130
+ const [usageUnit, rainUnit, tempUnit] = usageArray[0];
135
131
  const rows = usageArray.slice(1);
136
- const toGallons = (rawUsageUnit ?? 'CCF').toUpperCase() === 'CCF' ? CCF_TO_GALLONS : 1;
137
132
  return rows.map((row) => ({
138
133
  timestamp: row[0],
139
- usage: Math.round(((row[1] ?? 0) * toGallons) * 100) / 100,
134
+ usage: row[1] ?? 0,
140
135
  rain: row[2] ?? 0,
141
136
  temp: row[3] ?? 0,
142
- usageUnit: 'GAL',
137
+ usageUnit: usageUnit ?? 'CCF',
143
138
  rainUnit: rainUnit ?? 'INCHES',
144
139
  tempUnit: tempUnit ?? 'FAHRENHEIT',
145
140
  }));
package/package.json CHANGED
@@ -1,26 +1,14 @@
1
1
  {
2
2
  "name": "homebridge-sensus",
3
- "displayName": "Homebridge Sensus",
4
- "version": "1.1.0",
3
+ "version": "1.1.1",
5
4
  "description": "Homebridge plugin for Sensus Analytics water meters",
6
5
  "license": "MIT",
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/jmarrmd/homebridge-sensus.git"
10
- },
11
- "bugs": {
12
- "url": "https://github.com/jmarrmd/homebridge-sensus/issues"
13
- },
14
- "homepage": "https://github.com/jmarrmd/homebridge-sensus#readme",
15
6
  "main": "dist/index.js",
16
- "files": [
17
- "dist/",
18
- "config.schema.json"
19
- ],
20
7
  "scripts": {
21
- "build": "true",
22
- "compile": "tsc",
23
- "watch": "tsc --watch"
8
+ "build": "tsc",
9
+ "watch": "tsc --watch",
10
+ "prepare": "npm run build",
11
+ "prepublishOnly": "npm run build"
24
12
  },
25
13
  "keywords": [
26
14
  "homebridge-plugin",
@@ -31,21 +19,20 @@
31
19
  ],
32
20
  "engines": {
33
21
  "node": ">=18.0.0",
34
- "homebridge": ">=1.6.0"
22
+ "homebridge": ">=1.6.0 <3.0.0"
35
23
  },
36
24
  "dependencies": {
37
25
  "axios": "^1.6.0",
38
26
  "axios-cookiejar-support": "^4.0.7",
39
- "fakegato-history": "^0.6.7",
40
27
  "tough-cookie": "^4.1.3"
41
28
  },
42
29
  "devDependencies": {
43
30
  "@types/node": "^20.0.0",
44
31
  "@types/tough-cookie": "^4.0.5",
45
- "homebridge": "^1.8.0",
32
+ "homebridge": "^2.0.0",
46
33
  "typescript": "^5.3.0"
47
34
  },
48
35
  "peerDependencies": {
49
- "homebridge": ">=1.6.0"
36
+ "homebridge": ">=1.6.0 <3.0.0"
50
37
  }
51
38
  }
@@ -0,0 +1,164 @@
1
+ import { PlatformAccessory, CharacteristicValue, Service, Characteristic } from 'homebridge';
2
+ import { SensusAnalyticsPlatform } from './platform';
3
+ import { SensusAnalyticsApi, SensusData } from './sensusApi';
4
+
5
+ // Eve for HomeKit custom characteristic UUIDs for water meters
6
+ const EVE_UUID_WATER_CONSUMPTION = 'E863F10D-079E-48FF-8F27-9C2605A29F52'; // daily usage
7
+ const EVE_UUID_TOTAL_WATER = 'E863F10C-079E-48FF-8F27-9C2605A29F52'; // odometer / total
8
+
9
+ const DEFAULT_POLL_INTERVAL_MINUTES = 30;
10
+
11
+ export class SensusWaterMeterAccessory {
12
+ private readonly leakService: Service;
13
+ private readonly leakThreshold: number;
14
+ private readonly pollIntervalMs: number;
15
+
16
+ // Direct references to Eve custom characteristics to avoid UUID lookups on update
17
+ private readonly eveConsumptionChar: Characteristic;
18
+ private readonly eveTotalChar: Characteristic;
19
+
20
+ private lastData: SensusData | null = null;
21
+
22
+ constructor(
23
+ private readonly platform: SensusAnalyticsPlatform,
24
+ private readonly accessory: PlatformAccessory,
25
+ private readonly apiClient: SensusAnalyticsApi,
26
+ ) {
27
+ const { hap } = platform.api;
28
+ const { Service: Svc, Characteristic: Char } = platform;
29
+
30
+ this.leakThreshold = (platform.config.leakThreshold as number | undefined) ?? 150;
31
+ this.pollIntervalMs =
32
+ ((platform.config.pollInterval as number | undefined) ?? DEFAULT_POLL_INTERVAL_MINUTES) *
33
+ 60 *
34
+ 1000;
35
+
36
+ // ── Accessory Information ─────────────────────────────────────────────
37
+ this.accessory
38
+ .getService(Svc.AccessoryInformation)!
39
+ .setCharacteristic(Char.Manufacturer, 'Sensus')
40
+ .setCharacteristic(Char.Model, 'Smart Water Meter')
41
+ .setCharacteristic(
42
+ Char.SerialNumber,
43
+ (accessory.context.meterNumber as string | undefined) ?? 'Unknown',
44
+ );
45
+
46
+ // ── Leak Sensor (primary HomeKit service) ─────────────────────────────
47
+ // Visible in Apple Home app as a leak sensor tile with alert notifications
48
+ this.leakService =
49
+ this.accessory.getService(Svc.LeakSensor) ?? this.accessory.addService(Svc.LeakSensor);
50
+
51
+ this.leakService.setCharacteristic(Char.Name, accessory.displayName);
52
+
53
+ this.leakService
54
+ .getCharacteristic(Char.LeakDetected)
55
+ .onGet(this.handleLeakDetectedGet.bind(this));
56
+
57
+ this.leakService
58
+ .getCharacteristic(Char.StatusActive)
59
+ .onGet(() => true);
60
+
61
+ // ── Eve Custom Characteristics ────────────────────────────────────────
62
+ // These are shown in the Eve for HomeKit app as consumption graphs.
63
+ // They are attached to the LeakSensor service so they share one accessory tile.
64
+
65
+ this.eveConsumptionChar = this.addEveCharacteristic(
66
+ 'Water Consumption',
67
+ EVE_UUID_WATER_CONSUMPTION,
68
+ hap.Formats.FLOAT,
69
+ [hap.Perms.NOTIFY, hap.Perms.PAIRED_READ],
70
+ 0, 1_000_000, 0.001,
71
+ );
72
+
73
+ this.eveTotalChar = this.addEveCharacteristic(
74
+ 'Total Water Consumption',
75
+ EVE_UUID_TOTAL_WATER,
76
+ hap.Formats.FLOAT,
77
+ [hap.Perms.NOTIFY, hap.Perms.PAIRED_READ],
78
+ 0, 1_000_000_000, 0.001,
79
+ );
80
+
81
+ // ── Start polling ─────────────────────────────────────────────────────
82
+ this.poll();
83
+ setInterval(() => this.poll(), this.pollIntervalMs);
84
+ }
85
+
86
+ /**
87
+ * Creates and registers a custom Characteristic on the LeakSensor service.
88
+ * If the characteristic already exists (restored from cache), it is returned as-is.
89
+ */
90
+ private addEveCharacteristic(
91
+ displayName: string,
92
+ uuid: string,
93
+ format: string,
94
+ perms: string[],
95
+ minValue: number,
96
+ maxValue: number,
97
+ minStep: number,
98
+ ): Characteristic {
99
+ const { hap } = this.platform.api;
100
+
101
+ const existing = this.leakService.characteristics.find((c) => c.UUID === uuid);
102
+ if (existing) {
103
+ return existing;
104
+ }
105
+
106
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
107
+ const props: any = { format, unit: 'gal', minValue, maxValue, minStep, perms };
108
+ const char = new hap.Characteristic(displayName, uuid, props);
109
+ char.setValue(0);
110
+ this.leakService.addCharacteristic(char);
111
+ return char;
112
+ }
113
+
114
+ /** Called by HomeKit to read the current leak state. */
115
+ private handleLeakDetectedGet(): CharacteristicValue {
116
+ const { LEAK_DETECTED, LEAK_NOT_DETECTED } = this.platform.Characteristic.LeakDetected;
117
+
118
+ if (!this.lastData) {
119
+ return LEAK_NOT_DETECTED;
120
+ }
121
+
122
+ return this.lastData.daily.dailyUsage > this.leakThreshold
123
+ ? LEAK_DETECTED
124
+ : LEAK_NOT_DETECTED;
125
+ }
126
+
127
+ /** Fetch latest data from Sensus Analytics and push updates to HomeKit. */
128
+ private async poll(): Promise<void> {
129
+ this.platform.log.debug('Sensus Analytics: polling for new data...');
130
+
131
+ const data = await this.apiClient.fetchData();
132
+ if (!data) {
133
+ this.platform.log.warn('Sensus Analytics: no data returned, will retry next interval');
134
+ return;
135
+ }
136
+
137
+ this.lastData = data;
138
+ const { daily, hourly } = data;
139
+ const { LEAK_DETECTED, LEAK_NOT_DETECTED } = this.platform.Characteristic.LeakDetected;
140
+
141
+ const isLeaking = daily.dailyUsage > this.leakThreshold;
142
+
143
+ // Push updates to HomeKit
144
+ this.leakService.updateCharacteristic(
145
+ this.platform.Characteristic.LeakDetected,
146
+ isLeaking ? LEAK_DETECTED : LEAK_NOT_DETECTED,
147
+ );
148
+
149
+ // Eve consumption characteristics
150
+ this.eveConsumptionChar.updateValue(daily.dailyUsage);
151
+ this.eveTotalChar.updateValue(daily.odometer);
152
+
153
+ // Log a summary
154
+ const lastHour = hourly.at(-1);
155
+ this.platform.log.info(
156
+ `[${this.accessory.displayName}] ` +
157
+ `daily=${daily.dailyUsage} ${daily.usageUnit} | ` +
158
+ `odometer=${daily.odometer} ${daily.usageUnit} | ` +
159
+ `billing=${daily.billingUsage} ${daily.usageUnit} | ` +
160
+ `leak=${isLeaking}` +
161
+ (lastHour ? ` | lastHourUsage=${lastHour.usage} | temp=${lastHour.temp}°F` : ''),
162
+ );
163
+ }
164
+ }
package/src/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { API } from 'homebridge';
2
+ import { SensusAnalyticsPlatform } from './platform';
3
+ import { PLATFORM_NAME } from './settings';
4
+
5
+ export = (api: API): void => {
6
+ api.registerPlatform(PLATFORM_NAME, SensusAnalyticsPlatform);
7
+ };
@@ -0,0 +1,79 @@
1
+ import {
2
+ API,
3
+ Characteristic,
4
+ DynamicPlatformPlugin,
5
+ Logger,
6
+ PlatformAccessory,
7
+ PlatformConfig,
8
+ Service,
9
+ } from 'homebridge';
10
+
11
+ import { PLATFORM_NAME, PLUGIN_NAME } from './settings';
12
+ import { SensusWaterMeterAccessory } from './accessory';
13
+ import { SensusAnalyticsApi } from './sensusApi';
14
+
15
+ export class SensusAnalyticsPlatform implements DynamicPlatformPlugin {
16
+ public readonly Service: typeof Service;
17
+ public readonly Characteristic: typeof Characteristic;
18
+
19
+ // Restored cached accessories from disk
20
+ public readonly cachedAccessories: PlatformAccessory[] = [];
21
+
22
+ constructor(
23
+ public readonly log: Logger,
24
+ public readonly config: PlatformConfig,
25
+ public readonly api: API,
26
+ ) {
27
+ this.Service = this.api.hap.Service;
28
+ this.Characteristic = this.api.hap.Characteristic;
29
+
30
+ this.log.debug('Sensus Analytics platform initialising');
31
+
32
+ this.api.on('didFinishLaunching', () => {
33
+ this.discoverDevices();
34
+ });
35
+ }
36
+
37
+ /** Called by Homebridge to restore cached accessories on startup. */
38
+ configureAccessory(accessory: PlatformAccessory): void {
39
+ this.log.info('Restoring cached accessory:', accessory.displayName);
40
+ this.cachedAccessories.push(accessory);
41
+ }
42
+
43
+ private discoverDevices(): void {
44
+ const { baseUrl, username, password, accountNumber, meterNumber } = this.config;
45
+
46
+ if (!baseUrl || !username || !password || !accountNumber || !meterNumber) {
47
+ this.log.error(
48
+ 'Sensus Analytics: missing required config fields ' +
49
+ '(baseUrl, username, password, accountNumber, meterNumber)',
50
+ );
51
+ return;
52
+ }
53
+
54
+ const apiClient = new SensusAnalyticsApi(
55
+ baseUrl,
56
+ username,
57
+ password,
58
+ accountNumber,
59
+ meterNumber,
60
+ this.log,
61
+ );
62
+
63
+ const displayName = (this.config.name as string | undefined) || 'Sensus Water Meter';
64
+ const uuid = this.api.hap.uuid.generate(`sensus-${meterNumber}`);
65
+
66
+ const existing = this.cachedAccessories.find((a) => a.UUID === uuid);
67
+
68
+ if (existing) {
69
+ this.log.info('Restoring water meter accessory:', existing.displayName);
70
+ new SensusWaterMeterAccessory(this, existing, apiClient);
71
+ } else {
72
+ this.log.info('Adding new water meter accessory:', displayName);
73
+ const accessory = new this.api.platformAccessory(displayName, uuid);
74
+ accessory.context.meterNumber = meterNumber;
75
+ new SensusWaterMeterAccessory(this, accessory, apiClient);
76
+ this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
77
+ }
78
+ }
79
+ }
@@ -0,0 +1,197 @@
1
+ import axios, { AxiosInstance } from 'axios';
2
+ import { wrapper } from 'axios-cookiejar-support';
3
+ import { CookieJar } from 'tough-cookie';
4
+ import { Logger } from 'homebridge';
5
+
6
+ export interface DailyData {
7
+ dailyUsage: number;
8
+ usageUnit: string;
9
+ meterAddress: string;
10
+ lastRead: string;
11
+ meterId: string;
12
+ meterLat: number;
13
+ meterLong: number;
14
+ odometer: number;
15
+ billingUsage: number;
16
+ }
17
+
18
+ export interface HourlyEntry {
19
+ timestamp: number;
20
+ usage: number;
21
+ rain: number;
22
+ temp: number;
23
+ usageUnit: string;
24
+ rainUnit: string;
25
+ tempUnit: string;
26
+ }
27
+
28
+ export interface SensusData {
29
+ daily: DailyData;
30
+ hourly: HourlyEntry[];
31
+ }
32
+
33
+ export class SensusAnalyticsApi {
34
+ private readonly client: AxiosInstance;
35
+ private readonly jar: CookieJar;
36
+ private loggedIn = false;
37
+
38
+ constructor(
39
+ private readonly baseUrl: string,
40
+ private readonly username: string,
41
+ private readonly password: string,
42
+ private readonly accountNumber: string,
43
+ private readonly meterNumber: string,
44
+ private readonly log: Logger,
45
+ ) {
46
+ this.jar = new CookieJar();
47
+ this.client = wrapper(
48
+ axios.create({
49
+ baseURL: baseUrl.replace(/\/$/, ''),
50
+ jar: this.jar,
51
+ withCredentials: true,
52
+ // Follow redirects but treat 302 as success for login
53
+ maxRedirects: 5,
54
+ timeout: 15000,
55
+ }),
56
+ );
57
+ }
58
+
59
+ async login(): Promise<boolean> {
60
+ try {
61
+ this.log.debug('Sensus Analytics: attempting login...');
62
+ await this.client.post(
63
+ '/j_spring_security_check',
64
+ new URLSearchParams({
65
+ j_username: this.username,
66
+ j_password: this.password,
67
+ }).toString(),
68
+ {
69
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
70
+ // A 302 redirect means login was processed; axios follows it automatically
71
+ validateStatus: (s) => s < 400,
72
+ },
73
+ );
74
+ this.loggedIn = true;
75
+ this.log.debug('Sensus Analytics: login successful');
76
+ return true;
77
+ } catch (err) {
78
+ this.loggedIn = false;
79
+ this.log.error('Sensus Analytics: login failed:', (err as Error).message);
80
+ return false;
81
+ }
82
+ }
83
+
84
+ async fetchData(): Promise<SensusData | null> {
85
+ if (!this.loggedIn) {
86
+ const ok = await this.login();
87
+ if (!ok) {
88
+ return null;
89
+ }
90
+ }
91
+
92
+ try {
93
+ const [daily, hourly] = await Promise.all([
94
+ this.fetchDailyData(),
95
+ this.fetchHourlyData(),
96
+ ]);
97
+
98
+ if (!daily) {
99
+ // Session may have expired — clear and retry once
100
+ this.loggedIn = false;
101
+ const ok = await this.login();
102
+ if (!ok) {
103
+ return null;
104
+ }
105
+ const retried = await this.fetchDailyData();
106
+ if (!retried) {
107
+ return null;
108
+ }
109
+ return { daily: retried, hourly: hourly ?? [] };
110
+ }
111
+
112
+ return { daily, hourly: hourly ?? [] };
113
+ } catch (err) {
114
+ this.loggedIn = false;
115
+ this.log.error('Sensus Analytics: error fetching data:', (err as Error).message);
116
+ return null;
117
+ }
118
+ }
119
+
120
+ private async fetchDailyData(): Promise<DailyData | null> {
121
+ const response = await this.client.post('/water/widget/byPage', {
122
+ group: 'meters',
123
+ accountNumber: this.accountNumber,
124
+ deviceId: this.meterNumber,
125
+ });
126
+
127
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
128
+ const device = (response.data as any)?.widgetList?.[0]?.data?.devices?.[0];
129
+ if (!device) {
130
+ this.log.warn('Sensus Analytics: unexpected daily data structure');
131
+ return null;
132
+ }
133
+
134
+ return {
135
+ dailyUsage: parseFloat(device.dailyUsage) || 0,
136
+ usageUnit: device.usageUnit || 'CCF',
137
+ meterAddress: device.meterAddress1 || '',
138
+ lastRead: device.lastRead || '',
139
+ meterId: String(device.meterId || ''),
140
+ meterLat: parseFloat(device.meterLat) || 0,
141
+ meterLong: parseFloat(device.meterLong) || 0,
142
+ odometer: parseFloat(device.latestReadUsage) || 0,
143
+ billingUsage: parseFloat(device.billingUsage) || 0,
144
+ };
145
+ }
146
+
147
+ private async fetchHourlyData(): Promise<HourlyEntry[] | null> {
148
+ // Fetch the previous day's data (Sensus updates at midnight)
149
+ const yesterday = new Date();
150
+ yesterday.setDate(yesterday.getDate() - 1);
151
+ const startOfDay = new Date(
152
+ yesterday.getFullYear(),
153
+ yesterday.getMonth(),
154
+ yesterday.getDate(),
155
+ );
156
+ const endOfDay = new Date(startOfDay.getTime() + 86_400_000 - 1);
157
+
158
+ const response = await this.client.get(
159
+ `/water/usage/${this.accountNumber}/${this.meterNumber}`,
160
+ {
161
+ params: {
162
+ start: startOfDay.getTime(),
163
+ end: endOfDay.getTime(),
164
+ zoom: 'day',
165
+ page: 'null',
166
+ weather: '1',
167
+ },
168
+ },
169
+ );
170
+
171
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
172
+ const data = response.data as any;
173
+ if (!data?.operationSuccess) {
174
+ this.log.warn('Sensus Analytics: hourly data fetch unsuccessful');
175
+ return null;
176
+ }
177
+
178
+ const usageArray: unknown[][] = data?.data?.usage;
179
+ if (!Array.isArray(usageArray) || usageArray.length < 2) {
180
+ return [];
181
+ }
182
+
183
+ // First element is units row: [usageUnit, rainUnit, tempUnit, altUnit]
184
+ const [usageUnit, rainUnit, tempUnit] = usageArray[0] as string[];
185
+ const rows = usageArray.slice(1);
186
+
187
+ return rows.map((row) => ({
188
+ timestamp: row[0] as number,
189
+ usage: (row[1] as number) ?? 0,
190
+ rain: (row[2] as number) ?? 0,
191
+ temp: (row[3] as number) ?? 0,
192
+ usageUnit: usageUnit ?? 'CCF',
193
+ rainUnit: rainUnit ?? 'INCHES',
194
+ tempUnit: tempUnit ?? 'FAHRENHEIT',
195
+ }));
196
+ }
197
+ }
@@ -0,0 +1,2 @@
1
+ export const PLATFORM_NAME = 'SensusAnalytics';
2
+ export const PLUGIN_NAME = 'homebridge-sensus';
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "commonjs",
5
+ "lib": ["ES2020"],
6
+ "strict": true,
7
+ "noImplicitAny": true,
8
+ "strictNullChecks": true,
9
+ "moduleResolution": "node",
10
+ "experimentalDecorators": true,
11
+ "skipLibCheck": true,
12
+ "outDir": "dist",
13
+ "declaration": true,
14
+ "declarationMap": true,
15
+ "sourceMap": true
16
+ },
17
+ "include": ["src"]
18
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"accessory.d.ts","sourceRoot":"","sources":["../src/accessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAgD,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EA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,qDAAqD;QACrD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;YAC9B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,MAAM,CAAC,MAAM,4BAA4B,CAAC,CAAC;QAC/E,CAAC;QAED,gBAAgB;QAChB,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CACpB,IAAI,IAAI,CAAC,SAAS,CAAC,WAAW,IAAI;YAClC,SAAS,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,SAAS,KAAK;YACjD,WAAW,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,SAAS,KAAK;YACrD,QAAQ,SAAS,EAAE;YACnB,CAAC,QAAQ,CAAC,CAAC,CAAC,oBAAoB,QAAQ,CAAC,KAAK,WAAW,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CACjF,CAAC;IACJ,CAAC;CACF;AAxLD,8DAwLC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;yBAIvB,KAAK,GAAG,KAAG,IAAI;AAAzB,kBAEE"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,yCAAqD;AACrD,yCAAwD;AAExD,iBAAS,CAAC,GAAQ,EAAQ,EAAE;IAC1B,GAAG,CAAC,gBAAgB,CAAC,sBAAW,EAAE,wBAAa,EAAE,kCAAuB,CAAC,CAAC;AAC5E,CAAC,CAAC"}
@@ -1 +0,0 @@
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,EACd,OAAO,EACR,MAAM,YAAY,CAAC;AAMpB,qBAAa,uBAAwB,YAAW,qBAAqB;aAQjD,GAAG,EAAE,MAAM;aACX,MAAM,EAAE,cAAc;aACtB,GAAG,EAAE,GAAG;IAT1B,SAAgB,OAAO,EAAE,OAAO,OAAO,CAAC;IACxC,SAAgB,cAAc,EAAE,OAAO,cAAc,CAAC;IAGtD,SAAgB,iBAAiB,EAAE,iBAAiB,EAAE,CAAM;gBAG1C,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,GAAG;IAY1B,qEAAqE;IACrE,kBAAkB,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI;IAKtD,OAAO,CAAC,eAAe;CAoCxB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":";;;AAUA,yCAAwD;AACxD,2CAAwD;AACxD,2CAAiD;AAEjD,MAAa,uBAAuB;IAOlC,YACkB,GAAW,EACX,MAAsB,EACtB,GAAQ;QAFR,QAAG,GAAH,GAAG,CAAQ;QACX,WAAM,GAAN,MAAM,CAAgB;QACtB,QAAG,GAAH,GAAG,CAAK;QAN1B,wCAAwC;QACxB,sBAAiB,GAAwB,EAAE,CAAC;QAO1D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;QACpC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC;QAElD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAEzD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;YACrC,IAAI,CAAC,eAAe,EAAE,CAAC;QACzB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AM,CAAC,YAAY,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,CAAC,CAAa,CAAC;QACrE,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,SAAS,GAAG,CAAC,YAAY,IAAI,KAAK,CAAC,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;QAEvF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACxB,SAAS,EAAE,GAAG,CAAC,CAAC,CAAW;YAC3B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAE,GAAG,CAAC,CAAC,CAAY,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG;YACtE,IAAI,EAAG,GAAG,CAAC,CAAC,CAAY,IAAI,CAAC;YAC7B,IAAI,EAAG,GAAG,CAAC,CAAC,CAAY,IAAI,CAAC;YAC7B,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,QAAQ,IAAI,QAAQ;YAC9B,QAAQ,EAAE,QAAQ,IAAI,YAAY;SACnC,CAAC,CAAC,CAAC;IACN,CAAC;CACF;AAxKD,gDAwKC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAC/C,eAAO,MAAM,WAAW,sBAAsB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG,iBAAiB,CAAC;AAClC,QAAA,WAAW,GAAG,mBAAmB,CAAC"}