Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Devices and new Properties for two Devices #34

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/devices/deerma.humidifier.jsq.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const Device = require('../device-miio');
module.exports = class extends Device {

static model = 'deerma.humidifier.jsq';
static name = 'Mi Smart Antibacterial Humidifier';
static image = 'https://cdn.awsde0.fds.api.mi-img.com/miio.files/developer_1584598944z7vf4g16.png';
static name = 'Smartmi Evaporative Humidifier';
static image = 'http://static.home.mi.com/app/image/get/file/developer_1543307568u9wu6wij.png';

constructor(opts) {
super(opts);
Expand Down Expand Up @@ -116,4 +116,4 @@ module.exports = class extends Device {
return Promise.reject(new Error(`Invalid mode: ${v}`));
}

};
};
62 changes: 62 additions & 0 deletions lib/devices/dmaker.fan.1c.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const Device = require('../device-miio');

module.exports = class extends Device {

static model = 'dmaker.fan.1c';
static name = 'Mi Smart Standing Fan 1C';
static image = 'http://static.home.mi.com/app/image/get/file/developer_1541408255kg3xtr1j.png';

constructor(opts) {
super(opts);

this._miotSpecType = 'urn:miot-spec-v2:device:fan:0000A005:dmaker-1c:1';
this._propertiesToMonitor = [
'fan:on',
'fan:mode',
'fan:fan-level',
'fan:horizontal-swing',
'fan:brightness',
'fan:alarm',
'physical-controls-locked:physical-controls-locked',
'fan:off-delay-time'
];
}

getPower() {
return this.properties['fan:on'];
}

setPower(v) {
return this.miotSetProperty('fan:on', v);
}

setMode(v) {
return this.miotSetProperty('fan:mode', v);
}

setFanLevel(v) {
return this.miotSetProperty('fan:fan-level', v);
}

setHorizontalSwing(v) {
return this.miotSetProperty('fan:horizontal-swing', v);
}

setBrightness(v) {
return this.miotSetProperty('fan:brightness', v);
}

setAlarm(v) {
return this.miotSetProperty('fan:alarm', v);
}


setChildLock(v) {
return this.miotSetProperty('physical-controls-locked:physical-controls-locked', v);
}

setOffDelayTime(v) {
return this.miotSetProperty('fan:off-delay-time', v);
}

};
72 changes: 72 additions & 0 deletions lib/devices/dmaker.fan.p15.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
const Device = require('../device-miio');

module.exports = class extends Device {

static model = 'dmaker.fan.p15';
static name = 'Mi Smart Standing Fan Pro';
static image = 'http://static.home.mi.com/app/image/get/file/developer_1541408255kg3xtr1j.png';

constructor(opts) {
super(opts);

this._miotSpecType = 'urn:miot-spec-v2:device:fan:0000A005:dmaker-p15:1';
this._propertiesToMonitor = [
'fan:on',
'fan:mode',
'fan:fan-level',
'fan:horizontal-swing',
'fan:horizontal-angle',
'fan:status',
'indicator-light:on',
'alarm:alarm',
'motor-controller:motor-control',
'physical-controls-locked:physical-controls-locked',
'off-delay-time:off-delay-time'
];
}

getPower() {
return this.properties['fan:on'];
}

setPower(v) {
return this.miotSetProperty('fan:on', v);
}

setMode(v) {
return this.miotSetProperty('fan:mode', v);
}

setFanLevel(v) {
return this.miotSetProperty('fan:fan-level', v);
}

setHorizontalSwing(v) {
return this.miotSetProperty('fan:horizontal-swing', v);
}

setHorizontalAngle(v) {
return this.miotSetProperty('fan:horizontal-angle', v);
}

setIndicatorLight(v) {
return this.miotSetProperty('indicator-light:on', v);
}

setAlarm(v) {
return this.miotSetProperty('alarm:alarm', v);
}

setMotorController(v) {
return this.miotSetProperty('motor-controller:motor-control', v);
}

setChildLock(v) {
return this.miotSetProperty('physical-controls-locked:physical-controls-locked', v);
}

setOffDelayTime(v) {
return this.miotSetProperty('off-delay-time:off-delay-time', v);
}

};
67 changes: 67 additions & 0 deletions lib/devices/dmaker.fan.p18.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
const Device = require('../device-miio');

