UNPKG

homebridge-miot

Version:

Homebridge plugin for devices supporting the miot protocol

60 lines (43 loc) 1.75 kB
const SwitchDevice = require('../SwitchDevice.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 BabaiSwitchBb101s extends SwitchDevice { constructor(model, deviceId, name, logger) { super(model, deviceId, name, logger); } /*----------========== DEVICE INFO ==========----------*/ static getDeviceModel() { return "babai.switch.bb101s"; } getDeviceName() { return "WiFi Wall Switch A1"; } getDeviceMiotSpec() { return "https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:switch:0000A003:babai-bb101s:2:0000C808"; } /*----------========== INIT ==========----------*/ initDeviceProperties() { // READ/WRITE this.addProperty(Properties.POWER, 2, 1, PropFormat.BOOL, PropAccess.READ_WRITE_NOTIFY, PropUnit.NONE); this.addProperty(Properties.ECO, 2, 2, PropFormat.BOOL, PropAccess.READ_WRITE_NOTIFY, PropUnit.NONE); this.addProperty(Properties.POWER_OFF_DELAY, 2, 3, PropFormat.BOOL, PropAccess.READ_WRITE_NOTIFY, PropUnit.NONE); this.addProperty(Properties.MODE, 2, 4, PropFormat.UINT8, PropAccess.READ_WRITE_NOTIFY, PropUnit.NONE, [], [{ "value": 0, "description": "Normal" }, { "value": 3, "description": "Memory" } ]); } initDeviceActions() { // nothing special } /*----------========== CONFIG ==========----------*/ } module.exports = BabaiSwitchBb101s;