Skip to content

Commit 66766c6

Browse files
authored
Add Matter support via publishMatterAccessories API with external accessories compatibility (#186)
1 parent 430ee7e commit 66766c6

14 files changed

+646
-101
lines changed

.changeset/evil-impalas-juggle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@homebridge-plugins/homebridge-roomba": minor
3+
---
4+
5+
Add external accessories support for Matter compatibility

.changeset/stale-paths-open.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@homebridge-plugins/homebridge-roomba": patch
3+
---
4+
5+
Add accessory category configuration option and document iOS 18 vacuum support limitations

.github/copilot-instructions.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,68 @@ Homebridge plugin for iRobot Roomba vacuum cleaners. This is a TypeScript-based
44

55
Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
66

7+
## PR Workflow and Beta Branch Requirements
8+
9+
### Branch Targeting Strategy
10+
**ALL PULL REQUESTS MUST TARGET A BETA BRANCH FIRST** - never target the `latest` branch directly.
11+
12+
1. **Check for existing beta branch**: Look for branches starting with `beta-` (e.g., `beta-2.1.1`, `beta-2.2.0`)
13+
2. **If no beta branch exists**: Create one based on the next possible version according to semantic versioning
14+
3. **Target the beta branch**: Always target your PR to the appropriate beta branch
15+
16+
### Version Label Requirements
17+
**CRITICAL**: Before assigning any issue to Copilot, one of these labels MUST be set to determine the version increment:
18+
19+
- **`patch`** - For bug fixes (2.1.0 → 2.1.1)
20+
- **`minor`** - For new features (2.1.0 → 2.2.0)
21+
- **`major`** - For breaking changes (2.1.0 → 3.0.0)
22+
23+
**No work should begin without the appropriate version label being assigned first.**
24+
25+
### Beta Branch Creation Process
26+
If no appropriate beta branch exists:
27+
28+
1. **For patch changes**: Create `beta-X.Y.Z+1` (e.g., if current is 2.1.0, create `beta-2.1.1`)
29+
2. **For minor changes**: Create `beta-X.Y+1.0` (e.g., if current is 2.1.0, create `beta-2.2.0`)
30+
3. **For major changes**: Create `beta-X+1.0.0` (e.g., if current is 2.1.0, create `beta-3.0.0`)
31+
32+
```bash
33+
# Example: Creating a beta branch for a minor feature
34+
git checkout latest
35+
git pull origin latest
36+
git checkout -b beta-2.2.0
37+
git push origin beta-2.2.0
38+
```
39+
40+
**Current State**: As of this writing, the current release is 2.1.0 and there is an existing `beta-2.1.1` branch for patch releases.
41+
42+
### Examples of Branch Targeting
43+
- **Bug fix (patch label)** → Target `beta-2.1.1` (if exists) or create it
44+
- **New feature (minor label)** → Target `beta-2.2.0` (create if needed)
45+
- **Breaking change (major label)** → Target `beta-3.0.0` (create if needed)
46+
47+
### Workflow Summary
48+
1. ✅ Check issue has `patch`, `minor`, or `major` label assigned
49+
2. ✅ Identify or create appropriate beta branch
50+
3. ✅ Target PR to beta branch (not `latest`)
51+
4. ✅ Follow normal development workflow below
52+
5. ✅ Use changesets to document your changes (see Publishing Workflow section)
53+
54+
### Integration with Changesets
55+
This project uses [Changesets](https://github.com/changesets/changesets) for version management. When making changes:
56+
57+
1. **Create a changeset** describing your change:
58+
```bash
59+
npm exec changeset
60+
```
61+
2. **Select the change type** that matches your issue label:
62+
- Patch → patch (bug fixes)
63+
- Minor → minor (new features)
64+
- Major → major (breaking changes)
65+
3. **Commit the changeset file** as part of your PR
66+
67+
The changeset type should align with the issue label that was set before assignment.
68+
769
## Working Effectively
870

971
### Bootstrap and Build Process
@@ -34,8 +96,18 @@ Key build commands with validated timings:
3496
- `npm run docs:theme` - Generate docs with default-modern theme
3597

3698
### Publishing Workflow
99+
100+
This project uses Changesets for version management and release automation:
101+
102+
- `npm exec changeset` - Create a changeset describing your changes (do this for each PR)
103+
- `npm exec changeset version` - Update package.json and CHANGELOG.md (maintainer only)
104+
- `npm exec changeset publish` - Publish to npm (maintainer only)
37105
- `npm run prepublishOnly` - Complete CI workflow: lint + build + docs. Takes ~15 seconds. NEVER CANCEL. Set timeout to 60+ seconds.
38106

107+
**For Contributors**: Always create a changeset when making changes. The type (patch/minor/major) should match the issue label.
108+
109+
**Beta Release Process**: Beta versions are automatically published from beta branches. When a beta branch is ready, it gets merged to `latest` for stable release.
110+
39111
## Validation
40112

41113
### Manual Testing Requirements

EXTERNAL_ACCESSORIES.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# External Accessories and Matter Support
2+
3+
This plugin now supports publishing each Roomba as an external accessory with automatic Matter compatibility detection. When using Homebridge 2.0.0-alpha.28 or later, the plugin will automatically use the new `publishMatterAccessories` API for enhanced Matter support.
4+
5+
## What are External Accessories?
6+
7+
**Platform Accessories** (default behavior):
8+
- All Roomba devices appear under a single "Roomba" bridge
9+
- Devices are grouped together in the Home app
10+
- Traditional Homebridge plugin behavior
11+
12+
**External Accessories** (new feature):
13+
- Each Roomba appears as a separate, independent device in HomeKit
14+
- Automatic Matter protocol support when available (Homebridge alpha.28+)
15+
- Better compatibility with Matter bridging protocols
16+
- Future-proof for advanced HomeKit/Matter features
17+
18+
## Configuration
19+
20+
Add the `externalAccessories` option to your platform configuration:
21+
22+
```json
23+
{
24+
"platform": "Roomba",
25+
"name": "Roomba",
26+
"email": "[email protected]",
27+
"password": "your-password",
28+
"externalAccessories": true
29+
}
30+
```
31+
32+
## Matter Support Detection
33+
34+
The plugin automatically detects and uses the best available API:
35+
36+
- **Homebridge 2.0.0-alpha.28+**: Uses `publishMatterAccessories` for native Matter protocol support
37+
- **Older versions**: Falls back to `publishExternalAccessories` for standard external accessory behavior
38+
39+
This ensures compatibility across all supported Homebridge versions while providing Matter support when available.
40+
41+
## Benefits of External Accessories
42+
43+
### Matter Compatibility
44+
- **Automatic Matter support** when using Homebridge alpha versions with Matter capabilities
45+
- Each device can be individually exposed to Matter networks
46+
- Better integration with Thread/Matter ecosystems
47+
- Prepares for future Matter protocol enhancements
48+
49+
### Individual Device Management
50+
- Each Roomba appears as a separate tile in the Home app
51+
- Independent device management and troubleshooting
52+
- Cleaner organization in larger smart home setups
53+
54+
### Enhanced Reliability
55+
- If one Roomba has connectivity issues, it doesn't affect others
56+
- Individual device restarts and management
57+
- Reduced dependency on the main bridge
58+
59+
## Migration Notes
60+
61+
### Switching from Platform to External Accessories
62+
1. **Backup your current setup** - Export your Home app configuration
63+
2. **Update plugin configuration** - Add `"externalAccessories": true`
64+
3. **Restart Homebridge** - The devices will appear as new accessories
65+
4. **Re-add to Home app** - You'll need to scan the new QR codes
66+
5. **Reconfigure automations** - Update any scenes/automations using the old accessories
67+
68+
### Important Considerations
69+
- External accessories require individual pairing in the Home app
70+
- Each external accessory has its own HomeKit pairing code
71+
- Switching modes will require re-pairing all devices
72+
- Existing automations and scenes will need to be recreated
73+
74+
## Matter Support Preparation
75+
76+
This feature prepares your Roomba devices for future Matter support:
77+
78+
### Current Status
79+
- **HomeKit HAP**: Full support with external accessories
80+
- **Matter**: Ready for future Homebridge Matter implementation
81+
- **iOS 18 Vacuum Features**: Matter-only (not available in HomeKit HAP)
82+
83+
### Future Roadmap
84+
When Homebridge adds full Matter support:
85+
- External accessories will be easier to bridge to Matter
86+
- Individual device control via Matter controllers
87+
- Enhanced iOS 18 vacuum features when bridged to Matter
88+
89+
## Troubleshooting
90+
91+
### Accessories Not Appearing
92+
1. Check Homebridge logs for errors
93+
2. Ensure `externalAccessories: true` is set
94+
3. Restart Homebridge completely
95+
4. Check QR codes in Homebridge UI
96+
97+
### Re-pairing Issues
98+
1. Reset HomeKit database if needed: `homebridge-config-ui-x > Settings > Reset Accessory Cache`
99+
2. Clear iOS Home app cache: Remove and re-add the Home
100+
3. Check Homebridge logs for pairing errors
101+
102+
### Performance Considerations
103+
- External accessories may use slightly more system resources
104+
- Each device maintains its own connection state
105+
- Monitor Homebridge performance if you have many devices
106+
107+
## Advanced Configuration
108+
109+
You can combine external accessories with other plugin features:
110+
111+
```json
112+
{
113+
"platform": "Roomba",
114+
"name": "Roomba",
115+
"email": "[email protected]",
116+
"password": "your-password",
117+
"externalAccessories": true,
118+
"devices": [
119+
{
120+
"name": "Kitchen Roomba",
121+
"blid": "your-blid",
122+
"robotpwd": "your-password",
123+
"ipaddress": "192.168.1.100",
124+
"accessoryCategory": "switch",
125+
"dockContactSensor": true,
126+
"runningContactSensor": true
127+
}
128+
]
129+
}
130+
```
131+
132+
## Related Documentation
133+
134+
- [Main README](./README.md) - General plugin setup and configuration
135+
- [iOS 18 Vacuum Support](./iOS18_VACUUM_SUPPORT.md) - Matter vs HomeKit vacuum limitations
136+
- [Homebridge External Accessories Documentation](https://developers.homebridge.io/#/api/platform-accessories?id=external-accessories)

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,31 @@ Here is example JSON for configuring a Roomba accessory:
114114
| `user_pmapv_id` | The version id of your map in the iRobot app (contains Date and Time last modified) | |
115115
| `stopBehaviour` | Roomba can go home or pause when stopped | `home` |
116116

117+
### External Accessories & Matter Support
118+
119+
This plugin supports **External Accessories** mode, which publishes each Roomba as a separate HomeKit device instead of grouping them under a bridge. This feature provides:
120+
121+
- **Automatic Matter Support**: Uses `publishMatterAccessories` API when available (Homebridge 2.0.0-alpha.28+)
122+
- **Individual Device Management**: Each Roomba appears as a separate tile in the Home app
123+
- **Enhanced Reliability**: Independent device management and troubleshooting
124+
- **Future-Proof**: Ready for Matter protocol expansion
125+
126+
To enable external accessories, add `"externalAccessories": true` to your platform configuration:
127+
128+
```json
129+
{
130+
"platform": "Roomba",
131+
"name": "Roomba",
132+
"email": "[email protected]",
133+
"password": "your-password",
134+
"externalAccessories": true
135+
}
136+
```
137+
138+
**Important**: Switching to external accessories requires re-pairing all devices and recreating scenes/automations.
139+
140+
📖 For detailed information, see [External Accessories Documentation](./EXTERNAL_ACCESSORIES.md)
141+
117142
### Cleaning Mission configuration
118143

119144
This plugin can instruct the Roomba to clean everywhere or go on a specific cleaning job when started. Follow these steps to get the mission configuration values from the iRobot app.

config.schema.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@
3939
"description": "Disable automatic discovery of Roomba devices. If you have multiple Roomba devices, you can disable discovery and manually configure each device.",
4040
"required": false
4141
},
42+
"externalAccessories": {
43+
"type": "boolean",
44+
"title": "External Accessories",
45+
"description": "Publish each Roomba as an external accessory instead of platform accessories. External accessories appear as separate devices in HomeKit and support Matter bridging.",
46+
"required": false,
47+
"default": false
48+
},
4249
"devices": {
4350
"type": "array",
4451
"items": {
@@ -232,6 +239,33 @@
232239
"title": "Idle Poll Interval (minutes)",
233240
"description": "How often to poll Roomba's status when it is idle. Defaults to 15 minutes.",
234241
"required": false
242+
},
243+
"accessoryCategory": {
244+
"type": "string",
245+
"title": "HomeKit Accessory Category",
246+
"description": "Note: iOS 18 vacuum support is Matter-only, not HomeKit HAP. This setting only affects the accessory icon.",
247+
"default": "other",
248+
"required": false,
249+
"oneOf": [
250+
{
251+
"title": "Other (Generic)",
252+
"enum": [
253+
"other"
254+
]
255+
},
256+
{
257+
"title": "Switch",
258+
"enum": [
259+
"switch"
260+
]
261+
},
262+
{
263+
"title": "Sensor",
264+
"enum": [
265+
"sensor"
266+
]
267+
}
268+
]
235269
}
236270
}
237271
}

0 commit comments

Comments
 (0)