3.0.0-beta2

* Implement basic template model
* Generic device can specify template in devices.conf
* Simple switch, dimmer, and RGBTW specific support files
This commit is contained in:
tsightler
2020-10-02 23:16:53 -04:00
parent 56b87aa27e
commit f598d246cf
11 changed files with 750 additions and 989 deletions

24
lib/utils.js Normal file
View File

@@ -0,0 +1,24 @@
class Utils
{
// Check if data is JSON or not
isJsonString(data) {
try {
const parsedData = JSON.parse(data)
if (parsedData && typeof parsedData === "object") {
return parsedData
}
}
catch (e) { }
return false
}
// Simple sleep function for various required delays
sleep(sec) {
return new Promise(res => setTimeout(res, sec*1000))
}
}
module.exports = new Utils()