107 lines
2.4 KiB
TypeScript
107 lines
2.4 KiB
TypeScript
export interface DeviceCategoryConfig {
|
|
devices: string[];
|
|
defaultDevice: string;
|
|
}
|
|
|
|
export const DEVICE_CONFIG: Record<string, DeviceCategoryConfig> = {
|
|
bot: {
|
|
devices: ['Bot 0F'],
|
|
defaultDevice: 'Bot 0F',
|
|
},
|
|
camera: {
|
|
devices: ['摄像机Plus 3K'],
|
|
defaultDevice: '摄像机Plus 3K',
|
|
},
|
|
osc: {
|
|
devices: ['OSC 2K'],
|
|
defaultDevice: 'OSC 2K',
|
|
},
|
|
curtain: {
|
|
devices: ['Curtain 1A', 'Curtain3 2B', 'BlindTilt 3C'],
|
|
defaultDevice: 'Curtain 1A',
|
|
},
|
|
plug: {
|
|
devices: ['Plug 4D', 'PlugMini 5E'],
|
|
defaultDevice: 'Plug 4D',
|
|
},
|
|
lock: {
|
|
devices: ['Lock 6F', 'LockPro 7G'],
|
|
defaultDevice: 'Lock 6F',
|
|
},
|
|
hub: {
|
|
devices: ['Hub2 8H', 'HubMini 9I', 'HubMiniMatter 0J'],
|
|
defaultDevice: 'Hub2 8H',
|
|
},
|
|
humidifier: {
|
|
devices: ['Humidifier 1K', 'Humidifier2 2L'],
|
|
defaultDevice: 'Humidifier 1K',
|
|
},
|
|
meter: {
|
|
devices: ['Meter 3M', 'Outdoor Meter 4N'],
|
|
defaultDevice: 'Meter 3M',
|
|
},
|
|
sensor: {
|
|
devices: ['Contact Sensor 5O', 'Motion Sensor 6P'],
|
|
defaultDevice: 'Contact Sensor 5O',
|
|
},
|
|
ceilingLight: {
|
|
devices: ['CeilingLight 7Q'],
|
|
defaultDevice: 'CeilingLight 7Q',
|
|
},
|
|
colorBulb: {
|
|
devices: ['ColorBulb 8R'],
|
|
defaultDevice: 'ColorBulb 8R',
|
|
},
|
|
stripLight: {
|
|
devices: ['StripLight 9S'],
|
|
defaultDevice: 'StripLight 9S',
|
|
},
|
|
fan: {
|
|
devices: ['Fan 0T'],
|
|
defaultDevice: 'Fan 0T',
|
|
},
|
|
waterDetector: {
|
|
devices: ['WaterDetector 1U'],
|
|
defaultDevice: 'WaterDetector 1U',
|
|
},
|
|
keypad: {
|
|
devices: ['Keypad 2V'],
|
|
defaultDevice: 'Keypad 2V',
|
|
},
|
|
remote: {
|
|
devices: ['Remote 3W'],
|
|
defaultDevice: 'Remote 3W',
|
|
},
|
|
airCondition: {
|
|
devices: ['AirCondition IR'],
|
|
defaultDevice: 'AirCondition IR',
|
|
},
|
|
findCard: {
|
|
devices: ['FindCard 4X'],
|
|
defaultDevice: 'FindCard 4X',
|
|
},
|
|
urc: {
|
|
devices: ['URC 5Y'],
|
|
defaultDevice: 'URC 5Y',
|
|
},
|
|
robot: {
|
|
devices: ['Robot S1', 'Robot S1P', 'Robot K10+', 'Robot S10'],
|
|
defaultDevice: 'Robot S1',
|
|
},
|
|
aihub: {
|
|
devices: ['AI Hub 6C'],
|
|
defaultDevice: 'AI Hub 6C',
|
|
},
|
|
aihubshow: {
|
|
devices: ['AI Hub Show'],
|
|
defaultDevice: 'AI Hub Show',
|
|
},
|
|
};
|
|
|
|
export function getDeviceName(category: string, envVar?: string): string {
|
|
if (envVar && process.env[envVar]) {
|
|
return process.env[envVar]!;
|
|
}
|
|
return DEVICE_CONFIG[category]?.defaultDevice || category;
|
|
}
|