UNPKG

node-mihome

Version:

Control Mi Home devices, such as Mi Robot Vacuums, Mi Air Purifiers, Mi Smart Home Gateway (Aqara) and more

13 lines (11 loc) 323 B
const models = require('./models'); module.exports = function createDevice(options) { if (!options.model) { throw new Error('Missing model config'); } if (!models[options.model]) { throw new Error(`Model ${options.model} is not supported`); } const D = models[options.model]; return new D(options); };