UNPKG

node-red-contrib-home-assistant-websocket

Version:
38 lines (37 loc) 1.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = issueCheck; exports.isZoneNodeProperties = isZoneNodeProperties; const IssueService_1 = require("../../common/services/IssueService"); const check_1 = require("../../common/services/IssueService/check"); const const_1 = require("../../const"); const globals_1 = require("../../globals"); function issueCheck(config) { const issues = []; const invalidEntityIds = (0, check_1.getInvalidIds)(IssueService_1.IssueType.StateId, config, config.entities); for (const id of invalidEntityIds) { const message = globals_1.RED._(`home-assistant.service.issue.entity_not_found`, { entity_id: id, }); issues.push({ type: IssueService_1.IssueType.StateId, message, identity: id, }); } const invalidZoneIds = (0, check_1.getInvalidIds)(IssueService_1.IssueType.StateId, config, config.zones); for (const id of invalidZoneIds) { const message = globals_1.RED._(`home-assistant.service.issue.zone_not_found`, { zone_id: id, }); issues.push({ type: IssueService_1.IssueType.StateId, message, identity: id, }); } return issues; } function isZoneNodeProperties(node) { return node.type === const_1.NodeType.Zone; }