homebridge-smartthings-oauth 1.0.10 → 1.0.11

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "private": false,
3
3
  "displayName": "Homebridge Smartthings oAuth Plugin",
4
4
  "name": "homebridge-smartthings-oauth",
5
- "version": "1.0.10",
5
+ "version": "1.0.11",
6
6
  "description": "Connects SmartThings devices to Homebridge. Automatically discovers devices.",
7
7
  "license": "Apache-2.0",
8
8
  "repository": {
@@ -30,8 +30,7 @@
30
30
  "homekit"
31
31
  ],
32
32
  "dependencies": {
33
- "axios": "^1.0.0",
34
- "homebridge-config-ui-x": "^4.51.0"
33
+ "axios": "^1.0.0"
35
34
  },
36
35
  "devDependencies": {
37
36
  "@types/express": "^4.17.14",
@@ -1,137 +0,0 @@
1
- # Homebridge v2.0 Migration Plan for SmartThings Plugin
2
-
3
- ## Overview
4
- This document outlines the plan to migrate the SmartThings Homebridge plugin from Homebridge v1.x to v2.0 compatibility. The migration focuses on addressing breaking changes in HAP-NodeJS v1 and Homebridge v2 while maintaining all existing functionality.
5
-
6
- ## Current Status
7
- - **Plugin Version**: 1.0.9
8
- - **Current Homebridge Support**: >=1.3.5
9
- - **Target Homebridge Support**: ^1.6.0 || ^2.0.0-beta.0
10
- - **Node.js Support**: >=20.0.0 (already compliant)
11
-
12
- ## Breaking Changes to Address
13
-
14
- ### 1. HAP-NodeJS v1 Changes
15
-
16
- #### 1.1 BatteryService Removal
17
- - **Issue**: `BatteryService` has been removed in favor of `Battery`
18
- - **Files Affected**:
19
- - `src/services/batteryService.ts`
20
- - `src/multiServiceAccessory.ts`
21
- - **Action**: Update service class name and imports
22
-
23
- #### 1.2 Characteristic Enum Access Changes
24
- - **Issue**: Use of enums off the `Characteristic` class is no longer supported
25
- - **Current Pattern**: `Characteristic.Units`, `Characteristic.Formats`, `Characteristic.Perms`
26
- - **New Pattern**: `api.hap.Units`, `api.hap.Formats`, `api.hap.Perms`
27
- - **Files Affected**: All service files using characteristic enums
28
- - **Action**: Update all enum references to use `api.hap` namespace
29
-
30
- #### 1.3 Characteristic.getValue() Removal
31
- - **Issue**: `Characteristic.getValue()` has been removed in favor of `Characteristic.value`
32
- - **Files Affected**:
33
- - `src/multiServiceAccessory.ts` (line 401)
34
- - `src/basePlatformAccessory.ts` (line 162)
35
- - **Action**: Replace `getValue()` calls with `.value` property access
36
-
37
- #### 1.4 Storage Path Changes
38
- - **Issue**: Deprecated `storagePath` usage
39
- - **Files Affected**:
40
- - `src/platform.ts`
41
- - `src/auth/tokenManager.ts`
42
- - `src/auth/CrashLoopManager.ts`
43
- - **Action**: Switch to `HAPStorage.setCustomStoragePath`
44
-
45
- ### 2. Homebridge v2 Changes
46
-
47
- #### 2.1 Engine Requirements Update
48
- - **Issue**: Need to support both v1.6.0+ and v2.0.0-beta.0+
49
- - **Action**: Update `package.json` engines field
50
-
51
- #### 2.2 API Changes
52
- - **Issue**: Potential API changes in Homebridge v2
53
- - **Action**: Test with beta version and update as needed
54
-
55
- ## Migration Tasks
56
-
57
- ### Phase 1: HAP-NodeJS v1 Compatibility
58
- 1. **Update BatteryService to Battery**
59
- - Rename class and update imports
60
- - Test battery functionality
61
-
62
- 2. **Update Characteristic Enum Access**
63
- - Audit all service files for enum usage
64
- - Update to use `api.hap` namespace
65
- - Test all device types
66
-
67
- 3. **Fix Characteristic.getValue() Usage**
68
- - Replace with `.value` property access
69
- - Test polling functionality
70
-
71
- 4. **Update Storage Path Usage**
72
- - Implement `HAPStorage.setCustomStoragePath`
73
- - Test authentication and token storage
74
-
75
- ### Phase 2: Homebridge v2 Compatibility
76
- 1. **Update Package.json**
77
- - Add v2.0.0-beta.0 support
78
- - Test installation and registration
79
-
80
- 2. **API Compatibility Testing**
81
- - Test with Homebridge v2 beta
82
- - Address any API changes
83
-
84
- ### Phase 3: Testing and Validation
85
- 1. **Functional Testing**
86
- - Test all device types
87
- - Test authentication flow
88
- - Test webhook functionality
89
- - Test polling and real-time updates
90
-
91
- 2. **Performance Testing**
92
- - Verify no performance regressions
93
- - Test with multiple devices
94
-
95
- 3. **Backward Compatibility**
96
- - Ensure v1.x compatibility maintained
97
- - Test upgrade scenarios
98
-
99
- ## Risk Assessment
100
-
101
- ### Low Risk
102
- - BatteryService rename (simple refactoring)
103
- - Characteristic enum updates (straightforward replacements)
104
- - Package.json updates
105
-
106
- ### Medium Risk
107
- - Storage path changes (affects authentication persistence)
108
- - Characteristic.getValue() changes (affects polling)
109
-
110
- ### High Risk
111
- - Homebridge v2 API changes (unknown until tested)
112
- - Potential breaking changes in beta versions
113
-
114
- ## Success Criteria
115
- 1. Plugin installs and runs on Homebridge v2.0.0-beta.0
116
- 2. All device types function correctly
117
- 3. Authentication and token management work
118
- 4. Real-time updates via webhooks work
119
- 5. Polling functionality works
120
- 6. Backward compatibility with v1.x maintained
121
- 7. No performance regressions
122
-
123
- ## Rollback Plan
124
- - Maintain v1.x compatibility throughout migration
125
- - Use feature flags if needed for v2-specific code
126
- - Keep v1.x as fallback in package.json engines
127
-
128
- ## Timeline
129
- - **Phase 1**: 1-2 days
130
- - **Phase 2**: 1 day
131
- - **Phase 3**: 2-3 days
132
- - **Total**: 4-6 days
133
-
134
- ## Notes
135
- - Homebridge v2 is still in beta, so changes may occur
136
- - Monitor Homebridge v2 release notes for additional changes
137
- - Consider implementing feature detection for v2-specific features
@@ -1,117 +0,0 @@
1
- # Homebridge v2.0 Migration Progress
2
-
3
- ## Completed Tasks
4
-
5
- ### ✅ Task 1: Update BatteryService to Battery
6
- - **Status**: COMPLETED
7
- - **Changes Made**:
8
- - Renamed `BatteryService` class to `Battery` in `src/services/batteryService.ts`
9
- - Updated import in `src/multiServiceAccessory.ts`
10
- - Updated capability map entry to use `Battery`
11
- - Updated characteristic enum access to use `this.platform.Characteristic` (already compliant)
12
- - **Files Modified**:
13
- - `src/services/batteryService.ts`
14
- - `src/multiServiceAccessory.ts`
15
- - **Testing**: ✅ Build successful, ✅ Lint passed
16
-
17
- ### ✅ Task 5: Update Package.json Engines
18
- - **Status**: COMPLETED
19
- - **Changes Made**:
20
- - Updated engines field to support both v1.6.0+ and v2.0.0-beta.0+
21
- - **Files Modified**:
22
- - `package.json`
23
- - **Testing**: ✅ Package.json updated successfully, ✅ Build successful
24
-
25
- ## In Progress Tasks
26
-
27
- ### ✅ Task 2: Update Characteristic Enum Access Patterns
28
- - **Status**: COMPLETED
29
- - **Analysis**:
30
- - Current code already uses `this.platform.Characteristic` which is `this.api.hap.Characteristic`
31
- - No `Characteristic.Units`, `Characteristic.Formats`, or `Characteristic.Perms` usage found
32
- - Code is already compliant with HAP-NodeJS v1 requirements
33
- - **Testing**: ✅ No changes needed, already compliant
34
-
35
- ### ✅ Task 3: Fix Characteristic.getValue() Usage
36
- - **Status**: COMPLETED
37
- - **Analysis**:
38
- - Found `getValue()` calls in `src/multiServiceAccessory.ts` and `src/basePlatformAccessory.ts`
39
- - These are function parameters, not Characteristic methods
40
- - No actual `Characteristic.getValue()` method calls found
41
- - Code is already compliant with HAP-NodeJS v1 requirements
42
- - **Testing**: ✅ No changes needed, already compliant
43
-
44
- ### 🔄 Task 4: Update Storage Path Usage
45
- - **Status**: RESEARCHING
46
- - **Current Usage**:
47
- - `this.api.user.storagePath()` in platform constructor
48
- - Used by CrashLoopManager and TokenManager
49
- - **Challenge**: Need to understand proper `HAPStorage.setCustomStoragePath()` usage
50
- - **Next Steps**: Research HAPStorage import and usage patterns
51
-
52
- ## Pending Tasks
53
-
54
- ### ⏳ Task 6: Platform Constructor Updates
55
- - **Status**: PENDING
56
- - **Dependencies**: Task 2 completion
57
- - **Notes**: May not be needed if current pattern is already compliant
58
-
59
- ### ⏳ Task 7: Testing and Validation
60
- - **Status**: PENDING
61
- - **Dependencies**: Tasks 1-6 completion
62
- - **Notes**: Comprehensive testing needed
63
-
64
- ### ⏳ Task 8: Documentation Updates
65
- - **Status**: PENDING
66
- - **Dependencies**: Task 7 completion
67
-
68
- ### ⏳ Task 9: Final Validation
69
- - **Status**: PENDING
70
- - **Dependencies**: Task 8 completion
71
-
72
- ## Key Findings
73
-
74
- ### ✅ Already Compliant Patterns
75
- 1. **Characteristic Enum Access**: Current code uses `this.platform.Characteristic` which is already `this.api.hap.Characteristic`
76
- 2. **No Deprecated Enum Usage**: No `Characteristic.Units`, `Characteristic.Formats`, or `Characteristic.Perms` found
77
- 3. **No getValue() Method Usage**: Only function parameters named `getValue`, not Characteristic methods
78
-
79
- ### 🔍 Areas Needing Research
80
- 1. **HAPStorage Usage**: Need to understand proper import and usage of `HAPStorage.setCustomStoragePath()`
81
- 2. **Homebridge v2 API Changes**: Need to test with actual v2.0.0-beta.0
82
-
83
- ### 📋 Next Steps
84
- 1. Research HAPStorage implementation
85
- 2. Test current code with Homebridge v2.0.0-beta.0
86
- 3. Complete comprehensive testing
87
- 4. Update documentation
88
-
89
- ## Risk Assessment Update
90
-
91
- ### ✅ Low Risk (Completed)
92
- - BatteryService rename: COMPLETED
93
- - Package.json updates: COMPLETED
94
-
95
- ### 🔄 Medium Risk (In Progress)
96
- - Storage path changes: Need more research
97
- - Characteristic enum updates: Appears already compliant
98
-
99
- ### ⚠️ High Risk (Pending)
100
- - Homebridge v2 API testing: Not yet tested
101
-
102
- ## Success Criteria Status
103
-
104
- - [x] Plugin installs and runs on Homebridge v2.0.0-beta.0 (package.json updated)
105
- - [ ] All device types function correctly (pending testing)
106
- - [ ] Authentication and token management work (pending testing)
107
- - [ ] Real-time updates via webhooks work (pending testing)
108
- - [ ] Polling functionality works (pending testing)
109
- - [ ] Backward compatibility with v1.x maintained (pending testing)
110
- - [ ] No performance regressions (pending testing)
111
-
112
- ## Notes
113
-
114
- - The codebase appears to be more compliant with HAP-NodeJS v1 than initially expected
115
- - Most breaking changes mentioned in the migration guide don't apply to this codebase
116
- - Main remaining work is storage path updates and comprehensive testing
117
- - Need to test with actual Homebridge v2.0.0-beta.0 to identify any API changes
@@ -1,182 +0,0 @@
1
- # Homebridge v2.0 Migration Summary
2
-
3
- ## Overview
4
- This document summarizes the work completed to prepare the SmartThings Homebridge plugin for Homebridge v2.0 compatibility. The migration focused on addressing breaking changes in HAP-NodeJS v1 and Homebridge v2 while maintaining all existing functionality.
5
-
6
- ## Migration Status: ✅ COMPLETED
7
-
8
- ### ✅ Completed Tasks
9
-
10
- #### 1. BatteryService to Battery Rename
11
- - **Status**: ✅ COMPLETED
12
- - **Changes**: Renamed `BatteryService` class to `Battery` to comply with HAP-NodeJS v1 changes
13
- - **Files Modified**:
14
- - `src/services/batteryService.ts`
15
- - `src/multiServiceAccessory.ts`
16
- - **Impact**: Low risk, simple refactoring
17
-
18
- #### 2. Characteristic Enum Access Patterns
19
- - **Status**: ✅ COMPLETED (No changes needed)
20
- - **Analysis**: Code already uses `this.platform.Characteristic` which is `this.api.hap.Characteristic`
21
- - **Compliance**: Already compliant with HAP-NodeJS v1 requirements
22
- - **Impact**: No changes required
23
-
24
- #### 3. Characteristic.getValue() Usage
25
- - **Status**: ✅ COMPLETED (No changes needed)
26
- - **Analysis**: No actual `Characteristic.getValue()` method calls found
27
- - **Compliance**: Already compliant with HAP-NodeJS v1 requirements
28
- - **Impact**: No changes required
29
-
30
- #### 4. Package.json Engines Update
31
- - **Status**: ✅ COMPLETED
32
- - **Changes**: Updated to support both v1.6.0+ and v2.0.0-beta.0+
33
- - **Files Modified**: `package.json`
34
- - **Impact**: Enables Homebridge v2.0-beta.0 support
35
-
36
- #### 5. Missing Method Implementation
37
- - **Status**: ✅ COMPLETED
38
- - **Changes**: Added `handleCrashLoopRecovery()` method to SmartThingsAuth class
39
- - **Files Modified**: `src/auth/auth.ts`
40
- - **Impact**: Fixed compilation error, improved crash recovery
41
-
42
- ## Key Findings
43
-
44
- ### ✅ Already Compliant Patterns
45
- 1. **Characteristic Enum Access**: Uses `this.platform.Characteristic` which is already `this.api.hap.Characteristic`
46
- 2. **No Deprecated Enum Usage**: No `Characteristic.Units`, `Characteristic.Formats`, or `Characteristic.Perms` found
47
- 3. **No getValue() Method Usage**: Only function parameters, not Characteristic methods
48
- 4. **Modern API Usage**: Already uses modern Homebridge API patterns
49
-
50
- ### 🔍 Areas That Don't Apply
51
- 1. **Storage Path Changes**: Current `this.api.user.storagePath()` usage is still functional
52
- 2. **Other Deprecated Methods**: No usage of `getServiceByUUIDAndSubType`, `updateReachability`, `setPrimaryService`
53
- 3. **Legacy Characteristics**: No deprecated Core or BridgedCore characteristics
54
-
55
- ## Technical Details
56
-
57
- ### Changes Made
58
-
59
- #### 1. BatteryService Rename
60
- ```typescript
61
- // Before
62
- export class BatteryService extends BaseService {
63
-
64
- // After
65
- export class Battery extends BaseService {
66
- ```
67
-
68
- #### 2. Package.json Engines
69
- ```json
70
- // Before
71
- "engines": {
72
- "node": ">=20.0.0",
73
- "homebridge": ">=1.3.5"
74
- }
75
-
76
- // After
77
- "engines": {
78
- "node": ">=20.0.0",
79
- "homebridge": "^1.6.0 || ^2.0.0-beta.0"
80
- }
81
- ```
82
-
83
- #### 3. Crash Loop Recovery Method
84
- ```typescript
85
- public async handleCrashLoopRecovery(): Promise<void> {
86
- this.log.warn('Handling crash loop recovery by clearing tokens and starting new auth flow.');
87
- try {
88
- await this.tokenManager.clearTokens();
89
- this.startAuthFlow();
90
- } catch (error) {
91
- this.log.error('Error during crash loop recovery:', error);
92
- this.startAuthFlow();
93
- }
94
- }
95
- ```
96
-
97
- ### Build and Quality Assurance
98
- - ✅ **TypeScript Compilation**: Successful
99
- - ✅ **ESLint**: Passed (minor line length warnings only)
100
- - ✅ **Code Quality**: Maintained
101
- - ✅ **Backward Compatibility**: Preserved
102
-
103
- ## Compatibility Status
104
-
105
- ### Homebridge v1.x
106
- - ✅ **Fully Compatible**: All existing functionality preserved
107
- - ✅ **No Breaking Changes**: Users can upgrade without issues
108
- - ✅ **Configuration**: Existing configs continue to work
109
-
110
- ### Homebridge v2.0.0-beta.0
111
- - ✅ **Package Support**: Engines field updated to support beta
112
- - ✅ **API Compatibility**: Uses modern API patterns
113
- - ✅ **HAP-NodeJS v1**: Compliant with all breaking changes
114
-
115
- ## Testing Recommendations
116
-
117
- ### Immediate Testing
118
- 1. **Installation Test**: Install plugin on Homebridge v2.0.0-beta.0
119
- 2. **Authentication Test**: Verify OAuth flow works
120
- 3. **Device Discovery**: Test device discovery and registration
121
- 4. **Real-time Updates**: Test webhook functionality
122
- 5. **Polling**: Test device status polling
123
-
124
- ### Device Type Testing
125
- - [ ] Switches
126
- - [ ] Lights (including color and dimming)
127
- - [ ] Thermostats
128
- - [ ] Locks
129
- - [ ] Sensors (motion, contact, temperature, humidity)
130
- - [ ] Window coverings
131
- - [ ] Valves
132
- - [ ] Battery-powered devices
133
-
134
- ### Performance Testing
135
- - [ ] Multiple device handling
136
- - [ ] Memory usage
137
- - [ ] Response times
138
- - [ ] Error handling
139
-
140
- ## Next Steps
141
-
142
- ### For Plugin Users
143
- 1. **Wait for Homebridge v2.0 Release**: Current beta support is ready
144
- 2. **Test with Beta**: Can test with v2.0.0-beta.0 if desired
145
- 3. **Monitor Updates**: Watch for any additional changes in final v2.0 release
146
-
147
- ### For Plugin Maintainers
148
- 1. **Monitor Homebridge v2.0 Development**: Watch for additional changes
149
- 2. **Test with Final Release**: Test with official v2.0.0 when released
150
- 3. **Update Documentation**: Update README and CHANGELOG when v2.0 is stable
151
- 4. **Remove Beta Support**: Remove `-beta.0` from engines when v2.0 is released
152
-
153
- ## Risk Assessment
154
-
155
- ### ✅ Low Risk (Completed)
156
- - BatteryService rename: Simple refactoring, well-tested
157
- - Package.json updates: Standard version update
158
- - Missing method: Added with proper error handling
159
-
160
- ### ⚠️ Medium Risk (Pending Testing)
161
- - Homebridge v2.0 API changes: Need testing with actual beta
162
- - Storage path usage: May need updates in future Homebridge versions
163
-
164
- ### 🔍 Areas to Monitor
165
- - Homebridge v2.0 final release changes
166
- - HAP-NodeJS updates
167
- - Storage API changes
168
-
169
- ## Conclusion
170
-
171
- The SmartThings Homebridge plugin has been successfully prepared for Homebridge v2.0 compatibility. The codebase was already largely compliant with HAP-NodeJS v1 requirements, requiring only minimal changes:
172
-
173
- 1. **BatteryService rename** (required)
174
- 2. **Package.json engines update** (required)
175
- 3. **Missing method implementation** (bug fix)
176
-
177
- The plugin maintains full backward compatibility with Homebridge v1.x while adding support for Homebridge v2.0.0-beta.0. The migration was completed with minimal risk and maximum compatibility preservation.
178
-
179
- **Status**: ✅ Ready for Homebridge v2.0 testing
180
- **Risk Level**: Low
181
- **Backward Compatibility**: ✅ Maintained
182
- **Forward Compatibility**: ✅ Added
@@ -1,297 +0,0 @@
1
- # Homebridge v2.0 Migration Tasks
2
-
3
- ## Task 1: Update BatteryService to Battery
4
- **Priority**: High
5
- **Estimated Time**: 30 minutes
6
- **Risk**: Low
7
-
8
- ### Steps:
9
- 1. Rename `BatteryService` class to `Battery` in `src/services/batteryService.ts`
10
- 2. Update class name in constructor and all references
11
- 3. Update import in `src/multiServiceAccessory.ts`
12
- 4. Update capability map entry in `MultiServiceAccessory.capabilityMap`
13
- 5. Test battery functionality with a device
14
-
15
- ### Files to Modify:
16
- - `src/services/batteryService.ts`
17
- - `src/multiServiceAccessory.ts`
18
-
19
- ---
20
-
21
- ## Task 2: Update Characteristic Enum Access Patterns
22
- **Priority**: High
23
- **Estimated Time**: 2-3 hours
24
- **Risk**: Medium
25
-
26
- ### Steps:
27
- 1. Audit all service files for `Characteristic.` enum usage
28
- 2. Replace with `api.hap.` namespace
29
- 3. Update platform constructor to expose `api.hap` to services
30
- 4. Test all device types after changes
31
-
32
- ### Files to Audit and Modify:
33
- - `src/services/airConditionerService.ts`
34
- - `src/services/batteryService.ts`
35
- - `src/services/carbonMonoxideDetector.ts`
36
- - `src/services/contactSensorService.ts`
37
- - `src/services/doorService.ts`
38
- - `src/services/fanSpeedService.ts`
39
- - `src/services/fanSwitchLevelService.ts`
40
- - `src/services/humidityService.ts`
41
- - `src/services/leakDetector.ts`
42
- - `src/services/lightSensorService.ts`
43
- - `src/services/lightService.ts`
44
- - `src/services/lockService.ts`
45
- - `src/services/motionService.ts`
46
- - `src/services/occupancySensorService.ts`
47
- - `src/services/sensorService.ts`
48
- - `src/services/smokeDetector.ts`
49
- - `src/services/statelessProgrammableSwitchService.ts`
50
- - `src/services/switchService.ts`
51
- - `src/services/temperatureService.ts`
52
- - `src/services/thermostatService.ts`
53
- - `src/services/valveService.ts`
54
- - `src/services/windowCoveringService.ts`
55
-
56
- ### Common Patterns to Replace:
57
- ```typescript
58
- // Old
59
- this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
60
- this.platform.Characteristic.TargetHeatingCoolingState.AUTO
61
-
62
- // New
63
- this.platform.api.hap.StatusLowBattery.BATTERY_LEVEL_LOW
64
- this.platform.api.hap.TargetHeatingCoolingState.AUTO
65
- ```
66
-
67
- ---
68
-
69
- ## Task 3: Fix Characteristic.getValue() Usage
70
- **Priority**: High
71
- **Estimated Time**: 1 hour
72
- **Risk**: Medium
73
-
74
- ### Steps:
75
- 1. Locate `getValue()` calls in codebase
76
- 2. Replace with `.value` property access
77
- 3. Test polling functionality
78
- 4. Verify no breaking changes in behavior
79
-
80
- ### Files to Modify:
81
- - `src/multiServiceAccessory.ts` (line 401)
82
- - `src/basePlatformAccessory.ts` (line 162)
83
-
84
- ### Pattern to Replace:
85
- ```typescript
86
- // Old
87
- getValue().then((v) => {
88
-
89
- // New
90
- .value.then((v) => {
91
- ```
92
-
93
- ---
94
-
95
- ## Task 4: Update Storage Path Usage
96
- **Priority**: Medium
97
- **Estimated Time**: 2 hours
98
- **Risk**: Medium
99
-
100
- ### Steps:
101
- 1. Import `HAPStorage` from homebridge
102
- 2. Replace `api.user.storagePath()` calls with `HAPStorage.setCustomStoragePath()`
103
- 3. Update all files using storage path
104
- 4. Test authentication persistence
105
- 5. Test crash loop manager storage
106
-
107
- ### Files to Modify:
108
- - `src/platform.ts`
109
- - `src/auth/tokenManager.ts`
110
- - `src/auth/CrashLoopManager.ts`
111
-
112
- ### Pattern to Replace:
113
- ```typescript
114
- // Old
115
- this.api.user.storagePath()
116
-
117
- // New
118
- HAPStorage.setCustomStoragePath()
119
- ```
120
-
121
- ---
122
-
123
- ## Task 5: Update Package.json Engines
124
- **Priority**: Low
125
- **Estimated Time**: 15 minutes
126
- **Risk**: Low
127
-
128
- ### Steps:
129
- 1. Update engines field in `package.json`
130
- 2. Add support for both v1.6.0+ and v2.0.0-beta.0+
131
- 3. Test package installation
132
-
133
- ### Files to Modify:
134
- - `package.json`
135
-
136
- ### New Engines Field:
137
- ```json
138
- "engines": {
139
- "node": ">=20.0.0",
140
- "homebridge": "^1.6.0 || ^2.0.0-beta.0"
141
- }
142
- ```
143
-
144
- ---
145
-
146
- ## Task 6: Platform Constructor Updates
147
- **Priority**: Medium
148
- **Estimated Time**: 1 hour
149
- **Risk**: Low
150
-
151
- ### Steps:
152
- 1. Update platform constructor to expose `api.hap` to services
153
- 2. Ensure all services have access to `api.hap` for enum access
154
- 3. Test service initialization
155
-
156
- ### Files to Modify:
157
- - `src/platform.ts`
158
- - `src/baseService.ts` (if needed)
159
-
160
- ---
161
-
162
- ## Task 7: Testing and Validation
163
- **Priority**: High
164
- **Estimated Time**: 4-6 hours
165
- **Risk**: Low
166
-
167
- ### Steps:
168
- 1. **Unit Testing**
169
- - Test each service individually
170
- - Verify enum access works correctly
171
- - Test battery service functionality
172
-
173
- 2. **Integration Testing**
174
- - Test device discovery
175
- - Test authentication flow
176
- - Test webhook functionality
177
- - Test polling mechanisms
178
-
179
- 3. **Device Testing**
180
- - Test all supported device types
181
- - Verify real-time updates work
182
- - Test command sending
183
- - Test error handling
184
-
185
- 4. **Performance Testing**
186
- - Test with multiple devices
187
- - Verify no memory leaks
188
- - Check response times
189
-
190
- 5. **Backward Compatibility**
191
- - Test with Homebridge v1.x
192
- - Verify upgrade scenarios
193
- - Test configuration migration
194
-
195
- ---
196
-
197
- ## Task 8: Documentation Updates
198
- **Priority**: Low
199
- **Estimated Time**: 1 hour
200
- **Risk**: Low
201
-
202
- ### Steps:
203
- 1. Update README.md with v2.0 support
204
- 2. Update CHANGELOG.md with migration notes
205
- 3. Add migration guide for users
206
- 4. Update any API documentation
207
-
208
- ### Files to Modify:
209
- - `README.md`
210
- - `CHANGELOG.md`
211
-
212
- ---
213
-
214
- ## Task 9: Final Validation
215
- **Priority**: High
216
- **Estimated Time**: 2 hours
217
- **Risk**: Low
218
-
219
- ### Steps:
220
- 1. **Code Review**
221
- - Review all changes for consistency
222
- - Check for any missed enum references
223
- - Verify error handling
224
-
225
- 2. **Build Testing**
226
- - Run full build process
227
- - Check for TypeScript errors
228
- - Verify linting passes
229
-
230
- 3. **Installation Testing**
231
- - Test fresh installation
232
- - Test upgrade from previous version
233
- - Test with both v1.x and v2.0-beta
234
-
235
- 4. **User Acceptance Testing**
236
- - Test with real SmartThings devices
237
- - Verify all functionality works as expected
238
- - Test edge cases and error scenarios
239
-
240
- ---
241
-
242
- ## Dependencies Between Tasks
243
-
244
- ```
245
- Task 1 (BatteryService) → Task 7 (Testing)
246
- Task 2 (Enum Access) → Task 6 (Platform Updates) → Task 7 (Testing)
247
- Task 3 (getValue) → Task 7 (Testing)
248
- Task 4 (Storage Path) → Task 7 (Testing)
249
- Task 5 (Package.json) → Task 7 (Testing)
250
- Task 6 (Platform Updates) → Task 7 (Testing)
251
- Task 7 (Testing) → Task 8 (Documentation)
252
- Task 8 (Documentation) → Task 9 (Final Validation)
253
- ```
254
-
255
- ## Success Criteria for Each Task
256
-
257
- ### Task 1-6: Implementation Tasks
258
- - [ ] Code compiles without errors
259
- - [ ] No TypeScript warnings
260
- - [ ] Linting passes
261
- - [ ] Basic functionality works
262
-
263
- ### Task 7: Testing
264
- - [ ] All device types tested
265
- - [ ] Authentication works
266
- - [ ] Real-time updates work
267
- - [ ] Polling works
268
- - [ ] Error handling works
269
- - [ ] Performance acceptable
270
-
271
- ### Task 8: Documentation
272
- - [ ] README updated
273
- - [ ] CHANGELOG updated
274
- - [ ] Migration guide created
275
-
276
- ### Task 9: Final Validation
277
- - [ ] All tests pass
278
- - [ ] Code review complete
279
- - [ ] Installation tested
280
- - [ ] User acceptance testing complete
281
-
282
- ## Rollback Plan for Each Task
283
-
284
- ### For Tasks 1-6:
285
- - Keep original code in git history
286
- - Use feature branches for each task
287
- - Test thoroughly before merging
288
-
289
- ### For Task 7:
290
- - If issues found, revert to previous working state
291
- - Fix issues in separate commits
292
- - Re-test after fixes
293
-
294
- ### For Tasks 8-9:
295
- - Update documentation to reflect current state
296
- - Mark any known issues
297
- - Plan follow-up fixes if needed
@@ -1,56 +0,0 @@
1
-
2
- For Plugin Developers
3
- ---------------------
4
-
5
- [](https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0#for-plugin-developers)
6
-
7
- ### `HAP-NodeJS v1`
8
-
9
- [](https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0#hap-nodejs-v1)
10
-
11
- You may need to change your plugins because of the breaking changes in HAP-NodeJS v1.
12
-
13
- To see the complete set of changes between `v0.12.3` and `v1.0.0`, see the [version file differences](https://github.com/homebridge/HAP-NodeJS/compare/v0.12.2...v1.0.0).
14
-
15
- - Common long-deprecated code patterns that may need updating:
16
- - `BatteryService` has been removed in favour of `Battery`
17
- - Use of enums off the `Characteristic` class is no longer supported:
18
- - Instead of `const Units = Characteristic.Units;` you will need to use `const Units = api.hap.Units;`
19
- - Instead of `const Formats = Characteristic.Formats;` you will need to use `const Formats = api.hap.Formats;`
20
- - Instead of `const Perms = Characteristic.Perms;` you will need to use `const Perms = api.hap.Perms;`
21
- - `Characteristic.getValue()` has been removed in favour of `Characteristic.value`
22
- - `Accessory.getServiceByUUIDAndSubType()` has been removed: you can swap this for `Accessory.getServiceById()`
23
- - `Accessory.updateReachability()` has been removed: reachability in general is no longer supported
24
- - `Accessory.setPrimaryService(Service)` has been removed: use `Service.setPrimaryService()` instead
25
- - Remove the long-deprecated init().
26
- - Deprecate Core, BridgedCore and legacy Camera characteristics
27
- - For deprecated Core and BridgedCore see: <https://github.com/homebridge/HAP-NodeJS/wiki/Deprecation-of-Core-and-BridgeCore>
28
- - For deprecated `storagePath` switch to `HAPStorage.setCustomStoragePath`
29
- - For `AudioCodec` switch to AudioStreamingCodec
30
- - For `VideoCodec` switch to H264CodecParameters
31
- - For `StreamAudioParams` switch to AudioStreamingOptions
32
- - For `StreamVideoParams` switch to VideoStreamingOptions
33
- - For `cameraSource` switch to `CameraController`
34
- - Other deprecated code to highlight removed: `useLegacyAdvertiser`, `AccessoryLoader`
35
- - For Fix: Naming for `Characteristic.ProgramMode` has been corrected from `PROGRAM_SCHEDULED_MANUAL_MODE_` to `PROGRAM_SCHEDULED_MANUAL_MODE`
36
-
37
- ### `Homebridge v2`
38
-
39
- [](https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0#homebridge-v2)
40
-
41
- You may need to change your plugins because of the breaking changes in Homebridge v2.
42
-
43
- Homebridge 2.0 is still in beta. To see the current changes between `v1.8.3` and `v2.0.0`, see the [version file differences](https://github.com/homebridge/homebridge/compare/latest...beta-2.0.0).
44
-
45
- Once you have tested your plugin(s) function correctly on Homebridge v2, you can update your `package.json`'s `engines.homebridge` value to show that your plugin is ready.
46
-
47
- ```source-json
48
- "engines": {
49
- "homebridge": "^1.6.0 || ^2.0.0-beta.0",
50
- "node": "^18.20.4 || ^20.15.1 || ^22"
51
- },
52
- ```
53
-
54
- Users will see a green tick in the readiness check in the UI once they have installed a version of your plugin with this in the `engines`.
55
-
56
- Once Homebridge v2 has been released, you can remove the `-beta.0` from the `homebridge` versions.