Quick Question: Room-Based Device Organization
Hi! I'm building a KNX plugin and need to organize devices by room. What's the best approach?
What I Want to Achieve
KNX Plugin
├── Living Room (container/aggregator)
│ ├── Light
│ ├── Outlet
│ └── Blind
├── Bedroom (container/aggregator)
│ ├── Light
│ └── Sensor
└── Kitchen (container/aggregator)
├── Light
└── Blind
Use Case:
- Users create rooms via web dashboard
- Devices are assigned to rooms
- Need rooms visible in Matter topology (Apple Home, etc.)
- Rooms can be created dynamically at runtime
Specific Questions
1. What device type for room containers?
aggregator?
bridgedNode?
- Something else?
2. How to add child devices to room containers?
const roomAggregator = new MatterbridgeEndpoint(aggregator, {...});
await this.registerDevice(roomAggregator);
// Now what? How do I add devices as children?
const light = new MatterbridgeEndpoint(onOffLight, {...});
roomAggregator.??? // What method?
3. Can I create aggregators dynamically after onStart()?
// User clicks "Add Room" in UI
async createRoom(roomName: string) {
const aggregator = new MatterbridgeEndpoint(aggregator, {...});
await this.registerDevice(aggregator); // Safe to call here?
}
4. TypeScript imports?
// This gives error: "Module 'matterbridge' has no exported member 'aggregator'"
import { aggregator } from 'matterbridge';
// Should it be?
import { aggregator } from 'matterbridge/matterbridgeDeviceTypes';
What I've Tried
export class KnxPlatform extends MatterbridgeDynamicPlatform {
private roomAggregators: Map<string, MatterbridgeEndpoint> = new Map();
async onStart() {
// Load rooms from JSON
const rooms = [{id: '1', name: 'Living Room'}, ...];
// Create aggregator per room
for (const room of rooms) {
const agg = new MatterbridgeEndpoint(aggregator, {
uniqueId: `room-${room.id}`
});
await this.registerDevice(agg);
this.roomAggregators.set(room.id, agg);
}
// Create devices - but how to attach to room aggregator?
for (const device of devices) {
const dev = new MatterbridgeEndpoint(onOffLight, {...});
// ??? How to make `dev` a child of room aggregator?
}
}
}
Result: TypeScript errors, unclear how to establish parent-child relationship
Context
- Plugin Type:
MatterbridgeDynamicPlatform
- Matterbridge Version: 3.3.0+
- Scale: ~15 rooms, ~100 devices
- Data Storage: JSON file with room-to-device mappings
Is There an Example?
Is there an existing plugin that does hierarchical grouping I can reference? I've looked at Shelly and Zigbee2MQTT but they register devices flat.
Any guidance appreciated! Happy to test approaches or provide more details.
Quick Question: Room-Based Device Organization
Hi! I'm building a KNX plugin and need to organize devices by room. What's the best approach?
What I Want to Achieve
Use Case:
Specific Questions
1. What device type for room containers?
aggregator?bridgedNode?2. How to add child devices to room containers?
3. Can I create aggregators dynamically after onStart()?
4. TypeScript imports?
What I've Tried
Result: TypeScript errors, unclear how to establish parent-child relationship
Context
MatterbridgeDynamicPlatformIs There an Example?
Is there an existing plugin that does hierarchical grouping I can reference? I've looked at Shelly and Zigbee2MQTT but they register devices flat.
Any guidance appreciated! Happy to test approaches or provide more details.