hoover-washer-status-check
Version:
Hoover washer status check
16 lines (15 loc) • 689 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const node_fetch_1 = __importDefault(require("node-fetch"));
const WasherStatus_1 = require("./WasherStatus");
exports.fetchWasherStatus = async (hostname) => {
var _a;
const response = await node_fetch_1.default(`http://${hostname}/http-read.json?encrypted=0`);
const data = await response.json();
return WasherStatus_1.validationSchema.validate((_a = data) === null || _a === void 0 ? void 0 : _a.statusLavatrice, {
stripUnknown: true,
});
};