Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ export const DEVICE_CLASS_MAP: Record<string, string> = {
'Lock Lite': 'WoSmartLockLite',
'Lock Pro': 'WoSmartLockPro',
'Lock Pro WiFi': 'WoSmartLockProWiFi',
// OpenAPI deviceType names (SwitchBotAPI device pages)
'Smart Lock': 'WoSmartLock',
'Smart Lock Pro': 'WoSmartLockPro',
'Smart Lock Pro Wifi': 'WoSmartLockProWiFi',
'Smart Lock Ultra': 'WoSmartLockPro',
'Lock Vision': 'WoSmartLockVision',
'Lock Vision Pro': 'WoSmartLockVisionPro',
'Keypad': 'WoKeypad',
Expand All @@ -332,6 +337,7 @@ export const DEVICE_CLASS_MAP: Record<string, string> = {
'RGBICWW Floor Lamp': 'WoRGBICWWFloorLamp',
'SwitchBot RGBICWW Floor Lamp': 'WoRGBICWWFloorLamp',
'Art Frame': 'WoArtFrame',
'AI Art Frame': 'WoArtFrame',
'SwitchBot Art Frame': 'WoArtFrame',
// S1 and S1 Plus use the original start/stop/dock OpenAPI commands, unlike the S10/S20
'Robot Vacuum Cleaner S1': 'WoVacuum',
Expand Down Expand Up @@ -359,17 +365,25 @@ export const DEVICE_CLASS_MAP: Record<string, string> = {
'WoLinkMatter': 'WoHubMiniMatter',
'SwitchBot HubMini Matter': 'WoHubMiniMatter',
'Hub Plus': 'WoHub2',
'Hub': 'WoHub2',
'Remote': 'WoRemote',
'Battery Circulator Fan': 'WoCirculatorFan',
'Circulator Fan': 'WoCirculatorFan',
'Battery Circulator Fan 2 Pro': 'WoCirculatorFan',
'Standing Fan': 'WoCirculatorFan',
'USB Circulator Fan': 'WoCirculatorFan',
'Smart Thermostat Radiator': 'WoSmartThermostatRadiator',
'Smart Radiator Thermostat': 'WoSmartThermostatRadiator',
'Thermostat Radiator': 'WoSmartThermostatRadiator',
'Radiator Thermostat': 'WoSmartThermostatRadiator',
'Climate Panel': 'WoClimatePanel',
'Home Climate Panel': 'WoClimatePanel',
'Smart Climate Panel': 'WoClimatePanel',
'Air Purifier': 'WoAirPurifier',
'Air Purifier Table': 'WoAirPurifierTable',
'Air Purifier VOC': 'WoAirPurifier',
'Air Purifier Table PM2.5': 'WoAirPurifierTable',
'Air Purifier Table VOC': 'WoAirPurifierTable',
'Water Leak Detector': 'WoLeak',
'Presence Sensor': 'WoPresence',
'Relay Switch 1PM': 'WoRelaySwitch1PM',
Expand All @@ -383,6 +397,7 @@ export const DEVICE_CLASS_MAP: Record<string, string> = {
'K10+': 'WoVacuumK10Plus',
'K10+ Pro': 'WoVacuumK10Pro',
'RGBIC Neon Wire Rope Light': 'WoRGBICNeonWireRopeLight',
'RGBIC Neon Rope Light': 'WoRGBICNeonWireRopeLight',
'Candle Warmer Lamp': 'WoCandleWarmerLamp',
'Pan/Tilt Cam Plus 3K': 'WoPanTiltCamPlus3K',
'remote with screen': 'WoRemoteWithScreen',
Expand Down
23 changes: 23 additions & 0 deletions test/types/device-type-resolution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,26 @@ describe('resolveDeviceClassName', () => {
}
})
})

// OpenAPI deviceType values from the SwitchBotAPI device pages. These had no class, so the
// device was never created for OpenAPI users (every lock, for example).
describe('openAPI deviceType names', () => {
it.each([
['Smart Lock', 'WoSmartLock'],
['Smart Lock Pro', 'WoSmartLockPro'],
['Smart Lock Pro Wifi', 'WoSmartLockProWiFi'],
['Smart Lock Ultra', 'WoSmartLockPro'],
['Air Purifier VOC', 'WoAirPurifier'],
['Air Purifier Table PM2.5', 'WoAirPurifierTable'],
['Air Purifier Table VOC', 'WoAirPurifierTable'],
['Smart Radiator Thermostat', 'WoSmartThermostatRadiator'],
['Home Climate Panel', 'WoClimatePanel'],
['Standing Fan', 'WoCirculatorFan'],
['Battery Circulator Fan 2 Pro', 'WoCirculatorFan'],
['RGBIC Neon Rope Light', 'WoRGBICNeonWireRopeLight'],
['AI Art Frame', 'WoArtFrame'],
['Hub', 'WoHub2'],
])('resolves %s', (apiType, className) => {
expect(resolveDeviceClassName(apiType)).toBe(className)
})
})
Loading