module.exports = class extends Device {

static model = 'dmaker.fan.p18';
static name = 'Mi Smart Standing Fan 2';
static image = 'http://static.home.mi.com/app/image/get/file/developer_1541408255kg3xtr1j.png';

constructor(opts) {
super(opts);

this._miotSpecType = 'urn:miot-spec-v2:device:fan:0000A005:dmaker-p18:1';
this._propertiesToMonitor = [
'fan:on',
'fan:mode',
'fan:fan-level',
'fan:horizontal-swing',
'fan:horizontal-angle',
'fan:status',
'alarm:alarm',
'motor-controller:motor-control',
'physical-controls-locked:physical-controls-locked',
'off-delay-time:off-delay-time'
];
}

getPower() {
return this.properties['fan:on'];
}

setPower(v) {
return this.miotSetProperty('fan:on', v);
}

setMode(v) {
return this.miotSetProperty('fan:mode', v);
}

setFanLevel(v) {
return this.miotSetProperty('fan:fan-level', v);
}

setHorizontalSwing(v) {
return this.miotSetProperty('fan:horizontal-swing', v);
}

setHorizontalAngle(v) {
return this.miotSetProperty('fan:horizontal-angle', v);
}

setAlarm(v) {
return this.miotSetProperty('alarm:alarm', v);
}

setMotorController(v) {
return this.miotSetProperty('motor-controller:motor-control', v);
}

setChildLock(v) {
return this.miotSetProperty('physical-controls-locked:physical-controls-locked', v);
}

setOffDelayTime(v) {
return this.miotSetProperty('off-delay-time:off-delay-time', v);
}

};
2 changes: 1 addition & 1 deletion lib/devices/leshow.fan.ss4.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = class extends Device {

static model = 'leshow.fan.ss4';
static name = 'Leshow Fan';
static image = 'https://static.home.mi.com/app/image/get/file/developer_15560239775peeloic.png';
static image = 'http://static.home.mi.com/app/image/get/file/developer_15560239775peeloic.png';

constructor(opts) {
super(opts);
Expand Down
4 changes: 2 additions & 2 deletions lib/devices/yeelink.light.ceiling1.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const { withLightEffect } = require('../utils');
module.exports = class extends Device {

static model = 'yeelink.light.ceiling1';
static name = 'Yeelight ShaoHua Celing Light';
static image = 'https://static.home.mi.com/app/image/get/file/developer_1554860387dukxd6cf.png';
static name = 'Yeelight LED Ceiling Light';
static image = 'http://static.home.mi.com/app/image/get/file/developer_1500887836qfgbqwws.png';

constructor(opts) {
super(opts);
Expand Down
87 changes: 87 additions & 0 deletions lib/devices/yeelink.light.ceiling10.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
const Device = require('../device-miio');
const { withLightEffect } = require('../utils');

module.exports = class extends Device {

static model = 'yeelink.light.ceiling10';
static name = 'Yeelight Meteorite Light';
static image = 'http://static.home.mi.com/app/image/get/file/developer_1500887836qfgbqwws.png';

constructor(opts) {
super(opts);

this._propertiesToMonitor = ['power', 'main_power', 'bg_power','moon_mode','color_mode', 'active_bright', 'bg_bright', 'ct','bg_ct', 'bg_hue', 'bg_rgb', 'bg_sat'];
}

getPower() {
const { power } = this.properties;
if (power === 'on') return true;
if (power === 'off') return false;
return undefined;
}

getBrightness() {
const brightness = parseInt(this.properties.bright, 10);
const nightLightBrightness = parseInt(this.properties.nl_br, 10);
if (nightLightBrightness > 0) return nightLightBrightness;
if (brightness > 0) return brightness;
return undefined;
}

getColorTemperature() {
const colorTemperature = parseInt(this.properties.ct, 10);
if (colorTemperature > 0) return colorTemperature;
return undefined;
}

getSleepMode() {
const nightLightBrightness = parseInt(this.properties.nl_br, 10);
if (nightLightBrightness > 0) return true;
if (nightLightBrightness === 0) return false;
return undefined;
}

setPower(v) {
return this.miioCall('set_power', withLightEffect(v ? 'on' : 'off'));
}

setMainPower(v) {
return this.miioCall('set_main_power', withLightEffect(v ? 'on' : 'off'));
}
setBgPower(v) {
return this.miioCall('set_bg_power', withLightEffect(v ? 'on' : 'off'));
}

setBgBrightness(v) {
return this.miioCall('set_bg_bright', withLightEffect(v));
}

setActiveBrightness(v) {
return this.miioCall('set_active_bright', withLightEffect(v));
}

setColorMode(v) {
return this.miioCall('set_color_mode', withLightEffect(v));
}

setMoonMode(v) {
return this.miioCall('set_moon_mode', withLightEffect(v));
}


setColorTemperature(v) {
return this.miioCall('set_color-temperature', withLightEffect(v));
}

setBgColorTemperature(v) {
return this.miioCall('set_bg_color-temperature', withLightEffect(v));
}

setBgColorRgb(v) {
this._miioCall('set_bg_rgb', withLightEffect(v.rgb));
}

setBgColorHSV(v) {
this._miioCall('set_bg_hsv', withLightEffect([v.hue, v.saturation]));
}
};
2 changes: 1 addition & 1 deletion lib/devices/yeelink.light.ceiling3.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = class extends Device {

static model = 'yeelink.light.ceiling3';
static name = 'Yeelight LED Ceiling Light';
static image = 'https://static.home.mi.com/app/image/get/file/developer_1500887836qfgbqwws.png';
static image = 'http://static.home.mi.com/app/image/get/file/developer_1500887836qfgbqwws.png';

constructor(opts) {
super(opts);
Expand Down
Loading