gsprovider
Golem stations communication provider
installation:
npm:
npm install @ncodefactory/gsprovider --save
yarn:
yarn add @ncodefactory/gsprovider
usage:
gsstate - read state from golem station
import { gsstatus } from "@ncodefactory/gsprovider";
const stateReader = gsstate(
"golem_station_host",
golem_station_pot,
connection_milliseconds_timeout
);
const stateReader = gsstate("golem_station_host", golem_station_pot); // timeout is default 3000 milliseconds
const state = await stateReader(gole_station_sv_no);
gscmd - write command to golem station
import { gsstatus } from "@ncodefactory/gsprovider";
const cmdWriter = gscmd(
"golem_station_host",
golem_station_pot,
connection_milliseconds_timeout
);
const cmdWriter = gscmd("golem_station_host", golem_station_pot); // timeout is default 3000 milliseconds
const command = {
command: 1,
sr: "bs-v5",
sv: 1,
nrstatus: 0,
id_operatora: 1,
operator_txt: "bsolarski"
};
const cmdOk = await cmdWriter(command);