removed merge-options as well as useless characteristics parameter, added readme
This commit is contained in:
parent
7dfa195cd1
commit
cf4e9aaf76
@ -6,21 +6,6 @@ const {
|
||||
const { Control } = require('magic-home');
|
||||
const mergeOptions = require('merge-options');
|
||||
|
||||
const types = Object.freeze({
|
||||
type1: {
|
||||
rgb_min_0: true,
|
||||
ww_min_0: true,
|
||||
set_color_magic_bytes: [0xf0, 0x0f],
|
||||
wait_for_reply: true
|
||||
},
|
||||
type2: {
|
||||
rgb_min_0: false,
|
||||
ww_min_0: false,
|
||||
set_color_magic_bytes: [0x00, 0x0f],
|
||||
wait_for_reply: false
|
||||
},
|
||||
});
|
||||
|
||||
class HCMagicHome extends HCColorLamp {
|
||||
constructor(config) {
|
||||
super(config);
|
||||
@ -29,16 +14,12 @@ class HCMagicHome extends HCColorLamp {
|
||||
throw new Error(`Required configuration field "address" is missing"`);
|
||||
}
|
||||
|
||||
let type = "type1";
|
||||
if (this._configuration.type != undefined) {
|
||||
type = this._configuration.type;
|
||||
}
|
||||
let opts = {
|
||||
wait_for_reply: (this._configuration.reply !== undefined) ? this._configuration.reply : false,
|
||||
log_all_received: (this._configuration.logall !== undefined) ? this._configuration.logall : false,
|
||||
};
|
||||
|
||||
if (!(type in types)) throw new Error(`Type "${type}" could not be found`);
|
||||
|
||||
let characteristics = mergeOptions(types[type], this._configuration.characteristics);
|
||||
|
||||
this._control = new Control(this._configuration.address, characteristics);
|
||||
this._control = new Control(this._configuration.address, opts);
|
||||
|
||||
this._sumanager = new StateUpdateManager(this._state);
|
||||
}
|
||||
|
||||
6
README.md
Normal file
6
README.md
Normal file
@ -0,0 +1,6 @@
|
||||
## Configuration
|
||||
|
||||
- `reply`
|
||||
Sets `wait_for_reply` in the constructor.
|
||||
- `logall`
|
||||
Sets `log_all_received` in the constructor.
|
||||
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hc-magichome",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"homecontrol-control-base": "git+https://git.literalchaos.de/jan/homecontrol-control-base.git",
|
||||
"magic-home": "^2.0.1",
|
||||
"merge-options": "^1.0.1"
|
||||
"magic-home": "^2.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user