node-red-contrib-tplink-tapo-connect-api
Version:
This unofficial node-RED node allows connection to TP-Link Tapo devices. This project has been enhanced with AI support to enable new features. Starting with v0.50, we have added support for the KLAP protocol. To prioritize the operation of this node, we
58 lines • 1.82 kB
JavaScript
;
/**
* Common device type definitions for all Tapo devices
* Single responsibility: Device type classification and categorization
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.energyMonitoringModels = exports.deviceTypeToCategory = void 0;
exports.getDeviceCategory = getDeviceCategory;
exports.supportsEnergyMonitoring = supportsEnergyMonitoring;
exports.getDeviceTypesByCategory = getDeviceTypesByCategory;
exports.isKnownDeviceType = isKnownDeviceType;
/**
* Device type to category mapping
*/
exports.deviceTypeToCategory = {
P100: 'PLUG',
P105: 'PLUG',
P110: 'PLUG',
P110M: 'PLUG',
P115: 'PLUG',
L510: 'BULB',
L520: 'BULB',
L530: 'BULB',
UNKNOWN: 'UNKNOWN'
};
/**
* Device models that support energy monitoring
*/
exports.energyMonitoringModels = ['P110', 'P110M', 'P115'];
/**
* Get device category from device type
*/
function getDeviceCategory(deviceType) {
return exports.deviceTypeToCategory[deviceType];
}
// Note: supportsBrightnessControl and supportsColorControl are implemented in bulb.ts
// for device-specific logic and maintained here for backward compatibility if needed
/**
* Check if device supports energy monitoring
*/
function supportsEnergyMonitoring(deviceType) {
return exports.energyMonitoringModels.includes(deviceType);
}
/**
* Get all device types by category
*/
function getDeviceTypesByCategory(category) {
return Object.entries(exports.deviceTypeToCategory)
.filter(([_, deviceCategory]) => deviceCategory === category)
.map(([deviceType, _]) => deviceType);
}
/**
* Check if device type is known/supported
*/
function isKnownDeviceType(deviceType) {
return Object.keys(exports.deviceTypeToCategory).includes(deviceType);
}
//# sourceMappingURL=device-types.js.map