homebridge-miot
Version:
Homebridge plugin for devices supporting the miot protocol
77 lines (50 loc) • 4.1 kB
JavaScript
const HeaterDevice = require('../HeaterDevice.js');
const Constants = require('../../../constants/Constants.js');
const PropFormat = require('../../../constants/PropFormat.js');
const PropUnit = require('../../../constants/PropUnit.js');
const PropAccess = require('../../../constants/PropAccess.js');
class LeshowHeaterBs1 extends HeaterDevice {
constructor(miotDevice, name, logger) {
super(miotDevice, name, logger);
}
/*----------========== DEVICE INFO ==========----------*/
getDeviceName() {
return 'Mi Smart Baseboard Heater 1';
}
getMiotSpecUrl() {
return 'https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:heater:0000A01A:leshow-bs1:1';
}
/*----------========== CONFIG ==========----------*/
requiresMiCloud() {
return false;
}
/*----------========== METADATA ==========----------*/
initDeviceServices() {
this.createServiceByString('{"siid":2,"type":"urn:miot-spec-v2:service:heater:0000782E:leshow-bs1:1","description":"Heater"}');
this.createServiceByString('{"siid":3,"type":"urn:miot-spec-v2:service:countdown:0000782D:leshow-bs1:1","description":"Countdown"}');
this.createServiceByString('{"siid":4,"type":"urn:miot-spec-v2:service:environment:0000780A:leshow-bs1:1","description":"Environment"}');
this.createServiceByString('{"siid":5,"type":"urn:miot-spec-v2:service:physical-controls-locked:00007807:leshow-bs1:1","description":"Physical Control Locked"}');
this.createServiceByString('{"siid":6,"type":"urn:miot-spec-v2:service:alarm:00007804:leshow-bs1:1","description":"Alarm"}');
}
initDeviceProperties() {
this.addPropertyByString('heater:on', '{"siid":2,"piid":1,"type":"urn:miot-spec-v2:property:on:00000006:leshow-bs1:1","description":"Switch Status","format":"bool","access":["read","write","notify"]}');
this.addPropertyByString('heater:mode', '{"siid":2,"piid":2,"type":"urn:miot-spec-v2:property:mode:00000008:leshow-bs1:1","description":"Mode","format":"uint8","access":["read","write","notify"],"unit":"none","valueList":[{"value":0,"description":"Normal"},{"value":1,"description":"Sleep"}]}');
this.addPropertyByString('heater:target-temperature', '{"siid":2,"piid":3,"type":"urn:miot-spec-v2:property:target-temperature:00000021:leshow-bs1:1","description":"Target Temperature","format":"uint8","access":["read","write","notify"],"unit":"celsius","valueRange":[18,28,1]}');
this.addPropertyByString('heater:temperature', '{"siid":2,"piid":4,"type":"urn:miot-spec-v2:property:temperature:00000020:leshow-bs1:1","description":"Temperature","format":"int16","access":["read","notify"],"unit":"celsius","valueRange":[-100,200,1]}');
this.addPropertyByString('countdown:countdown-time', '{"siid":3,"piid":1,"type":"urn:miot-spec-v2:property:countdown-time:00000055:leshow-bs1:1","description":"Countdown Time","format":"uint8","access":["read","write","notify"],"unit":"hours","valueRange":[0,12,1]}');
this.addPropertyByString('environment:temperature', '{"siid":4,"piid":7,"type":"urn:miot-spec-v2:property:temperature:00000020:leshow-bs1:1","description":"Temperature","format":"int16","access":["read","notify"],"unit":"celsius","valueRange":[-100,200,1]}');
this.addPropertyByString('physical-controls-locked:physical-controls-locked', '{"siid":5,"piid":1,"type":"urn:miot-spec-v2:property:physical-controls-locked:0000001D:leshow-bs1:1","description":"Physical Control Locked","format":"bool","access":["read","write","notify"]}');
this.addPropertyByString('alarm:alarm', '{"siid":6,"piid":1,"type":"urn:miot-spec-v2:property:alarm:00000012:leshow-bs1:1","description":"Alarm","format":"bool","access":["read","write","notify"]}');
}
initDeviceActions() {
//no actions
}
initDeviceEvents() {
//no events
}
/*----------========== VALUES OVERRIDES ==========----------*/
/*----------========== PROPERTY OVERRIDES ==========----------*/
/*----------========== ACTION OVERRIDES ==========----------*/
/*----------========== OVERRIDES ==========----------*/
}
module.exports = LeshowHeaterBs1;