UNPKG

homebridge-miot

Version:

Homebridge plugin for devices supporting the miot protocol

53 lines (35 loc) 1.54 kB
const OutletDevice = require('../OutletDevice.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 ChuangmiPlugM3 extends OutletDevice { constructor(model, deviceId, name, logger) { super(model, deviceId, name, logger); } /*----------========== DEVICE INFO ==========----------*/ static getDeviceModel() { return "chuangmi.plug.m3"; } getDeviceName() { return "Xiaomi Chuangmi Plug M3"; } getDeviceMiotSpec() { return "https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:outlet:0000A002:chuangmi-m3:1"; } /*----------========== INIT ==========----------*/ initDeviceProperties() { // READ/WRITE this.addProperty(Properties.POWER, 2, 1, PropFormat.BOOL, PropAccess.READ_WRITE_NOTIFY, PropUnit.NONE); this.addProperty(Properties.LED, 3, 1, PropFormat.BOOL, PropAccess.READ_WRITE, PropUnit.NONE); // READ ONLY // this.addProperty(Properties.TEMPERATURE, 2, 2, PropFormat.FLOAT, PropAccess.READ_NOTIFY, PropUnit.CELSIUS, [0, 100, 1]); // seems does not work over miot, only cloud? } initDeviceActions() { //none } /*----------========== CONFIG ==========----------*/ } module.exports = ChuangmiPlugM3;