UNPKG

@pmouli/isy-matter-server

Version:

Service to expose an ISY device as a Matter Border router

63 lines 2.61 kB
/* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT DIRECTLY. */ import { UnitOfMeasure } from "../../../Definitions/Global/index.js"; import { Base } from "../index.js"; import { Driver } from "../../../Definitions/Global/Drivers.js"; import { NodeFactory } from "../../NodeFactory.js"; export class BinarySwitch extends Base { commands = { DON: this.on, DOF: this.off, QUERY: this.query, CONFIG: this.setConfiguration, WDU: this.writeChanges }; static nodeDefId = "147"; static implements = ['147', "252", "259"]; constructor(isy, nodeInfo) { super(isy, nodeInfo); this.drivers.ST = Driver.create("ST", this, nodeInfo.state['ST'], { uom: UnitOfMeasure.OffOn, label: "Status", name: "status" }); this.drivers.ERR = Driver.create("ERR", this, nodeInfo.state['ERR'], { uom: UnitOfMeasure.Index, label: "Responding", name: "responding" }); } async on(value) { return this.sendCommand("DON", [value, UnitOfMeasure.OffOn]); } async off() { return this.sendCommand("DOF"); } async query() { return this.sendCommand("QUERY"); } async setConfiguration(parameterNumber, parameterValue) { return this.sendCommand("CONFIG", { NUM: [parameterNumber, UnitOfMeasure.Raw1ByteUnsignedValue], VAL: parameterValue }); } async writeChanges() { return this.sendCommand("WDU"); } get status() { return this.drivers.ST?.value; } get responding() { return this.drivers.ERR?.value; } } NodeFactory.register(BinarySwitch); (function (BinarySwitch) { function is(node) { return ['147'].includes(node.nodeDefId); } BinarySwitch.is = is; function isImplementedBy(node) { return ['147', "137"].includes(node.nodeDefId); } BinarySwitch.isImplementedBy = isImplementedBy; function create(isy, nodeInfo) { return new BinarySwitch(isy, nodeInfo); } BinarySwitch.create = create; BinarySwitch.Node = BinarySwitch; BinarySwitch.Class = BinarySwitch; let Commands; (function (Commands) { Commands["on"] = "DON"; Commands["off"] = "DOF"; Commands["query"] = "QUERY"; Commands["setConfiguration"] = "CONFIG"; Commands["writeChanges"] = "WDU"; })(Commands = BinarySwitch.Commands || (BinarySwitch.Commands = {})); let Drivers; (function (Drivers) { Drivers["status"] = "ST"; Drivers["responding"] = "ERR"; })(Drivers = BinarySwitch.Drivers || (BinarySwitch.Drivers = {})); })(BinarySwitch || (BinarySwitch = {})); //# sourceMappingURL=BinarySwitch.js.map