homebridge-miot
Version:
Homebridge plugin for devices supporting the miot protocol
75 lines (58 loc) • 2.73 kB
JavaScript
const HeaterDevice = require('../HeaterDevice.js');
const Properties = require('../../../constants/Properties.js');
const Actions = require('../../../constants/Actions.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 LeshowHeaterBs3 extends HeaterDevice {
constructor(model, deviceId, name, logger) {
super(model, deviceId, name, logger);
}
/*----------========== DEVICE INFO ==========----------*/
static getDeviceModel() {
return "leshow.heater.bs3";
}
getDeviceName() {
return "Mi Smart Baseboard Heater 3";
}
getDeviceMiotSpec() {
return "https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:heater:0000A01A:leshow-bs3:1";
}
/*----------========== INIT ==========----------*/
initDeviceProperties() {
// READ/WRITE
this.addProperty(Properties.POWER, 2, 1, PropFormat.BOOL, PropAccess.READ_WRITE_NOTIFY, PropUnit.NONE);
this.addProperty(Properties.TARGET_TEMPERATURE, 2, 3, PropFormat.UINT8, PropAccess.READ_WRITE_NOTIFY, PropUnit.CELSIUS, [18, 28, 1]);
this.addProperty(Properties.MODE, 2, 5, PropFormat.UINT8, PropAccess.READ_WRITE_NOTIFY, PropUnit.NONE, [], [{
"value": 0,
"description": "Auto"
},
{
"value": 1,
"description": "Low"
},
{
"value": 2,
"description": "Max"
}
]);
this.addProperty(Properties.POWER_OFF_TIME, 3, 1, PropFormat.UINT8, PropAccess.READ_WRITE_NOTIFY, PropUnit.HOURS, [0, 12, 1]);
this.addProperty(Properties.CHILD_LOCK, 5, 1, PropFormat.BOOL, PropAccess.READ_WRITE_NOTIFY, PropUnit.NONE);
this.addProperty(Properties.ALARM, 6, 1, PropFormat.BOOL, PropAccess.READ_WRITE_NOTIFY, PropUnit.NONE);
this.addProperty(Properties.LED, 7, 1, PropFormat.BOOL, PropAccess.READ_WRITE_NOTIFY, PropUnit.NONE);
this.addProperty(Properties.FAN, 8, 1, PropFormat.BOOL, PropAccess.READ_WRITE_NOTIFY, PropUnit.NONE);
// READ ONLY
this.addProperty(Properties.DEVICE_FAULT, 2, 2, PropFormat.UINT8, PropAccess.READ_NOTIFY, PropUnit.NONE, [], [{
"value": 0,
"description": "No faults"
}]);
this.addProperty(Properties.TEMPERATURE, 2, 4, PropFormat.INT32, PropAccess.READ_NOTIFY, PropUnit.CELSIUS, [-30, 100, 1]);
this.addProperty(Properties.PCB_TEMPERATURE, 9, 1, PropFormat.INT32, PropAccess.READ_NOTIFY, PropUnit.CELSIUS, [-30, 100, 1]);
}
initDeviceActions() {
// nothing special
}
/*----------========== CONFIG ==========----------*/
}
module.exports = LeshowHeaterBs3;