kasa-smart-hub
Version:
Virtual Smart Hub for TP-Link Kasa Smart Home
19 lines (17 loc) • 475 B
JavaScript
import fs from 'smart-fs';
import Hub from '../module/hub.js';
export default {
command: 'start [configFile]',
desc: 'Start server.',
builder: {},
handler: async ({ configFile = 'config' }) => {
const filepath = fs.guessFile(configFile);
if (!fs.existsSync(filepath)) {
throw new Error('Configuration file not found...');
}
const config = await fs.smartRead(filepath);
const hub = Hub(config);
await hub.start();
return hub;
}
};