initial commit
This commit is contained in:
19
helpers/Logger.js
Normal file
19
helpers/Logger.js
Normal file
@@ -0,0 +1,19 @@
|
||||
class Logger {
|
||||
constructor(name) {
|
||||
this.name = name
|
||||
}
|
||||
|
||||
info(...message) {
|
||||
console.info(`[${this.name}]`, message)
|
||||
}
|
||||
|
||||
error(...message) {
|
||||
console.error(`[${this.name}]`, message)
|
||||
}
|
||||
|
||||
debug(...message) {
|
||||
console.debug(`[${this.name}]`, message)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Logger
|
||||
14
helpers/UIClassFactory.js
Normal file
14
helpers/UIClassFactory.js
Normal file
@@ -0,0 +1,14 @@
|
||||
class UIClassFactory {
|
||||
getEntityClass = function (entity_id) {
|
||||
const [domain] = entity_id.split(".");
|
||||
|
||||
switch (domain) {
|
||||
case "light":
|
||||
return Light;
|
||||
case "switch":
|
||||
return Switch;
|
||||
default:
|
||||
return Unsupported;
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user