UNPKG

rainbird

Version:

The Rainbird library allows you to access your RainBird Controller.

53 lines 1.66 kB
import { Response } from './Response.js'; export class ControllerStateResponse extends Response { response; _controllerDateTime; _delayDays; _rainSetPointReached; _irrigationState; _seasonalAdjust; _currentZoneTimeRemaining; _currentZone; constructor(response) { super(); this.response = response; const monthYear = response.subarray(5, 7).toString('hex'); const month = Number(`0x0${monthYear.substring(0, 1)}`) - 1; const year = Number(`0x0${monthYear.substring(1, 4)}`); this._controllerDateTime = new Date(year, month, response[4], response[1], response[2], response[3]); this._delayDays = response.readUInt16BE(7); this._rainSetPointReached = response[9] !== 0; this._irrigationState = response[10] !== 0; this._seasonalAdjust = response.readUInt16BE(11); this._currentZoneTimeRemaining = response.readUInt16BE(13); this._currentZone = response[15]; } get type() { return 0xCC; } get controllerDateTime() { return this._controllerDateTime; } get delayDays() { return this._delayDays; } get rainSetPointReached() { return this._rainSetPointReached; } get irrigationState() { return this._irrigationState; } get seasonalAdjust() { return this._seasonalAdjust; } get currentZoneTimeRemaining() { return this._currentZoneTimeRemaining; } get currentZone() { return this._currentZone; } toBuffer() { return this.response; } } //# sourceMappingURL=ControllerStateResponse.js.map