UNPKG

iobroker.alexa-timer-vis

Version:
256 lines (255 loc) 7.2 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var createStates_exports = {}; __export(createStates_exports, { createStates: () => createStates }); module.exports = __toCommonJS(createStates_exports); var import_store = __toESM(require("../store/store")); var import_logging = __toESM(require("../lib/logging")); const createStates = async (value) => { const { adapter } = import_store.default; try { for (let i = 1; i <= value; i++) { await adapter.setObjectNotExistsAsync("all_Timer.alive", { type: "state", common: { name: "Is a Timer active?", type: "boolean", role: "indicator", read: true, write: false, def: false }, native: {} }); await adapter.setObjectNotExistsAsync(`timer${i}.percent`, { type: "state", common: { name: "Percent", type: "number", role: "indicator", read: true, write: false, def: 0 }, native: {} }); await adapter.setObjectNotExistsAsync(`timer${i}.percent2`, { type: "state", common: { name: "Percent", type: "number", role: "indicator", read: true, write: false, def: 0 }, native: {} }); await adapter.setObjectNotExistsAsync(`timer${i}.alive`, { type: "state", common: { name: "Timer active", type: "boolean", role: "indicator", read: true, write: false, def: false }, native: {} }); await adapter.setObjectNotExistsAsync(`timer${i}.initialTimer`, { type: "state", common: { name: "Initial Timer", type: "string", role: "value", read: true, write: false, def: "" }, native: {} }); await adapter.setObjectNotExistsAsync(`timer${i}.hour`, { type: "state", common: { name: "Hours", type: "string", role: "value", read: true, write: false, def: "" }, native: {} }); await adapter.setObjectNotExistsAsync(`timer${i}.minute`, { type: "state", common: { name: "Minutes", type: "string", role: "value", read: true, write: false, def: "" }, native: {} }); await adapter.setObjectNotExistsAsync(`timer${i}.second`, { type: "state", common: { name: "Seconds", type: "string", role: "value", read: true, write: false, def: "" }, native: {} }); await adapter.setObjectNotExistsAsync(`timer${i}.string`, { type: "state", common: { name: "String", type: "string", role: "value", read: true, write: false, def: "00:00:00 Std" }, native: {} }); await adapter.setObjectNotExistsAsync(`timer${i}.string_2`, { type: "state", common: { name: "String_2", type: "string", role: "value", read: true, write: false, def: "" }, native: {} }); await adapter.setObjectNotExistsAsync(`timer${i}.name`, { type: "state", common: { name: "Name des Timers", type: "string", role: "value", read: true, write: false, def: "Timer" }, native: {} }); await adapter.setObjectNotExistsAsync(`timer${i}.TimeStart`, { type: "state", common: { name: "Start Time", type: "string", role: "value", read: true, write: false, def: "00:00:00" }, native: {} }); await adapter.setObjectNotExistsAsync(`timer${i}.TimeEnd`, { type: "state", common: { name: "End Time", type: "string", role: "value", read: true, write: false, def: "00:00:00" }, native: {} }); await adapter.setObjectNotExistsAsync(`timer${i}.InputDeviceName`, { type: "state", common: { name: "Input of Device", type: "string", role: "value", read: true, write: false, def: "" }, native: {} }); await adapter.setObjectNotExistsAsync(`timer${i}.Reset`, { type: "state", common: { name: "Reset Timer", type: "boolean", role: "button", read: true, write: true, def: false }, native: {} }); await adapter.setObjectNotExistsAsync(`timer${i}.lengthTimer`, { type: "state", common: { name: "Gestellter Timer", type: "string", role: "value", read: true, write: false, def: "" }, native: {} }); await adapter.setObjectNotExistsAsync(`timer${i}.json`, { type: "state", common: { name: "json", type: "string", role: "json", read: true, write: false, def: "" }, native: {} }); const id = `alexa-timer-vis.${adapter.instance}.timer${i}.Reset`; adapter.subscribeForeignStates(id); } } catch (e) { import_logging.default.send({ title: "Error in createState", e }); } }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { createStates }); //# sourceMappingURL=createStates.js.map