homebridge-tryfi 1.1.1 → 1.2.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/CHANGELOG.md +60 -0
- package/README.md +308 -21
- package/config.schema.json +24 -0
- package/dist/accessory.d.ts +1 -0
- package/dist/accessory.d.ts.map +1 -1
- package/dist/accessory.js +21 -7
- package/dist/accessory.js.map +1 -1
- package/dist/api.d.ts +2 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +42 -6
- package/dist/api.js.map +1 -1
- package/dist/platform.d.ts +16 -0
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +90 -0
- package/dist/platform.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/accessory.ts +28 -12
- package/src/api.ts +52 -7
- package/src/platform.ts +109 -1
- package/src/types.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,66 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.2.0] - 2026-01-29
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **Escape Alert Hysteresis (Debouncing)**: Prevents false escape alerts from GPS drift
|
|
9
|
+
- New `escapeConfirmations` config option (default: 2)
|
|
10
|
+
- Requires multiple consecutive "out of zone" readings before triggering alert
|
|
11
|
+
- Prevents false alarms from GPS noise at safe zone boundaries
|
|
12
|
+
- Quick re-check system for faster real escape detection
|
|
13
|
+
- New `escapeCheckInterval` config option (default: 30s)
|
|
14
|
+
- When potential escape detected, re-checks faster than normal polling
|
|
15
|
+
- Set `escapeConfirmations` to 1 for immediate alerts (v1.1.3 behavior)
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- **Charging State Always True**: Fixed battery charging state detection
|
|
19
|
+
- Was using `ConnectedToBase` which means "BLE connected to base" not "charging"
|
|
20
|
+
- Now correctly uses `bq27421Info.batteryAverageCurrentMa` from battery chip
|
|
21
|
+
- Positive current (>0 mA) = charging, zero/negative = not charging
|
|
22
|
+
- Accurately shows charging only when collar is physically on charging contacts
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- Escape alerts now only update HomeKit when state actually changes (prevents notification spam)
|
|
26
|
+
- Improved logging: clear emoji indicators for escape events (🚨 escaped, ✅ back safe)
|
|
27
|
+
- More detailed debug logging for escape detection process
|
|
28
|
+
|
|
29
|
+
### Technical Details
|
|
30
|
+
- In-memory escape counters per pet (resets on plugin restart)
|
|
31
|
+
- Quick check scheduling system for accelerated re-verification
|
|
32
|
+
- Proper cleanup of pending checks on shutdown
|
|
33
|
+
- Escape logic still requires both conditions: out of zone AND not with owner
|
|
34
|
+
- Charging detection uses battery management chip current reading (bq27421Info.batteryAverageCurrentMa)
|
|
35
|
+
|
|
36
|
+
## [1.1.3] - 2026-01-29
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
- **CRITICAL: False Escape Alerts on Timeouts**: Fixed bug causing false escape alerts when location queries timeout
|
|
40
|
+
- Location data is now cached per pet
|
|
41
|
+
- On timeout/error, cached data is returned instead of nulls
|
|
42
|
+
- Prevents false "dog escaped" alerts when TryFi API is slow
|
|
43
|
+
- First successful location query is cached and reused during subsequent failures
|
|
44
|
+
- This was a serious bug - timeouts would set placeName=null, triggering false escape alerts
|
|
45
|
+
|
|
46
|
+
### Technical Details
|
|
47
|
+
- Added `locationCache` Map to store last known good location per pet
|
|
48
|
+
- Location queries that fail now return cached data (if available) instead of null values
|
|
49
|
+
- Cache is updated only on successful location queries
|
|
50
|
+
- Debug logging shows when cached data is being used
|
|
51
|
+
|
|
52
|
+
## [1.1.2] - 2026-01-29
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
- **Location Timeout Handling**: Eliminated stack traces for location query timeouts
|
|
56
|
+
- Timeout errors now logged at debug level instead of warnings
|
|
57
|
+
- Transient errors (502/503/504) on location queries logged at debug level
|
|
58
|
+
- Plugin continues working with cached/default location data when API is slow
|
|
59
|
+
- Cleaner logs during temporary API slowdowns
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
- Location query errors now use smart categorization (timeout vs server error vs other)
|
|
63
|
+
- Debug-level logging for expected transient failures
|
|
64
|
+
|
|
5
65
|
## [1.1.1] - 2026-01-21
|
|
6
66
|
|
|
7
67
|
### Fixed
|
package/README.md
CHANGED
|
@@ -8,24 +8,89 @@ Homebridge plugin for TryFi Dog GPS Collars
|
|
|
8
8
|
|
|
9
9
|
This plugin exposes your TryFi dog collars to HomeKit with the following accessories per dog:
|
|
10
10
|
|
|
11
|
-
- **Battery Service** - Shows battery level and charging status
|
|
11
|
+
- **Battery Service** - Shows accurate battery level and charging status
|
|
12
|
+
- Real-time battery percentage
|
|
13
|
+
- Accurate charging detection (only when physically on charger)
|
|
14
|
+
- Low battery warnings
|
|
12
15
|
- **Lightbulb** - Control the collar's LED light (on/off)
|
|
13
16
|
- **Switch** - Toggle Lost Dog Mode (triggers high-frequency GPS updates)
|
|
14
|
-
- **Escape Alert** -
|
|
17
|
+
- **Escape Alert** - Smart sensor with GPS drift protection that triggers when your dog is:
|
|
15
18
|
- Outside ALL safe zones, AND
|
|
16
19
|
- Not connected to any owner via Bluetooth
|
|
20
|
+
- **NEW in v1.2.0:** Configurable hysteresis prevents false alarms from GPS noise
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
## What's New in v1.2.0 🎉
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
1. `currPlaceName` is `null` (not in any defined safe zone)
|
|
22
|
-
2. `connectedTo` is `null` (not with an owner)
|
|
24
|
+
### 🔥 Escape Alert Hysteresis (GPS Drift Protection)
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
Prevents false escape alerts from GPS noise at safe zone boundaries:
|
|
27
|
+
|
|
28
|
+
- **Configurable confirmations** - Requires 2+ consecutive "out of zone" readings (default: 2)
|
|
29
|
+
- **Quick re-check system** - Fast verification when potential escape detected (default: 30s)
|
|
30
|
+
- **Smart detection** - Filters GPS drift while still detecting real escapes quickly
|
|
31
|
+
|
|
32
|
+
**Example:** Dog near fence gets temporary GPS blip showing "outside zone"
|
|
33
|
+
- **Without hysteresis:** False alarm! 🚨
|
|
34
|
+
- **With hysteresis (default):** Waits 30s, re-checks, sees dog is safe, no alert ✅
|
|
35
|
+
|
|
36
|
+
### 🔋 Accurate Charging Detection
|
|
37
|
+
|
|
38
|
+
Fixed charging status to only show "charging" when collar is physically on charging base:
|
|
39
|
+
|
|
40
|
+
- **Before:** Always showed "charging" when near base station ❌
|
|
41
|
+
- **After:** Only shows "charging" when actively receiving charge ✅
|
|
42
|
+
- Uses battery chip current sensing (`batteryAverageCurrentMa`) for accurate detection
|
|
43
|
+
|
|
44
|
+
### 🐕 Ignore Specific Pets
|
|
45
|
+
|
|
46
|
+
Exclude specific pets from HomeKit monitoring:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
"ignoredPets": ["Charlie"]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Only creates accessories for pets you want to monitor.
|
|
53
|
+
|
|
54
|
+
## Escape Alert Logic
|
|
55
|
+
|
|
56
|
+
### Basic Logic (Always Required)
|
|
57
|
+
|
|
58
|
+
The escape alert only triggers when **BOTH** conditions are true:
|
|
59
|
+
|
|
60
|
+
1. `placeName` is `null` (not in any defined safe zone)
|
|
61
|
+
2. `connectedToUser` is `null` (not with an owner)
|
|
62
|
+
|
|
63
|
+
**Examples:**
|
|
25
64
|
- ✅ Dog at home alone → No alert (in safe zone)
|
|
26
65
|
- ✅ Dog at dog park alone → No alert (in safe zone)
|
|
27
|
-
- ✅ Dog on a walk with you → No alert (with owner)
|
|
28
|
-
- 🚨 **Dog escaped alone** → ALERT!
|
|
66
|
+
- ✅ Dog on a walk with you outside zones → No alert (with owner)
|
|
67
|
+
- 🚨 **Dog escaped alone outside zones** → ALERT!
|
|
68
|
+
|
|
69
|
+
### Hysteresis Protection (v1.2.0+)
|
|
70
|
+
|
|
71
|
+
Requires multiple consecutive confirmations before alerting:
|
|
72
|
+
|
|
73
|
+
**Scenario 1: GPS Drift (False Alarm Prevented)**
|
|
74
|
+
```
|
|
75
|
+
00:00 - Poll: Out of zone (1/2 confirmations)
|
|
76
|
+
00:30 - Quick check: Back in zone → Counter reset
|
|
77
|
+
Result: No alert ✅
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Scenario 2: Real Escape (Fast Detection)**
|
|
81
|
+
```
|
|
82
|
+
00:00 - Poll: Out of zone (1/2 confirmations)
|
|
83
|
+
00:30 - Quick check: Still out (2/2 confirmations)
|
|
84
|
+
Result: 🚨 Alert in 30 seconds! (faster than 60s normal polling)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Scenario 3: Boundary Walking (No Spam)**
|
|
88
|
+
```
|
|
89
|
+
00:00 - Out (1/2) → 00:30 In → Reset
|
|
90
|
+
01:00 - Out (1/2) → 01:30 In → Reset
|
|
91
|
+
02:00 - Out (1/2) → 02:30 In → Reset
|
|
92
|
+
Result: No alerts, dog safe ✅
|
|
93
|
+
```
|
|
29
94
|
|
|
30
95
|
## Installation
|
|
31
96
|
|
|
@@ -54,7 +119,10 @@ Add this to your Homebridge `config.json`:
|
|
|
54
119
|
"username": "your@email.com",
|
|
55
120
|
"password": "yourpassword",
|
|
56
121
|
"pollingInterval": 60,
|
|
57
|
-
"escapeAlertType": "leak"
|
|
122
|
+
"escapeAlertType": "leak",
|
|
123
|
+
"escapeConfirmations": 2,
|
|
124
|
+
"escapeCheckInterval": 30,
|
|
125
|
+
"ignoredPets": []
|
|
58
126
|
}
|
|
59
127
|
]
|
|
60
128
|
}
|
|
@@ -62,29 +130,139 @@ Add this to your Homebridge `config.json`:
|
|
|
62
130
|
|
|
63
131
|
### Configuration Options
|
|
64
132
|
|
|
65
|
-
| Option | Required | Default | Description |
|
|
66
|
-
|
|
67
|
-
| `platform` | Yes | - | Must be `"TryFi"` |
|
|
68
|
-
| `name` | Yes | - | Platform name (can be anything) |
|
|
69
|
-
| `username` | Yes | - | Your TryFi email address |
|
|
70
|
-
| `password` | Yes | - | Your TryFi password |
|
|
71
|
-
| `pollingInterval` | No | `60` | Seconds between API polls
|
|
72
|
-
| `escapeAlertType` | No | `"leak"` |
|
|
133
|
+
| Option | Required | Default | Range | Description |
|
|
134
|
+
|--------|----------|---------|-------|-------------|
|
|
135
|
+
| `platform` | Yes | - | - | Must be `"TryFi"` |
|
|
136
|
+
| `name` | Yes | - | - | Platform name (can be anything) |
|
|
137
|
+
| `username` | Yes | - | - | Your TryFi email address |
|
|
138
|
+
| `password` | Yes | - | - | Your TryFi password |
|
|
139
|
+
| `pollingInterval` | No | `60` | 10-300 | Seconds between API polls |
|
|
140
|
+
| `escapeAlertType` | No | `"leak"` | leak/motion | Notification urgency level |
|
|
141
|
+
| `escapeConfirmations` | No | `2` | 1-5 | Consecutive out-of-zone checks required |
|
|
142
|
+
| `escapeCheckInterval` | No | `30` | 10-120 | Seconds between quick re-checks |
|
|
143
|
+
| `ignoredPets` | No | `[]` | - | Array of pet names to exclude |
|
|
73
144
|
|
|
74
145
|
### Escape Alert Types
|
|
75
146
|
|
|
76
147
|
**Leak Sensor** (default):
|
|
77
148
|
- Triggers **critical** HomeKit notifications
|
|
78
149
|
- Shows "Leak Detected" when dog escapes
|
|
150
|
+
- Red alert badge in Home app
|
|
79
151
|
- Best for: Maximum urgency
|
|
80
152
|
|
|
81
153
|
**Motion Sensor**:
|
|
82
154
|
- Triggers **standard** HomeKit notifications
|
|
83
155
|
- Shows "Motion Detected" when dog escapes
|
|
156
|
+
- Standard notification
|
|
84
157
|
- Best for: Less alarming notifications, still useful for automations
|
|
85
158
|
|
|
159
|
+
### Escape Confirmation Settings
|
|
160
|
+
|
|
161
|
+
**escapeConfirmations** - How many consecutive checks required:
|
|
162
|
+
|
|
163
|
+
| Value | Behavior | Detection Time | Best For |
|
|
164
|
+
|-------|----------|----------------|----------|
|
|
165
|
+
| `1` | Immediate alert | Instant | Maximum sensitivity, accept GPS noise |
|
|
166
|
+
| `2` ✅ | Default | ~30 seconds | **Recommended** - filters drift, fast alerts |
|
|
167
|
+
| `3` | Conservative | ~60 seconds | Very GPS-noisy areas |
|
|
168
|
+
| `5` | Paranoid | ~120 seconds | Extreme GPS problems |
|
|
169
|
+
|
|
170
|
+
**escapeCheckInterval** - Re-check speed during potential escape:
|
|
171
|
+
|
|
172
|
+
| Value | Use Case |
|
|
173
|
+
|-------|----------|
|
|
174
|
+
| `10` | Very fast response (more API calls) |
|
|
175
|
+
| `30` ✅ | **Recommended** - fast + efficient |
|
|
176
|
+
| `60` | Slower but fewer API calls |
|
|
177
|
+
| `120` | Very conservative |
|
|
178
|
+
|
|
179
|
+
**Detection Time Calculation:**
|
|
180
|
+
- Time to alert = `(escapeConfirmations - 1) × escapeCheckInterval`
|
|
181
|
+
- Example: 2 confirmations × 30s = 30 seconds
|
|
182
|
+
- Example: 3 confirmations × 30s = 60 seconds
|
|
183
|
+
|
|
184
|
+
### Configuration Examples
|
|
185
|
+
|
|
186
|
+
**Default (Recommended):**
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"platform": "TryFi",
|
|
190
|
+
"username": "your@email.com",
|
|
191
|
+
"password": "yourpassword",
|
|
192
|
+
"pollingInterval": 60,
|
|
193
|
+
"escapeAlertType": "leak",
|
|
194
|
+
"escapeConfirmations": 2,
|
|
195
|
+
"escapeCheckInterval": 30
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Maximum Sensitivity (v1.1.3 behavior):**
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"platform": "TryFi",
|
|
203
|
+
"username": "your@email.com",
|
|
204
|
+
"password": "yourpassword",
|
|
205
|
+
"escapeConfirmations": 1
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**Conservative (GPS-Noisy Area):**
|
|
210
|
+
```json
|
|
211
|
+
{
|
|
212
|
+
"platform": "TryFi",
|
|
213
|
+
"username": "your@email.com",
|
|
214
|
+
"password": "yourpassword",
|
|
215
|
+
"escapeConfirmations": 3,
|
|
216
|
+
"escapeCheckInterval": 30
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**Fast Response:**
|
|
221
|
+
```json
|
|
222
|
+
{
|
|
223
|
+
"platform": "TryFi",
|
|
224
|
+
"username": "your@email.com",
|
|
225
|
+
"password": "yourpassword",
|
|
226
|
+
"escapeConfirmations": 2,
|
|
227
|
+
"escapeCheckInterval": 10
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**Monitor Only One Dog:**
|
|
232
|
+
```json
|
|
233
|
+
{
|
|
234
|
+
"platform": "TryFi",
|
|
235
|
+
"username": "your@email.com",
|
|
236
|
+
"password": "yourpassword",
|
|
237
|
+
"ignoredPets": ["Charlie", "OtherDog"]
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
86
241
|
## Usage
|
|
87
242
|
|
|
243
|
+
### HomeKit Accessories
|
|
244
|
+
|
|
245
|
+
Each monitored collar appears in HomeKit with:
|
|
246
|
+
|
|
247
|
+
**Battery**
|
|
248
|
+
- Current charge percentage (0-100%)
|
|
249
|
+
- Charging status (Yes/No) - only "Yes" when physically on charger
|
|
250
|
+
- Low battery indicator (<20%)
|
|
251
|
+
|
|
252
|
+
**LED Light**
|
|
253
|
+
- Turn collar LED on/off remotely
|
|
254
|
+
- Useful for finding your dog in the dark
|
|
255
|
+
|
|
256
|
+
**Lost Dog Mode**
|
|
257
|
+
- Enable high-frequency GPS updates
|
|
258
|
+
- Increases location accuracy during search
|
|
259
|
+
- Uses more battery
|
|
260
|
+
|
|
261
|
+
**Escape Alert**
|
|
262
|
+
- Leak Sensor (default) or Motion Sensor
|
|
263
|
+
- Triggers when dog escapes outside safe zones while alone
|
|
264
|
+
- Smart hysteresis prevents false GPS drift alarms
|
|
265
|
+
|
|
88
266
|
### Automations
|
|
89
267
|
|
|
90
268
|
Example automations you can create:
|
|
@@ -92,22 +270,113 @@ Example automations you can create:
|
|
|
92
270
|
**Critical Escape Alert:**
|
|
93
271
|
```
|
|
94
272
|
When [Dog Name] Escape Alert detects leak
|
|
95
|
-
→ Send notification "🚨 [Dog] has escaped!"
|
|
273
|
+
→ Send critical notification "🚨 [Dog] has escaped!"
|
|
96
274
|
→ Turn on [Dog Name] Lost Mode
|
|
97
|
-
→ Flash
|
|
275
|
+
→ Flash all lights red
|
|
276
|
+
→ Send location to family members
|
|
98
277
|
```
|
|
99
278
|
|
|
100
279
|
**Low Battery Warning:**
|
|
101
280
|
```
|
|
102
281
|
When [Dog Name] Battery drops below 20%
|
|
103
282
|
→ Send notification "🔋 [Dog]'s collar battery is low"
|
|
283
|
+
→ Remind to charge overnight
|
|
104
284
|
```
|
|
105
285
|
|
|
106
286
|
**Auto Lost Mode on Escape:**
|
|
107
287
|
```
|
|
108
288
|
When [Dog Name] Escape Alert detects leak
|
|
109
|
-
→ Turn on [Dog Name] Lost Mode
|
|
289
|
+
→ Turn on [Dog Name] Lost Mode (high-frequency GPS)
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Arrival Home:**
|
|
110
293
|
```
|
|
294
|
+
When [Dog Name] Battery charging status becomes "Yes"
|
|
295
|
+
→ Turn off Lost Mode
|
|
296
|
+
→ Send notification "[Dog] is home and charging"
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
**Find Dog at Night:**
|
|
300
|
+
```
|
|
301
|
+
When I say "Find [Dog]"
|
|
302
|
+
→ Turn on [Dog Name] LED Light
|
|
303
|
+
→ Wait 30 seconds
|
|
304
|
+
→ Turn off LED Light
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## Troubleshooting
|
|
308
|
+
|
|
309
|
+
### False Escape Alerts
|
|
310
|
+
|
|
311
|
+
**Problem:** Getting escape alerts when dog is safe near fence
|
|
312
|
+
|
|
313
|
+
**Solution:** Increase `escapeConfirmations` to 3 or 4:
|
|
314
|
+
```json
|
|
315
|
+
"escapeConfirmations": 3
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Charging Status Always "No"
|
|
319
|
+
|
|
320
|
+
**Problem:** Collar on charger but shows "Not Charging"
|
|
321
|
+
|
|
322
|
+
**Possible causes:**
|
|
323
|
+
- Collar not properly seated on charging contacts
|
|
324
|
+
- Dirty charging contacts (clean with isopropyl alcohol)
|
|
325
|
+
- Battery already at 100% (trickle charge current too low to detect)
|
|
326
|
+
|
|
327
|
+
**Verify:** Battery percentage should be increasing if actually charging
|
|
328
|
+
|
|
329
|
+
### Missing Pets
|
|
330
|
+
|
|
331
|
+
**Problem:** Some pets not appearing in HomeKit
|
|
332
|
+
|
|
333
|
+
**Check:**
|
|
334
|
+
1. Pets not in `ignoredPets` array
|
|
335
|
+
2. Pets have active TryFi subscription
|
|
336
|
+
3. Check Homebridge logs for errors
|
|
337
|
+
|
|
338
|
+
### Slow Escape Detection
|
|
339
|
+
|
|
340
|
+
**Problem:** Takes too long to alert when dog escapes
|
|
341
|
+
|
|
342
|
+
**Solution:** Reduce `escapeCheckInterval`:
|
|
343
|
+
```json
|
|
344
|
+
"escapeCheckInterval": 10
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
Or reduce confirmations (less GPS protection):
|
|
348
|
+
```json
|
|
349
|
+
"escapeConfirmations": 1
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
## Technical Details
|
|
353
|
+
|
|
354
|
+
### API Authentication
|
|
355
|
+
- REST login with form data at `/auth/login`
|
|
356
|
+
- Session cookies for GraphQL API access
|
|
357
|
+
- Automatic re-authentication on 401/403 errors
|
|
358
|
+
|
|
359
|
+
### Polling Strategy
|
|
360
|
+
- Normal polling: User-configured interval (default 60s)
|
|
361
|
+
- Quick checks: Faster interval during potential escapes (default 30s)
|
|
362
|
+
- Smart error handling for transient API failures
|
|
363
|
+
|
|
364
|
+
### Charging Detection
|
|
365
|
+
- Uses BQ27421 battery management chip data
|
|
366
|
+
- `batteryAverageCurrentMa > 0` indicates charging
|
|
367
|
+
- Field only present when collar on charging contacts
|
|
368
|
+
- Eliminates false "charging" status from base BLE connection
|
|
369
|
+
|
|
370
|
+
### Escape Detection
|
|
371
|
+
- In-memory hysteresis counters per pet
|
|
372
|
+
- Resets on plugin restart (safe default)
|
|
373
|
+
- Quick check scheduling for fast real escape detection
|
|
374
|
+
- State change detection prevents notification spam
|
|
375
|
+
|
|
376
|
+
### Location Caching
|
|
377
|
+
- Caches last known location per pet
|
|
378
|
+
- Returns cached location on API timeout
|
|
379
|
+
- Prevents false escape alerts from temporary API failures
|
|
111
380
|
|
|
112
381
|
## Development
|
|
113
382
|
|
|
@@ -126,10 +395,28 @@ npm link
|
|
|
126
395
|
|
|
127
396
|
Then restart Homebridge.
|
|
128
397
|
|
|
398
|
+
### Running Tests
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
npm test
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
## Version History
|
|
405
|
+
|
|
406
|
+
See [CHANGELOG.md](CHANGELOG.md) for detailed version history.
|
|
407
|
+
|
|
408
|
+
**Latest:** v1.2.0
|
|
409
|
+
- Escape alert hysteresis (GPS drift protection)
|
|
410
|
+
- Accurate charging detection using battery current
|
|
411
|
+
- Ignore specific pets feature
|
|
412
|
+
- Smart notification handling
|
|
413
|
+
|
|
129
414
|
## Credits
|
|
130
415
|
|
|
131
416
|
Based on the excellent [pytryfi](https://github.com/sbabcock23/pytryfi) library and [hass-tryfi](https://github.com/sbabcock23/hass-tryfi) Home Assistant integration.
|
|
132
417
|
|
|
418
|
+
Thanks to all contributors and users for feedback and testing!
|
|
419
|
+
|
|
133
420
|
## License
|
|
134
421
|
|
|
135
422
|
Apache-2.0
|
package/config.schema.json
CHANGED
|
@@ -55,6 +55,22 @@
|
|
|
55
55
|
"title": "Pet Name"
|
|
56
56
|
},
|
|
57
57
|
"description": "List of pet names to ignore (will not create HomeKit accessories or poll for updates)"
|
|
58
|
+
},
|
|
59
|
+
"escapeConfirmations": {
|
|
60
|
+
"title": "Escape Confirmations",
|
|
61
|
+
"type": "integer",
|
|
62
|
+
"default": 2,
|
|
63
|
+
"minimum": 1,
|
|
64
|
+
"maximum": 5,
|
|
65
|
+
"description": "Number of consecutive 'out of zone' readings required before triggering escape alert (prevents GPS drift false alarms)"
|
|
66
|
+
},
|
|
67
|
+
"escapeCheckInterval": {
|
|
68
|
+
"title": "Escape Check Interval (seconds)",
|
|
69
|
+
"type": "integer",
|
|
70
|
+
"default": 30,
|
|
71
|
+
"minimum": 10,
|
|
72
|
+
"maximum": 120,
|
|
73
|
+
"description": "How quickly to re-check when potential escape detected (faster than normal polling)"
|
|
58
74
|
}
|
|
59
75
|
}
|
|
60
76
|
},
|
|
@@ -75,6 +91,14 @@
|
|
|
75
91
|
"escapeAlertType"
|
|
76
92
|
]
|
|
77
93
|
},
|
|
94
|
+
{
|
|
95
|
+
"type": "flex",
|
|
96
|
+
"flex-flow": "row wrap",
|
|
97
|
+
"items": [
|
|
98
|
+
"escapeConfirmations",
|
|
99
|
+
"escapeCheckInterval"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
78
102
|
{
|
|
79
103
|
"key": "ignoredPets",
|
|
80
104
|
"type": "array",
|
package/dist/accessory.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare class TryFiCollarAccessory {
|
|
|
13
13
|
private batteryService;
|
|
14
14
|
private lightbulbService;
|
|
15
15
|
private lostDogSwitchService;
|
|
16
|
+
private lastEscapeState?;
|
|
16
17
|
constructor(platform: TryFiPlatform, accessory: PlatformAccessory, pet: TryFiPet);
|
|
17
18
|
private setupCharacteristics;
|
|
18
19
|
/**
|
package/dist/accessory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessory.d.ts","sourceRoot":"","sources":["../src/accessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC;;;GAGG;AACH,qBAAa,oBAAoB;
|
|
1
|
+
{"version":3,"file":"accessory.d.ts","sourceRoot":"","sources":["../src/accessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC;;;GAGG;AACH,qBAAa,oBAAoB;IAU7B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,GAAG;IAXb,OAAO,CAAC,kBAAkB,CAAU;IACpC,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,gBAAgB,CAAU;IAClC,OAAO,CAAC,oBAAoB,CAAU;IAGtC,OAAO,CAAC,eAAe,CAAC,CAAU;gBAGf,QAAQ,EAAE,aAAa,EACvB,SAAS,EAAE,iBAAiB,EACrC,GAAG,EAAE,QAAQ;IAyCvB,OAAO,CAAC,oBAAoB;IAY5B;;OAEG;IACH,qBAAqB;IAsErB;;OAEG;IACH,aAAa,CAAC,GAAG,EAAE,QAAQ;IAMrB,cAAc,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAI9C,cAAc,CAAC,KAAK,EAAE,mBAAmB;IAazC,iBAAiB,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAIjD,iBAAiB,CAAC,KAAK,EAAE,mBAAmB;CAWnD"}
|
package/dist/accessory.js
CHANGED
|
@@ -13,6 +13,8 @@ class TryFiCollarAccessory {
|
|
|
13
13
|
batteryService;
|
|
14
14
|
lightbulbService;
|
|
15
15
|
lostDogSwitchService;
|
|
16
|
+
// Track last escape state to avoid redundant HomeKit updates
|
|
17
|
+
lastEscapeState;
|
|
16
18
|
constructor(platform, accessory, pet) {
|
|
17
19
|
this.platform = platform;
|
|
18
20
|
this.accessory = accessory;
|
|
@@ -66,13 +68,25 @@ class TryFiCollarAccessory {
|
|
|
66
68
|
const escapeAlertType = this.platform.config.escapeAlertType || 'leak';
|
|
67
69
|
// Escape Alert: Triggered when NOT in safe zone AND NOT with owner
|
|
68
70
|
const isEscaped = (this.pet.placeName === null) && (this.pet.connectedToUser === null);
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
// Only update HomeKit if escape state changed (prevents redundant notifications)
|
|
72
|
+
if (this.lastEscapeState !== isEscaped) {
|
|
73
|
+
if (escapeAlertType === 'leak') {
|
|
74
|
+
this.escapeAlertService.updateCharacteristic(this.platform.Characteristic.LeakDetected, isEscaped
|
|
75
|
+
? this.platform.Characteristic.LeakDetected.LEAK_DETECTED
|
|
76
|
+
: this.platform.Characteristic.LeakDetected.LEAK_NOT_DETECTED);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.escapeAlertService.updateCharacteristic(this.platform.Characteristic.MotionDetected, isEscaped);
|
|
80
|
+
}
|
|
81
|
+
this.lastEscapeState = isEscaped;
|
|
82
|
+
// Log state changes
|
|
83
|
+
if (isEscaped) {
|
|
84
|
+
this.platform.log.warn(`🚨 ${this.pet.name} has ESCAPED!`);
|
|
85
|
+
}
|
|
86
|
+
else if (this.lastEscapeState === true) {
|
|
87
|
+
// Only log "back safe" if was previously escaped
|
|
88
|
+
this.platform.log.info(`✅ ${this.pet.name} is back in safe zone`);
|
|
89
|
+
}
|
|
76
90
|
}
|
|
77
91
|
// Battery Service
|
|
78
92
|
this.batteryService.updateCharacteristic(this.platform.Characteristic.BatteryLevel, this.pet.batteryPercent);
|
package/dist/accessory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessory.js","sourceRoot":"","sources":["../src/access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,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAClE,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC;YAC/C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,qBAAqB,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QAC3F,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,mCAAmC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE,KAAK,CAAC,CAAC;YACpF,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,cAAc,sFAAyE,CAAC;QACpI,CAAC;IACH,CAAC;CACF;AAnLD,oDAmLC"}
|
package/dist/api.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare class TryFiAPI {
|
|
|
11
11
|
private readonly client;
|
|
12
12
|
private readonly jar;
|
|
13
13
|
private session;
|
|
14
|
+
private locationCache;
|
|
14
15
|
constructor(username: string, password: string, log: Logger);
|
|
15
16
|
/**
|
|
16
17
|
* Login using REST API (matches pytryfi)
|
|
@@ -22,6 +23,7 @@ export declare class TryFiAPI {
|
|
|
22
23
|
getPets(): Promise<TryFiPet[]>;
|
|
23
24
|
/**
|
|
24
25
|
* Get pet location - matches pytryfi's getCurrentPetLocation
|
|
26
|
+
* Returns cached data on timeout/error to prevent false escape alerts
|
|
25
27
|
*/
|
|
26
28
|
private getPetLocation;
|
|
27
29
|
/**
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAEL,QAAQ,EAGT,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,qBAAa,QAAQ;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAEL,QAAQ,EAGT,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,qBAAa,QAAQ;IAgBjB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAjBtB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2B;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;IACvC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAY;IAChC,OAAO,CAAC,OAAO,CAA6B;IAG5C,OAAO,CAAC,aAAa,CAMN;gBAGI,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM;IAc9B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAmC5B;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAwIpC;;;OAGG;YACW,cAAc;IAmI5B;;OAEG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAyCvE;;OAEG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;YA2CxD,mBAAmB;CAKlC"}
|