UNPKG

klf-200-api

Version:

This module provides a wrapper to the socket API of a Velux KLF-200 interface. You will need at least firmware 0.2.0.0.71 on your KLF interface for this library to work.

59 lines 2.47 kB
"use strict"; import { GW_FRAME_NTF, readZString } from "./common.js"; import { ActuatorAlias, splitActuatorType, } from "./GW_SYSTEMTABLE_DATA.js"; export class GW_GET_ALL_NODES_INFORMATION_NTF extends GW_FRAME_NTF { NodeID; Order; Placement; Name; Velocity; ActuatorType; ActuatorSubType; ProductGroup; ProductType; NodeVariation; PowerSaveMode; SerialNumber; OperatingState; CurrentPosition; TargetPosition; FunctionalPosition1CurrentPosition; FunctionalPosition2CurrentPosition; FunctionalPosition3CurrentPosition; FunctionalPosition4CurrentPosition; RemainingTime; TimeStamp; ActuatorAliases = []; constructor(Data) { super(Data); this.NodeID = this.Data.readUInt8(0); this.Order = this.Data.readUInt16BE(1); this.Placement = this.Data.readUInt8(3); this.Name = readZString(this.Data.subarray(4, 68)); this.Velocity = this.Data.readUInt8(68); const actuatorTypes = splitActuatorType(this.Data.readUInt16BE(69)); this.ActuatorType = actuatorTypes.ActuatorType; this.ActuatorSubType = actuatorTypes.ActuatorSubType; this.ProductGroup = this.Data.readUInt8(71); this.ProductType = this.Data.readUInt8(72); this.NodeVariation = this.Data.readUInt8(73); this.PowerSaveMode = this.Data.readUInt8(74); this.SerialNumber = this.Data.subarray(76, 84); this.OperatingState = this.Data.readUInt8(84); this.CurrentPosition = this.Data.readUInt16BE(85); this.TargetPosition = this.Data.readUInt16BE(87); this.FunctionalPosition1CurrentPosition = this.Data.readUInt16BE(89); this.FunctionalPosition2CurrentPosition = this.Data.readUInt16BE(91); this.FunctionalPosition3CurrentPosition = this.Data.readUInt16BE(93); this.FunctionalPosition4CurrentPosition = this.Data.readUInt16BE(95); this.RemainingTime = this.Data.readUInt16BE(97); this.TimeStamp = new Date(this.Data.readUInt32BE(99) * 1000); // Read actuator aliases const numberOfAliases = this.Data.readUInt8(103); for (let index = 0; index < numberOfAliases; index++) { const alias = new ActuatorAlias(this.Data.readUInt16BE(index * 4 + 104), this.Data.readUInt16BE(index * 4 + 106)); this.ActuatorAliases.push(alias); } } } //# sourceMappingURL=GW_GET_ALL_NODES_INFORMATION_NTF.js.map