UNPKG

go-e-api-ts

Version:

GoE-Charger Typescript API

968 lines (967 loc) 37.6 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.GoECharger = void 0; const GoEStatus_1 = require("./GoEStatus"); const User_1 = require("./User"); const fetch = require("node-fetch"); class GoECharger { constructor(ipv4) { this.networkIPv4 = "192.168.188.64"; this.cloudToken = ""; this.goE_Url_Network = "http://" + this.networkIPv4 + "/status"; this.goE_Url_Cloud = "https://api.go-e.co/api_status?token=" + this.cloudToken; this.useCloudService = false; this.lastQueue = 0; this.goEStatus = new GoEStatus_1.GoEStatus(); if (ipv4 !== "") this.networkIPv4 = ipv4; } getGoE(forceQuery) { return __awaiter(this, void 0, void 0, function* () { const date = new Date().getTime(); if (date - this.lastQueue > 500 && (forceQuery || this.cache === undefined || date - this.lastQueue > 5000)) { const status = yield fetch(this.useCloudService ? this.goE_Url_Cloud : this.goE_Url_Network) .then(r => r.json()); this.lastQueue = new Date().getTime(); this.cache = status; } return this.cache; }); } get(...attributes) { return __awaiter(this, void 0, void 0, function* () { for (let attribute of attributes) { switch (attribute) { case "all": yield this.getAll(); break; case "raw": yield this.getGoE(true); break; case "ver": yield this.getVersion(); break; case "rbc": yield this.getRbc(); break; case "rbt": yield this.getRbt(); break; case "car": yield this.getCar(false); break; case "chargingState": yield this.getCar(true); break; case "cs": yield this.getCar(true); break; case "amp": yield this.getAmp(); break; case "err": yield this.getErr(); break; case "ast": yield this.getAst(); break; case "alw": yield this.getAlw(); break; case "stp": yield this.getStp(false); break; case "stopAfterKWh": yield this.getStp(true); break; case "cbl": yield this.getCbl(); break; case "pha": yield this.getPha(); break; case "phases": yield this.getPhases(); break; case "isPha3": yield this.isPha3(); break; case "tmp": yield this.getTmp(); break; case "kWh": yield this.getKWh(); break; case "dwo": yield this.getDwo(); break; case "adi": yield this.getAdi(); break; case "uby": yield this.getUby(); break; case "user": yield this.getUser(); break; case "eto": yield this.getEto(); break; case "wst": yield this.getWst(); break; case "nrg": yield this.getNrg(); break; case "kW": yield this.getKW(); break; case "u": yield this.getU(); break; case "fwv": yield this.getFwv(); break; case "sse": yield this.getSse(); break; case "wss": yield this.getWss(); break; case "wke": yield this.getWke(); break; case "wen": yield this.getWen(); break; case "tof": yield this.getTof(); break; case "tds": yield this.getTds(); break; case "lbr": yield this.getLbr(); break; case "aho": yield this.getAho(); break; case "afi": yield this.getAfi(); break; case "azo": yield this.getAzo(); break; case "ama": yield this.getAma(); break; case "al": yield this.getAl(); break; case "al1": yield this.getAl1(); break; case "al2": yield this.getAl2(); break; case "al3": yield this.getAl3(); break; case "al4": yield this.getAl4(); break; case "al5": yield this.getAl5(); break; case "cid": yield this.getCid(); break; case "cch": yield this.getCch(); break; case "cfi": yield this.getCfi(); break; case "lse": yield this.getLse(); break; case "ust": yield this.getUst(); break; case "wak": yield this.getWak(); break; case "r1x": yield this.getR1x(); break; case "dto": yield this.getDto(); break; case "nmo": yield this.getNmo(); break; case "ec": yield this.getEc(); break; case "rc": yield this.getRc(); break; case "rn": yield this.getRn(); break; case "tme": yield this.getTme(); break; case "sch": yield this.getSch(); break; case "sdp": yield this.getSdp(); break; case "upd": yield this.getUpd(); break; case "cdi": yield this.getCdi(); break; case "loe": yield this.getLoe(); break; case "lot": yield this.getLot(); break; case "lom": yield this.getLom(); break; case "lop": yield this.getLop(); break; case "log": yield this.getLog(); break; case "lon": yield this.getLon(); break; case "lof": yield this.getLof(); break; case "loa": yield this.getLoa(); break; case "lch": yield this.getLch(); break; case "mce": yield this.getMce(); break; case "mcs": yield this.getMcs(); break; case "mcp": yield this.getMcp(); break; case "mcu": yield this.getMcu(); break; case "mck": yield this.getMck(); break; case "mcc": yield this.getMcc(); break; } } return this.goEStatus; }); } getAll() { return __awaiter(this, void 0, void 0, function* () { yield this.getGoE(true); yield this.getVersion(); yield this.getRbc(); yield this.getRbt(); yield this.getCar(false); yield this.getCar(true); yield this.getAmp(); yield this.getErr(); yield this.getAst(); yield this.getAlw(); yield this.getStp(false); yield this.getStp(true); yield this.getCbl(); yield this.getPha(); yield this.getPhases(); yield this.isPha3(); yield this.getTmp(); yield this.getKWh(); yield this.getDwo(); yield this.getAdi(); yield this.getUby(); yield this.getUser(); yield this.getEto(); yield this.getWst(); yield this.getNrg(); yield this.getKW(); yield this.getU(); yield this.getFwv(); yield this.getSse(); yield this.getWss(); yield this.getWke(); yield this.getWen(); yield this.getTof(); yield this.getTds(); yield this.getLbr(); yield this.getAho(); yield this.getAfi(); yield this.getAzo(); yield this.getAma(); yield this.getAl(); yield this.getAl1(); yield this.getAl2(); yield this.getAl3(); yield this.getAl4(); yield this.getAl5(); yield this.getCid(); yield this.getCch(); yield this.getCfi(); yield this.getLse(); yield this.getUst(); yield this.getWak(); yield this.getR1x(); yield this.getDto(); yield this.getNmo(); yield this.getEc(); yield this.getRc(); yield this.getRn(); yield this.getTme(); yield this.getSch(); yield this.getSdp(); yield this.getUpd(); yield this.getCdi(); yield this.getLoe(); yield this.getLot(); yield this.getLom(); yield this.getLop(); yield this.getLog(); yield this.getLon(); yield this.getLof(); yield this.getLoa(); yield this.getLch(); yield this.getMce(); yield this.getMcs(); yield this.getMcp(); yield this.getMcu(); yield this.getMck(); yield this.getMcc(); return this.goEStatus; }); } getVersion() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.version); this.goEStatus.version = status; return status; }); } getRbc() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.rbc); this.goEStatus.rbc = parseInt(status); return this.goEStatus.rbc; }); } getRbt() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.rbt); this.goEStatus.rbt = parseInt(status); return this.goEStatus.rbt; }); } getCar(asString) { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(true).then(r => r.car); if (asString) { switch (status) { case "1": this.goEStatus.chargingStatus = "Ladestation bereit, kein Fahrzeug"; this.goEStatus.cs = "Ladestation bereit, kein Fahrzeug"; return "Ladestation bereit, kein Fahrzeug"; case "2": this.goEStatus.chargingStatus = "Fahrzeug lädt"; this.goEStatus.cs = "Fahrzeug lädt"; return "Fahrzeug lädt"; case "3": this.goEStatus.chargingStatus = "Warte auf Fahrzeug"; this.goEStatus.cs = "Warte auf Fahrzeug"; return "Warte auf Fahrzeug"; case "4": this.goEStatus.chargingStatus = "Ladung beendet, Fahrzeug noch verbunden"; this.goEStatus.cs = "Ladung beendet, Fahrzeug noch verbunden"; return "Ladung beendet, Fahrzeug noch verbunden"; } } this.goEStatus.car = parseInt(status); return this.goEStatus.car; }); } getAmp() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(true).then(r => r.amp); this.goEStatus.amp = parseInt(status); return this.goEStatus.amp; }); } getErr() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.err); this.goEStatus.err = parseInt(status); return this.goEStatus.err; }); } getAst() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.ast); this.goEStatus.ast = parseInt(status); return this.goEStatus.ast; }); } getAlw() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(true).then(r => r.alw); this.goEStatus.alw = parseInt(status) === 1; return this.goEStatus.alw; }); } getStp(toBoolean) { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.stp); this.goEStatus.stp = parseInt(status); this.goEStatus.stopAfterKWh = this.goEStatus.stp === 2; return toBoolean ? this.goEStatus.stopAfterKWh : this.goEStatus.stp; }); } getCbl() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.cbl); this.goEStatus.cbl = parseInt(status); return this.goEStatus.cbl; }); } getPha() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.pha); this.goEStatus.pha = parseInt(status); return this.goEStatus.pha; }); } getPhases() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getPha(); this.goEStatus.phases = status === 56 ? 3 : status === 48 ? 2 : status === 8 ? 1 : 0; return this.goEStatus.phases; }); } isPha3() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getPhases(); this.goEStatus.isPha3 = status === 3; return this.goEStatus.isPha3; }); } getTmp() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.tmp); this.goEStatus.tmp = parseInt(status); return this.goEStatus.tmp; }); } getDws() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(true).then(r => r.dws); this.goEStatus.dws = parseInt(status); return this.goEStatus.dws; }); } getKWh() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getDws(); this.goEStatus.kWh = status * 10 / 3600000; return this.goEStatus.kWh; }); } getDwo() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.dwo); this.goEStatus.dwo = parseInt(status) / 10; return this.goEStatus.dwo; }); } getAdi() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.adi); this.goEStatus.adi = parseInt(status); return this.goEStatus.adi; }); } getUby() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.uby); this.goEStatus.uby = parseInt(status); return this.goEStatus.uby; }); } getUser() { return __awaiter(this, void 0, void 0, function* () { let unlockedUser = null; const uby = yield this.getUby(); if (uby !== 0) { unlockedUser = new User_1.User(); yield unlockedUser.setData(this.useCloudService ? this.goE_Url_Cloud : this.goE_Url_Network, uby); this.goEStatus.unlockedUser = unlockedUser; return unlockedUser; } return unlockedUser; }); } getEto() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.eto); this.goEStatus.eto = parseInt(status) / 10; return this.goEStatus.eto; }); } getWst() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.wst); this.goEStatus.wst = parseInt(status); return this.goEStatus.wst; }); } getNrg() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(true).then(r => r.nrg); this.goEStatus.nrg = status; return this.goEStatus.nrg; }); } getKW() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getNrg(); this.goEStatus.kW = status[11] / 100; return this.goEStatus.kW; }); } getU() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getNrg(); this.goEStatus.u = (status[0] + status[1] + status[2]) / 3; return this.goEStatus.u; }); } getFwv() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.fwv); this.goEStatus.fwv = status; return this.goEStatus.fwv; }); } getSse() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.sse); this.goEStatus.sse = status; return this.goEStatus.sse; }); } getWss() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.wss); this.goEStatus.wss = status; return this.goEStatus.wss; }); } getWke() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.wke); this.goEStatus.wke = status; return this.goEStatus.wke; }); } getWen() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.wen); this.goEStatus.wen = parseInt(status) === 1; return this.goEStatus.wen; }); } getTof() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.tof); this.goEStatus.tof = parseInt(status); return this.goEStatus.tof; }); } getTds() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.tds); this.goEStatus.tds = parseInt(status); return this.goEStatus.tds; }); } getLbr() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.lbr); this.goEStatus.lbr = parseInt(status); return this.goEStatus.lbr; }); } getAho() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.aho); this.goEStatus.aho = parseInt(status); return this.goEStatus.aho; }); } getAfi() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.afi); this.goEStatus.afi = parseInt(status); return this.goEStatus.afi; }); } getAzo() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.azo); this.goEStatus.azo = parseInt(status); return this.goEStatus.azo; }); } getAma() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.ama); this.goEStatus.ama = parseInt(status); return this.goEStatus.ama; }); } getAl() { return __awaiter(this, void 0, void 0, function* () { const als = []; const al1 = yield this.getAl1(); const al2 = yield this.getAl2(); const al3 = yield this.getAl3(); const al4 = yield this.getAl4(); const al5 = yield this.getAl5(); als.push(al1, al2, al3, al4, al5); this.goEStatus.al = als; return this.goEStatus.al; }); } getAl1() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.al1); this.goEStatus.al1 = parseInt(status); return this.goEStatus.al1; }); } getAl2() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.al2); this.goEStatus.al2 = parseInt(status); return this.goEStatus.al2; }); } getAl3() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.al3); this.goEStatus.al3 = parseInt(status); return this.goEStatus.al3; }); } getAl4() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.al4); this.goEStatus.al4 = parseInt(status); return this.goEStatus.al4; }); } getAl5() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.al5); this.goEStatus.al5 = parseInt(status); return this.goEStatus.al5; }); } getCid() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.cid); this.goEStatus.cid = parseInt(status); return this.goEStatus.cid; }); } getCch() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.cch); this.goEStatus.cch = parseInt(status); return this.goEStatus.cch; }); } getCfi() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.cfi); this.goEStatus.cfi = parseInt(status); return this.goEStatus.cfi; }); } getLse() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.lse); this.goEStatus.lse = parseInt(status) === 1; return this.goEStatus.lse; }); } getUst() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.ust); this.goEStatus.ust = parseInt(status); return this.goEStatus.ust; }); } getWak() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.wak); this.goEStatus.wak = status; return this.goEStatus.wak; }); } getR1x() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.r1x); this.goEStatus.r1x = parseInt(status); return this.goEStatus.r1x; }); } getDto() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.dto); this.goEStatus.dto = parseInt(status); return this.goEStatus.dto; }); } getNmo() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.nmo); this.goEStatus.nmo = parseInt(status) === 1; return this.goEStatus.nmo; }); } getEc() { return __awaiter(this, void 0, void 0, function* () { const ec = []; ec.push(yield this.getGoE(false).then(r => parseInt(r.eca))); ec.push(yield this.getGoE(false).then(r => parseInt(r.ecr))); ec.push(yield this.getGoE(false).then(r => parseInt(r.ecd))); ec.push(yield this.getGoE(false).then(r => parseInt(r.ec4))); ec.push(yield this.getGoE(false).then(r => parseInt(r.ec5))); ec.push(yield this.getGoE(false).then(r => parseInt(r.ec6))); ec.push(yield this.getGoE(false).then(r => parseInt(r.ec7))); ec.push(yield this.getGoE(false).then(r => parseInt(r.ec8))); ec.push(yield this.getGoE(false).then(r => parseInt(r.ec9))); ec.push(yield this.getGoE(false).then(r => parseInt(r.ec1))); this.goEStatus.ec = ec; return this.goEStatus.ec; }); } getRc() { return __awaiter(this, void 0, void 0, function* () { const rc = []; rc.push(yield this.getGoE(false).then(r => r.rca)); rc.push(yield this.getGoE(false).then(r => r.rcr)); rc.push(yield this.getGoE(false).then(r => r.rcd)); rc.push(yield this.getGoE(false).then(r => r.rc4)); rc.push(yield this.getGoE(false).then(r => r.rc5)); rc.push(yield this.getGoE(false).then(r => r.rc6)); rc.push(yield this.getGoE(false).then(r => r.rc7)); rc.push(yield this.getGoE(false).then(r => r.rc8)); rc.push(yield this.getGoE(false).then(r => r.rc9)); rc.push(yield this.getGoE(false).then(r => r.rc1)); this.goEStatus.rc = rc; return this.goEStatus.rc; }); } getRn() { return __awaiter(this, void 0, void 0, function* () { const rn = []; rn.push(yield this.getGoE(false).then(r => r.rna)); rn.push(yield this.getGoE(false).then(r => r.rnm)); rn.push(yield this.getGoE(false).then(r => r.rne)); rn.push(yield this.getGoE(false).then(r => r.rn4)); rn.push(yield this.getGoE(false).then(r => r.rn5)); rn.push(yield this.getGoE(false).then(r => r.rn6)); rn.push(yield this.getGoE(false).then(r => r.rn7)); rn.push(yield this.getGoE(false).then(r => r.rn8)); rn.push(yield this.getGoE(false).then(r => r.rn9)); rn.push(yield this.getGoE(false).then(r => r.rn1)); this.goEStatus.rn = rn; return this.goEStatus.rn; }); } getTme() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.tme); this.goEStatus.tme = status; return this.goEStatus.tme; }); } getSch() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.sch); this.goEStatus.sch = status; return this.goEStatus.sch; }); } getSdp() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.sdp); this.goEStatus.sdp = parseInt(status) === 1; return this.goEStatus.sdp; }); } getUpd() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.upd); this.goEStatus.upd = parseInt(status) === 1; return this.goEStatus.upd; }); } getCdi() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.cdi); this.goEStatus.cdi = parseInt(status) === 1; return this.goEStatus.cdi; }); } getLoe() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.loe); this.goEStatus.loe = parseInt(status) === 1; return this.goEStatus.loe; }); } getLot() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.lot); this.goEStatus.lot = parseInt(status); return this.goEStatus.lot; }); } getLom() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.lom); this.goEStatus.lom = parseInt(status); return this.goEStatus.lom; }); } getLop() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.lop); this.goEStatus.lop = parseInt(status); return this.goEStatus.lop; }); } getLog() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.log); this.goEStatus.log = status; return this.goEStatus.log; }); } getLon() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.lon); this.goEStatus.lon = parseInt(status); return this.goEStatus.lon; }); } getLof() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.lof); this.goEStatus.lof = parseInt(status); return this.goEStatus.lof; }); } getLoa() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.loa); this.goEStatus.loa = parseInt(status); return this.goEStatus.loa; }); } getLch() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.lch); this.goEStatus.lch = parseInt(status); return this.goEStatus.lch; }); } getMce() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.mce); this.goEStatus.mce = parseInt(status); return this.goEStatus.mce; }); } getMcs() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.mcs); this.goEStatus.mcs = status; return this.goEStatus.mcs; }); } getMcp() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.mcp); this.goEStatus.mcp = parseInt(status); return this.goEStatus.mcp; }); } getMcu() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.mcu); this.goEStatus.mcu = status; return this.goEStatus.mcu; }); } getMck() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.mck); this.goEStatus.mck = status; return this.goEStatus.mck; }); } getMcc() { return __awaiter(this, void 0, void 0, function* () { const status = yield this.getGoE(false).then(r => r.mcc); this.goEStatus.mcc = parseInt(status) === 1; return this.goEStatus.mcc; }); } allowCharging(allow) { return __awaiter(this, void 0, void 0, function* () { yield fetch(this.useCloudService ? (this.goE_Url_Cloud + "payload=alw=" + (allow ? "1" : "0")) : ("http://" + this.networkIPv4 + "/mqtt?payload=alw=" + (allow ? "1" : "0"))); }); } setAmp(value) { return __awaiter(this, void 0, void 0, function* () { yield fetch(this.useCloudService ? (this.goE_Url_Cloud + "payload=amp=" + value) : ("http://" + this.networkIPv4 + "/mqtt?payload=amp=" + value)); }); } } exports.GoECharger = GoECharger;