1 line
157 KiB
Plaintext
1 line
157 KiB
Plaintext
{"version":3,"sources":["conn.js","detector.js"],"names":["servConn","_socket","_onConnChange","_onUpdate","_isConnected","_disconnectedSince","_connCallbacks","onConnChange","onUpdate","onRefresh","onAuth","onCommand","onError","_authInfo","_isAuthDone","_isAuthRequired","_authRunning","_cmdQueue","_connTimer","_type","_timeout","_reconnectInterval","_reloadInterval","_cmdData","_cmdInstance","_isSecure","_defaultMode","_useStorage","_objects","_enums","_autoSubscribe","namespace","getType","this","getIsConnected","getIsLoginRequired","getUser","_user","setReloadTimeout","timeout","parseInt","setReconnectInterval","interval","_checkConnection","func","_arguments","_queueCmdIfRequired","console","log","_monitor","_timer","ts","Date","getTime","_lastTimer","reload","that","setTimeout","_onAuth","objectsRequired","isSecure","emit","auth","user","app","reconnect","connOptions","mayReconnect","_connectInterval","setInterval","connect","_countDown","Math","floor","$","html","css","_countInterval","window","location","host","init","connCallbacks","autoSubscribe","socketNamespace","name","undefined","document","URL","split","socketUrl","connLink","session","get","hash","salt","localStorage","getItem","socketSession","socketForceWebSockets","io","url","protocol","hostname","close","e","query","reconnection limit","max reconnection attempts","Infinity","reconnection","upgrade","rememberUpgrade","transports","on","offlineTime","authError","clearInterval","elem","getElementById","style","display","toISOString","waitConnect","error","isOk","clearTimeout","err","warn","onAuthError","id","obj","storage","objects","set","onObjectChange","state","ack","val","length","JSON","parse","instance","command","data","setState","logout","callback","getVersion","arguments","version","subscribe","idOrArray","unsubscribe","_checkAuth","readFile","filename","isRemote","adapter","p","splice","join","mimeType","readLocalFile","replace","getMimeType","ext","indexOf","toLowerCase","match","readFile64","mime","btoa","writeFile","mode","stringify","parts","writeFile64","atob","readDir","dirname","filter","mkdir","unlink","renameFile","oldname","newname","parts1","parts2","pointId","value","getStates","IDs","gettingStates","_fillChildren","items","hasOwnProperty","push","sort","i","common","j","children","len","substring","getObjects","useCache","startkey","endkey","res","enums","rows","native","defaultFileMode","getChildren","list","count","_id","id_","__id","k","getObject","getGroups","groupName","groups","_groups","getEnums","enumName","getSyncTime","timeSync","addObject","objId","delObject","httpGet","logError","errorText","args","__cmdQueue","t","apply","authenticate","password","getConfig","sendCommand","_detectViews","projectDir","dirs","f","file","acl","read","readOnly","write","permissions","readProjects","result","d","isDir","subErr","project","chmodProject","clearCache","empty","getHistory","options","getLiveHost","cb","_hosts","h","states","readDirAsZip","useConvert","settings","alert","writeDirAsZip","base64","Types","unknown","blind","button","camera","image","dimmer","door","fireAlarm","floodAlarm","gate","humidity","info","light","lock","media","motion","rgb","rgbSingle","hue","slider","socket","temperature","thermostat","valve","volume","volumeGroup","windowTilt","weatherCurrent","weatherForecast","warning","ChannelDetector","patternWorking","role","indicator","required","patternUnreach","type","patternLowbat","patternMaintain","patternError","patternDirection","patterns","mediaPlayer","noSubscribe","notSingle","min","max","stateName","multiple","inverted","unit","searchInParent","rgbOld","blinds","roleOrEnumBlind","roleOrEnumWindow","channelRole","roleOrEnum","doorsRoles","doorsWords","roleOrEnumLight","levelSlider","noDeviceDetection","ignoreRole","roles","words","found","forEach","en","pos","lastIndexOf","lang","find","reg","test","lightWords","de","ru","lightRoles","blindWords","blindRoles","windowRoles","getAllStatesInDevice","keys","channelId","RegExp","getParentId","copyState","oldState","newState","Array","original","icon","_applyPattern","statePattern","pop","noOneOk","_getEnumsForId","members","getFunctionEnums","channel","_testOneState","context","pattern","channelStates","usedIds","_usedIds","ignoreIndicators","_found","u","c","cid","bind","_detectNext","_keysOptional","_usedIdsOptional","allowedTypes","s","allRequiredFound","a","oneOf","b","deviceStates","deviceId","m","exec","detect","cache","Object","detected","module","parent","exports"],"mappings":"AAyCA,aAOA,IAAAA,SAAA,CACAC,QAAA,KACAC,cAAA,KACAC,UAAA,KACAC,cAAA,EACAC,mBAAA,KACAC,eAAA,CACAC,aAAA,KACAC,SAAA,KACAC,UAAA,KACAC,OAAA,KACAC,UAAA,KACAC,QAAA,MAEAC,UAAA,KACAC,aAAA,EACAC,iBAAA,EACAC,cAAA,EACAC,UAAA,G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,OAAAoH,EAAA,KAEA9N,KAAAmX,MAAAlR,KAGA1E,EAGAvB,MAFAiL,MAAA,KACA1J,EAAA4V,MAAA,GAGAnX,KAGA,oBAAAsX,QAAAA,OAAAC,SACAD,OAAAE,QAAA,CACArI,MAAAA,MACA+B,gBAAAA","file":"vendor.js","sourcesContent":["/**\n * Copyright 2018 bluefox <dogafox@gmail.com>\n *\n * The MIT License (MIT)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n **/\n\n////// ----------------------- Connection \"class\" ---------------------- ////////////\n/* jshint browser:true */\n/* global document*/\n/* global console*/\n/* global session*/\n/* global window*/\n/* global location*/\n/* global setTimeout*/\n/* global clearTimeout*/\n/* global io*/\n/* global $*/\n/* global socketNamespace */\n/* global socketUrl */\n/* global socketSession */\n/* global storage */\n/* jshint -W097 */// jshint strict:false\n\n'use strict';\n\n// The idea of servConn is to use this class later in every addon.\n// The addon just must say, what must be loaded (values, objects, indexes) and\n// the class loads it for addon. Authentication will be done automatically, so addon does not care about it.\n// It will be .js file with localData and servConn\n\nvar servConn = {\n _socket: null,\n _onConnChange: null,\n _onUpdate: null,\n _isConnected: false,\n _disconnectedSince: null,\n _connCallbacks: {\n onConnChange: null,\n onUpdate: null,\n onRefresh: null,\n onAuth: null,\n onCommand: null,\n onError: null\n },\n _authInfo: null,\n _isAuthDone: false,\n _isAuthRequired: false,\n _authRunning: false,\n _cmdQueue: [],\n _connTimer: null,\n _type: 'socket.io', // [SignalR | socket.io | local]\n _timeout: 0, // 0 - use transport default timeout to detect disconnect\n _reconnectInterval: 10000, // reconnect interval\n _reloadInterval: 30, // if connection was absent longer than 30 seconds\n _cmdData: null,\n _cmdInstance: null,\n _isSecure: false,\n _defaultMode: 0x644,\n _useStorage: false,\n _objects: null, // used if _useStorage === true\n _enums: null, // used if _useStorage === true\n _autoSubscribe: true,\n namespace: 'vis.0',\n\n getType: function () {\n return this._type;\n },\n getIsConnected: function () {\n return this._isConnected;\n },\n getIsLoginRequired: function () {\n return this._isSecure;\n },\n getUser: function () {\n return this._user;\n },\n setReloadTimeout: function (timeout){\n this._reloadInterval = parseInt(timeout, 10); \n },\n setReconnectInterval: function (interval){\n this._reconnectInterval = parseInt(interval, 10);\n },\n _checkConnection: function (func, _arguments) {\n if (!this._isConnected) {\n console.log('No connection!');\n return false;\n }\n\n if (this._queueCmdIfRequired(func, _arguments)) return false;\n\n //socket.io\n if (this._socket === null) {\n console.log('socket.io not initialized');\n return false;\n }\n return true;\n },\n _monitor: function () {\n if (this._timer) return;\n var ts = (new Date()).getTime();\n if (this._reloadInterval && ts - this._lastTimer > this._reloadInterval * 1000) {\n // It seems, that PC was in a sleep => Reload page to request authentication anew\n this.reload();\n } else {\n this._lastTimer = ts;\n }\n var that = this;\n this._timer = setTimeout(function () {\n that._timer = null;\n that._monitor();\n }, 10000);\n },\n _onAuth: function (objectsRequired, isSecure) {\n var that = this;\n\n this._isSecure = isSecure;\n\n if (this._isSecure) {\n that._lastTimer = (new Date()).getTime();\n this._monitor();\n }\n\n if (this._autoSubscribe) this._socket.emit('subscribe', '*');\n if (objectsRequired) this._socket.emit('subscribeObjects', '*');\n\n if (this._isConnected === true) {\n // This seems to be a reconnect because we're already connected!\n // -> prevent firing onConnChange twice\n return;\n }\n this._isConnected = true;\n if (this._connCallbacks.onConnChange) {\n setTimeout(function () {\n that._socket.emit('authEnabled', function (auth, user) {\n that._user = user;\n that._connCallbacks.onConnChange(that._isConnected);\n if (typeof app !== 'undefined') app.onConnChange(that._isConnected);\n });\n }, 0);\n }\n },\n reconnect: function (connOptions) {\n var that = this;\n // reconnect\n if ((!connOptions.mayReconnect || connOptions.mayReconnect()) && !this._connectInterval) {\n this._connectInterval = setInterval(function () {\n console.log('Trying connect...');\n that._socket.connect();\n that._countDown = Math.floor(that._reconnectInterval / 1000);\n if (typeof $ !== 'undefined') {\n $('.splash-screen-text').html(that._countDown + '...').css('color', 'red');\n }\n }, this._reconnectInterval);\n\n this._countDown = Math.floor(this._reconnectInterval / 1000);\n if (typeof $ !== 'undefined') {\n $('.splash-screen-text').html(this._countDown + '...');\n }\n\n this._countInterval = setInterval(function () {\n that._countDown--;\n if (typeof $ !== 'undefined') {\n $('.splash-screen-text').html(that._countDown + '...');\n }\n }, 1000);\n }\n },\n reload: function () {\n if (window.location.host === 'yunkong2.net' ||\n window.location.host === 'yunkong2.biz') {\n window.location = '/';\n } else {\n window.location.reload();\n }\n },\n init: function (connOptions, connCallbacks, objectsRequired, autoSubscribe) {\n var that = this; // support of old safari\n // init namespace\n if (typeof socketNamespace !== 'undefined') this.namespace = socketNamespace;\n\n connOptions = connOptions || {};\n if (!connOptions.name) connOptions.name = this.namespace;\n\n if (autoSubscribe !== undefined) this._autoSubscribe = autoSubscribe;\n\n // To start vis as local use one of:\n // - start vis from directory with name local, e.g. c:/blbla/local/yunkong2.vis/www/index.html\n // - do not create \"_socket/info.js\" file in \"www\" directory\n // - create \"_socket/info.js\" file with\n // var socketUrl = \"local\"; var socketSession = \"\"; sysLang=\"en\";\n // in this case you can overwrite browser language settings\n if (document.URL.split('/local/')[1] || (typeof socketUrl === 'undefined' && !connOptions.connLink) || (typeof socketUrl !== 'undefined' && socketUrl === 'local')) {\n this._type = 'local';\n }\n\n if (typeof session !== 'undefined') {\n var user = session.get('user');\n if (user) {\n that._authInfo = {\n user: user,\n hash: session.get('hash'),\n salt: session.get('salt')\n };\n }\n }\n\n this._connCallbacks = connCallbacks;\n\n var connLink = connOptions.connLink || window.localStorage.getItem('connLink');\n\n // Connection data from \"/_socket/info.js\"\n if (!connLink && typeof socketUrl !== 'undefined') connLink = socketUrl;\n if (!connOptions.socketSession && typeof socketSession !== 'undefined') connOptions.socketSession = socketSession;\n if (connOptions.socketForceWebSockets === undefined &&\n typeof socketForceWebSockets !== 'undefined') {\n connOptions.socketForceWebSockets = socketForceWebSockets;\n }\n\n // if no remote data\n if (this._type === 'local') {\n // report connected state\n this._isConnected = true;\n if (this._connCallbacks.onConnChange) this._connCallbacks.onConnChange(this._isConnected);\n if (typeof app !== 'undefined') app.onConnChange(this._isConnected);\n } else\n if (typeof io !== 'undefined') {\n connOptions.socketSession = connOptions.socketSession || 'nokey';\n\n var url;\n if (connLink) {\n url = connLink;\n if (typeof connLink !== 'undefined') {\n if (connLink[0] === ':') connLink = location.protocol + '//' + location.hostname + connLink;\n }\n } else {\n url = location.protocol + '//' + location.host;\n }\n\n if (this._socket) {\n try {\n this._socket.close();\n this._socket = null;\n } catch (e) {\n console.log('Cannot close connection: ' + e);\n }\n }\n this._socket = io.connect(url, {\n query: 'key=' + connOptions.socketSession,\n 'reconnection limit': 10000,\n 'max reconnection attempts': Infinity,\n reconnection: false,\n upgrade: !connOptions.socketForceWebSockets,\n rememberUpgrade: connOptions.socketForceWebSockets,\n transports: connOptions.socketForceWebSockets ? ['websocket'] : undefined\n });\n\n this._socket.on('connect', function () {\n if (that._disconnectedSince) {\n var offlineTime = (new Date()).getTime() - that._disconnectedSince;\n console.log('was offline for ' + (offlineTime / 1000) + 's');\n\n // reload whole page if no connection longer than some period\n if (that._reloadInterval && offlineTime > that._reloadInterval * 1000 && !that.authError) that.reload();\n \n that._disconnectedSince = null;\n }\n\n if (that._connectInterval) {\n clearInterval(that._connectInterval);\n that._connectInterval = null;\n }\n if (that._countInterval) {\n clearInterval(that._countInterval);\n that._countInterval = null;\n }\n var elem = document.getElementById('server-disconnect');\n if (elem) elem.style.display = 'none';\n\n that._socket.emit('name', connOptions.name);\n console.log((new Date()).toISOString() + ' Connected => authenticate');\n setTimeout(function () {\n that.waitConnect = setTimeout(function() {\n console.error('No answer from server');\n if (!that.authError) {\n that.reload();\n }\n }, 6000);\n\n that._socket.emit('authenticate', function (isOk, isSecure) {\n if (that.waitConnect) {\n clearTimeout(that.waitConnect);\n that.waitConnect = null;\n }\n\n console.log((new Date()).toISOString() + ' Authenticated: ' + isOk);\n if (isOk) {\n that._onAuth(objectsRequired, isSecure);\n } else {\n console.log('permissionError');\n }\n });\n }, 50);\n });\n\n this._socket.on('reauthenticate', function (err) {\n if (that._connCallbacks.onConnChange) {\n that._connCallbacks.onConnChange(false);\n if (typeof app !== 'undefined' && !that.authError) app.onConnChange(false);\n }\n console.warn('reauthenticate');\n if (that.waitConnect) {\n clearTimeout(that.waitConnect);\n that.waitConnect = null;\n }\n\n if (connCallbacks.onAuthError) {\n if (!that.authError) {\n that.authError = true;\n connCallbacks.onAuthError(err);\n }\n } else {\n that.reload();\n }\n });\n\n this._socket.on('connect_error', function () {\n if (typeof $ !== 'undefined') {\n $('.splash-screen-text').css('color', '#002951');\n }\n\n that.reconnect(connOptions);\n });\n\n this._socket.on('disconnect', function () {\n that._disconnectedSince = (new Date()).getTime();\n\n // called only once when connection lost (and it was here before)\n that._isConnected = false;\n if (that._connCallbacks.onConnChange) {\n setTimeout(function () {\n var elem = document.getElementById('server-disconnect');\n if (elem) elem.style.display = '';\n that._connCallbacks.onConnChange(that._isConnected);\n if (typeof app !== 'undefined') app.onConnChange(that._isConnected);\n }, 5000);\n } else {\n var elem = document.getElementById('server-disconnect');\n if (elem) elem.style.display = '';\n }\n\n // reconnect\n that.reconnect(connOptions);\n });\n\n // after reconnect the \"connect\" event will be called\n this._socket.on('reconnect', function () {\n var offlineTime = (new Date()).getTime() - that._disconnectedSince;\n console.log('was offline for ' + (offlineTime / 1000) + 's');\n\n // reload whole page if no connection longer than one minute\n if (that._reloadInterval && offlineTime > that._reloadInterval * 1000) {\n that.reload();\n }\n // anyway \"on connect\" is called\n });\n\n this._socket.on('objectChange', function (id, obj) {\n // If cache used\n if (that._useStorage && typeof storage !== 'undefined') {\n var objects = that._objects || storage.get('objects');\n if (objects) {\n if (obj) {\n objects[id] = obj;\n } else {\n if (objects[id]) delete objects[id];\n }\n storage.set('objects', objects);\n }\n }\n\n if (that._connCallbacks.onObjectChange) that._connCallbacks.onObjectChange(id, obj);\n });\n\n this._socket.on('stateChange', function (id, state) {\n if (!id || state === null || typeof state !== 'object') return;\n\n if (that._connCallbacks.onCommand && id === that.namespace + '.control.command') {\n if (state.ack) return;\n\n if (state.val &&\n typeof state.val === 'string' &&\n state.val[0] === '{' &&\n state.val[state.val.length - 1] === '}') {\n try {\n state.val = JSON.parse(state.val);\n } catch (e) {\n console.log('Command seems to be an object, but cannot parse it: ' + state.val);\n }\n }\n\n // if command is an object {instance: 'iii', command: 'cmd', data: 'ddd'}\n if (state.val && state.val.instance) {\n if (that._connCallbacks.onCommand(state.val.instance, state.val.command, state.val.data)) {\n // clear state\n that.setState(id, {val: '', ack: true});\n }\n } else {\n if (that._connCallbacks.onCommand(that._cmdInstance, state.val, that._cmdData)) {\n // clear state\n that.setState(id, {val: '', ack: true});\n }\n }\n } else if (id === that.namespace + '.control.data') {\n that._cmdData = state.val;\n } else if (id === that.namespace + '.control.instance') {\n that._cmdInstance = state.val;\n } else if (that._connCallbacks.onUpdate) {\n that._connCallbacks.onUpdate(id, state);\n }\n });\n\n this._socket.on('permissionError', function (err) {\n if (that._connCallbacks.onError) {\n /* {\n command:\n type:\n operation:\n arg:\n }*/\n that._connCallbacks.onError(err);\n } else {\n console.log('permissionError');\n }\n });\n\n this._socket.on('error', function (err) {\n if (err === 'Invalid password or user name') {\n console.warn('reauthenticate');\n if (that.waitConnect) {\n clearTimeout(that.waitConnect);\n that.waitConnect = null;\n }\n\n if (connCallbacks.onAuthError) {\n if (!that.authError) {\n that.authError = true;\n connCallbacks.onAuthError(err);\n }\n } else {\n that.reload();\n }\n } else {\n console.error('Socket error: ' + err);\n if (typeof $ !== 'undefined') {\n $('.splash-screen-text').css('color', '#002951');\n }\n\n that.reconnect(connOptions);\n }\n });\n }\n },\n logout: function (callback) {\n if (!this._isConnected) {\n console.log('No connection!');\n return;\n }\n\n this._socket.emit('logout', callback);\n },\n getVersion: function (callback) {\n if (!this._checkConnection('getVersion', arguments)) return;\n\n this._socket.emit('getVersion', function (version) {\n if (callback) callback(version);\n });\n },\n subscribe: function (idOrArray, callback) {\n if (!this._checkConnection('subscribe', arguments)) return;\n\n this._socket.emit('subscribe', idOrArray, callback);\n },\n unsubscribe: function (idOrArray, callback) {\n if (!this._checkConnection('unsubscribe', arguments)) return;\n\n this._socket.emit('unsubscribe', idOrArray, callback);\n },\n _checkAuth: function (callback) {\n if (!this._isConnected) {\n console.log('No connection!');\n return;\n }\n //socket.io\n if (this._socket === null) {\n console.log('socket.io not initialized');\n return;\n }\n this._socket.emit('getVersion', function (version) {\n if (callback)\n callback(version);\n });\n },\n readFile: function (filename, callback, isRemote) {\n if (!callback) throw 'No callback set';\n\n if (this._type === 'local') {\n try {\n var data = storage.get(filename);\n callback(null, data ? JSON.parse(storage.get(filename)) : null);\n } catch (err) {\n callback(err, null);\n }\n } else {\n if (!this._checkConnection('readFile', arguments)) return;\n\n if (!isRemote && typeof app !== 'undefined') {\n app.readLocalFile(filename.replace(/^\\/vis\\.0\\//, ''), callback);\n } else {\n var adapter = this.namespace;\n if (filename[0] === '/') {\n var p = filename.split('/');\n adapter = p[1];\n p.splice(0, 2);\n filename = p.join('/');\n }\n\n this._socket.emit('readFile', adapter, filename, function (err, data, mimeType) {\n setTimeout(function () {\n callback(err, data, filename, mimeType);\n }, 0);\n });\n }\n }\n },\n getMimeType: function (ext) {\n if (ext.indexOf('.') !== -1) ext = ext.toLowerCase().match(/\\.[^.]+$/);\n var _mimeType;\n if (ext === '.css') {\n _mimeType = 'text/css';\n } else if (ext === '.bmp') {\n _mimeType = 'image/bmp';\n } else if (ext === '.png') {\n _mimeType = 'image/png';\n } else if (ext === '.jpg') {\n _mimeType = 'image/jpeg';\n } else if (ext === '.jpeg') {\n _mimeType = 'image/jpeg';\n } else if (ext === '.gif') {\n _mimeType = 'image/gif';\n } else if (ext === '.tif') {\n _mimeType = 'image/tiff';\n } else if (ext === '.js') {\n _mimeType = 'application/javascript';\n } else if (ext === '.html') {\n _mimeType = 'text/html';\n } else if (ext === '.htm') {\n _mimeType = 'text/html';\n } else if (ext === '.json') {\n _mimeType = 'application/json';\n } else if (ext === '.xml') {\n _mimeType = 'text/xml';\n } else if (ext === '.svg') {\n _mimeType = 'image/svg+xml';\n } else if (ext === '.eot') {\n _mimeType = 'application/vnd.ms-fontobject';\n } else if (ext === '.ttf') {\n _mimeType = 'application/font-sfnt';\n } else if (ext === '.woff') {\n _mimeType = 'application/font-woff';\n } else if (ext === '.wav') {\n _mimeType = 'audio/wav';\n } else if (ext === '.mp3') {\n _mimeType = 'audio/mpeg3';\n } else {\n _mimeType = 'text/javascript';\n }\n return _mimeType;\n },\n readFile64: function (filename, callback, isRemote) {\n var that = this;\n if (!callback) {\n throw 'No callback set';\n }\n\n if (!this._checkConnection('readFile', arguments)) return;\n\n if (!isRemote && typeof app !== 'undefined') {\n app.readLocalFile(filename.replace(/^\\/vis\\.0\\//, ''), function (err, data, mimeType) {\n setTimeout(function () {\n if (data) {\n callback(err, {mime: mimeType || that.getMimeType(filename), data: btoa(data)}, filename);\n } else {\n callback(err, filename);\n }\n }, 0);\n });\n } else {\n var adapter = this.namespace;\n if (filename[0] === '/') {\n var p = filename.split('/');\n adapter = p[1];\n p.splice(0, 2);\n filename = p.join('/');\n }\n\n this._socket.emit('readFile64', adapter, filename, function (err, data, mimeType) {\n setTimeout(function () {\n if (data) {\n callback(err, {mime: mimeType || that.getMimeType(filename), data: data}, filename);\n } else {\n callback(err, {mime: mimeType || that.getMimeType(filename)}, filename);\n }\n }, 0);\n });\n }\n },\n writeFile: function (filename, data, mode, callback) {\n if (typeof mode === 'function') {\n callback = mode;\n mode = null;\n }\n if (this._type === 'local') {\n storage.set(filename, JSON.stringify(data));\n if (callback) callback();\n } else {\n if (!this._checkConnection('writeFile', arguments)) return;\n\n if (typeof data === 'object') data = JSON.stringify(data, null, 2);\n\n var parts = filename.split('/');\n var adapter = parts[1];\n parts.splice(0, 2);\n if (adapter === 'vis') {\n this._socket.emit('writeFile', adapter, parts.join('/'), data, mode ? {mode: this._defaultMode} : {}, callback);\n } else {\n this._socket.emit('writeFile', this.namespace, filename, data, mode ? {mode: this._defaultMode} : {}, callback);\n }\n }\n },\n // Write file base 64\n writeFile64: function (filename, data, callback) {\n if (!this._checkConnection('writeFile64', arguments)) return;\n\n var parts = filename.split('/');\n var adapter = parts[1];\n parts.splice(0, 2);\n\n this._socket.emit('writeFile', adapter, parts.join('/'), atob(data), {mode: this._defaultMode}, callback);\n },\n readDir: function (dirname, callback) {\n //socket.io\n if (this._socket === null) {\n console.log('socket.io not initialized');\n return;\n }\n if (!dirname) dirname = '/';\n var parts = dirname.split('/');\n var adapter = parts[1];\n parts.splice(0, 2);\n\n this._socket.emit('readDir', adapter, parts.join('/'), {filter: true}, function (err, data) {\n if (callback) callback(err, data);\n });\n },\n mkdir: function (dirname, callback) {\n var parts = dirname.split('/');\n var adapter = parts[1];\n parts.splice(0, 2);\n\n this._socket.emit('mkdir', adapter, parts.join('/'), function (err) {\n if (callback) callback(err);\n });\n },\n unlink: function (name, callback) {\n var parts = name.split('/');\n var adapter = parts[1];\n parts.splice(0, 2);\n\n this._socket.emit('unlink', adapter, parts.join('/'), function (err) {\n if (callback) callback(err);\n });\n },\n renameFile: function (oldname, newname, callback) {\n var parts1 = oldname.split('/');\n var adapter = parts1[1];\n parts1.splice(0, 2);\n var parts2 = newname.split('/');\n parts2.splice(0, 2);\n this._socket.emit('rename', adapter, parts1.join('/'), parts2.join('/'), function (err) {\n if (callback) callback(err);\n });\n },\n setState: function (pointId, value, callback) {\n //socket.io\n if (this._socket === null) {\n //console.log('socket.io not initialized');\n return;\n }\n this._socket.emit('setState', pointId, value, callback);\n },\n // callback(err, data)\n getStates: function (IDs, callback) {\n if (typeof IDs === 'function') {\n callback = IDs;\n IDs = null;\n }\n\n if (this._type === 'local') {\n return callback(null, []);\n } else {\n if (!this._checkConnection('getStates', arguments)) return;\n\n this.gettingStates = this.gettingStates || 0;\n this.gettingStates++;\n if (this.gettingStates > 1) {\n // fix for slow devices\n console.log('Trying to get empty list, because the whole list could not be loaded');\n IDs = [];\n }\n var that = this;\n this._socket.emit('getStates', IDs, function (err, data) {\n that.gettingStates--;\n if (err || !data) {\n if (callback) {\n callback(err || 'Authentication required');\n }\n } else if (callback) {\n callback(null, data);\n }\n });\n }\n },\n _fillChildren: function (objects) {\n var items = [];\n\n for (var id in objects) {\n if (!objects.hasOwnProperty(id)) continue;\n items.push(id);\n }\n items.sort();\n\n for (var i = 0; i < items.length; i++) {\n if (objects[items[i]].common) {\n var j = i + 1;\n var children = [];\n var len = items[i].length + 1;\n var name = items[i] + '.';\n while (j < items.length && items[j].substring(0, len) === name) {\n children.push(items[j++]);\n }\n\n objects[items[i]].children = children;\n }\n }\n },\n // callback(err, data)\n getObjects: function (useCache, callback) {\n if (typeof useCache === 'function') {\n callback = useCache;\n useCache = false;\n }\n // If cache used\n if (this._useStorage && useCache) {\n if (typeof storage !== 'undefined') {\n var objects = this._objects || storage.get('objects');\n if (objects) return callback(null, objects);\n } else if (this._objects) {\n return callback(null, this._objects);\n }\n }\n\n if (!this._checkConnection('getObjects', arguments)) return;\n var that = this;\n this._socket.emit('getObjects', function (err, data) {\n // Read all enums\n that._socket.emit('getObjectView', 'system', 'enum', {startkey: 'enum.', endkey: 'enum.\\u9999'}, function (err, res) {\n if (err) {\n callback(err);\n return;\n }\n var enums = {};\n for (var i = 0; i < res.rows.length; i++) {\n data[res.rows[i].id] = res.rows[i].value;\n enums[res.rows[i].id] = res.rows[i].value;\n }\n\n // Read all adapters for images\n that._socket.emit('getObjectView', 'system', 'instance', {startkey: 'system.adapter.', endkey: 'system.adapter.\\u9999'}, function (err, res) {\n if (err) {\n callback(err);\n return;\n }\n for (var i = 0; i < res.rows.length; i++) {\n data[res.rows[i].id] = res.rows[i].value;\n }\n // find out default file mode\n if (data['system.adapter.' + that.namespace] &&\n data['system.adapter.' + that.namespace].native &&\n data['system.adapter.' + that.namespace].native.defaultFileMode) {\n that._defaultMode = data['system.adapter.' + that.namespace].native.defaultFileMode;\n }\n\n // Read all channels for images\n that._socket.emit('getObjectView', 'system', 'channel', {startkey: '', endkey: '\\u9999'}, function (err, res) {\n if (err) {\n callback(err);\n return;\n }\n for (var i = 0; i < res.rows.length; i++) {\n data[res.rows[i].id] = res.rows[i].value;\n }\n\n // Read all devices for images\n that._socket.emit('getObjectView', 'system', 'device', {startkey: '', endkey: '\\u9999'}, function (err, res) {\n if (err) {\n callback(err);\n return;\n }\n for (var i = 0; i < res.rows.length; i++) {\n data[res.rows[i].id] = res.rows[i].value;\n }\n\n if (that._useStorage) {\n that._fillChildren(data);\n that._objects = data;\n that._enums = enums;\n\n if (typeof storage !== 'undefined') {\n storage.set('objects', data);\n storage.set('enums', enums);\n storage.set('timeSync', (new Date()).getTime());\n }\n }\n\n if (callback) callback(err, data);\n });\n });\n });\n });\n });\n },\n getChildren: function (id, useCache, callback) {\n if (!this._checkConnection('getChildren', arguments)) return;\n\n if (typeof id === 'function') {\n callback = id;\n id = null;\n useCache = false;\n }\n if (typeof id === 'boolean') {\n callback = useCache;\n useCache = id;\n id = null;\n }\n if (typeof useCache === 'function') {\n callback = useCache;\n useCache = false;\n }\n\n if (!id) return callback('getChildren: no id given');\n\n var that = this;\n var data = [];\n\n if (this._useStorage && useCache) {\n if (typeof storage !== 'undefined') {\n var objects = storage.get('objects');\n if (objects && objects[id] && objects[id].children) {\n return callback(null, objects[id].children);\n }\n } else if (this._objects && this._objects[id] && this._objects[id].children) {\n return callback(null, this._objects[id].children);\n }\n }\n\n // Read all devices\n that._socket.emit('getObjectView', 'system', 'device', {startkey: id + '.', endkey: id + '.\\u9999'}, function (err, res) {\n if (err) {\n callback(err);\n return;\n }\n for (var i = 0; i < res.rows.length; i++) {\n data[res.rows[i].id] = res.rows[i].value;\n }\n\n that._socket.emit('getObjectView', 'system', 'channel', {startkey: id + '.', endkey: id + '.\\u9999'}, function (err, res) {\n if (err) {\n callback(err);\n return;\n }\n for (var i = 0; i < res.rows.length; i++) {\n data[res.rows[i].id] = res.rows[i].value;\n }\n\n // Read all adapters for images\n that._socket.emit('getObjectView', 'system', 'state', {startkey: id + '.', endkey: id + '.\\u9999'}, function (err, res) {\n if (err) {\n callback(err);\n return;\n }\n for (var i = 0; i < res.rows.length; i++) {\n data[res.rows[i].id] = res.rows[i].value;\n }\n var list = [];\n\n var count = id.split('.').length;\n\n // find direct children\n for (var _id in data) {\n var parts = _id.split('.');\n if (count + 1 === parts.length) {\n list.push(_id);\n }\n }\n list.sort();\n\n if (that._useStorage && typeof storage !== 'undefined') {\n var objects = storage.get('objects') || {};\n\n for (var id_ in data) {\n objects[id_] = data[id_];\n }\n if (objects[id] && objects[id].common) {\n objects[id].children = list;\n }\n // Store for every element theirs children\n var items = [];\n for (var __id in data) {\n items.push(__id);\n }\n items.sort();\n\n for (var k = 0; k < items.length; k++) {\n if (objects[items[k]].common) {\n var j = k + 1;\n var children = [];\n var len = items[k].length + 1;\n var name = items[k] + '.';\n while (j < items.length && items[j].substring(0, len) === name) {\n children.push(items[j++]);\n }\n\n objects[items[k]].children = children;\n }\n }\n\n storage.set('objects', objects);\n }\n\n if (callback) callback(err, list);\n });\n });\n });\n },\n getObject: function (id, useCache, callback) {\n if (typeof id === 'function') {\n callback = id;\n id = null;\n useCache = false;\n }\n if (typeof id === 'boolean') {\n callback = useCache;\n useCache = id;\n id = null;\n }\n if (typeof useCache === 'function') {\n callback = useCache;\n useCache = false;\n }\n if (!id) return callback('no id given');\n\n // If cache used\n if (this._useStorage && useCache && typeof storage !== 'undefined') {\n if (typeof storage !== 'undefined') {\n var objects = this._objects || storage.get('objects');\n if (objects && objects[id]) return callback(null, objects[id]);\n } else if (this._enums) {\n return callback(null, this._enums);\n }\n }\n\n var that = this;\n\n this._socket.emit('getObject', id, function (err, obj) {\n if (err) {\n callback(err);\n return;\n }\n if (that._useStorage && typeof storage !== 'undefined') {\n var objects = storage.get('objects') || {};\n objects[id] = obj;\n storage.set('objects', objects);\n }\n return callback(null, obj);\n });\n },\n getGroups: function (groupName, useCache, callback) {\n if (typeof groupName === 'function') {\n callback = groupName;\n groupName = null;\n useCache = false;\n }\n if (typeof groupName === 'boolean') {\n callback = useCache;\n useCache = groupName;\n groupName = null;\n }\n if (typeof useCache === 'function') {\n callback = useCache;\n useCache = false;\n }\n groupName = groupName || '';\n\n // If cache used\n if (this._useStorage && useCache) {\n if (typeof storage !== 'undefined') {\n var groups = this._groups || storage.get('groups');\n if (groups) return callback(null, groups);\n } else if (this._groups) {\n return callback(null, this._groups);\n }\n }\n if (this._type === 'local') {\n return callback(null, []);\n } else {\n var that = this;\n // Read all enums\n this._socket.emit('getObjectView', 'system', 'group', {startkey: 'system.group.' + groupName, endkey: 'system.group.' + groupName + '\\u9999'}, function (err, res) {\n if (err) {\n callback(err);\n return;\n }\n var groups = {};\n for (var i = 0; i < res.rows.length; i++) {\n var obj = res.rows[i].value;\n groups[obj._id] = obj;\n }\n if (that._useStorage) {\n that._groups = groups;\n\n if (typeof storage !== 'undefined') {\n storage.set('groups', groups);\n }\n }\n \n callback(null, groups);\n });\n }\n },\n getEnums: function (enumName, useCache, callback) {\n if (typeof enumName === 'function') {\n callback = enumName;\n enumName = null;\n useCache = false;\n }\n if (typeof enumName === 'boolean') {\n callback = useCache;\n useCache = enumName;\n enumName = null;\n }\n if (typeof useCache === 'function') {\n callback = useCache;\n useCache = false;\n }\n\n // If cache used\n if (this._useStorage && useCache) {\n if (typeof storage !== 'undefined') {\n var enums = this._enums || storage.get('enums');\n if (enums) return callback(null, enums);\n } else if (this._enums) {\n return callback(null, this._enums);\n }\n }\n\n if (this._type === 'local') {\n return callback(null, []);\n } else {\n\n enumName = enumName ? enumName + '.' : '';\n var that = this;\n // Read all enums\n this._socket.emit('getObjectView', 'system', 'enum', {startkey: 'enum.' + enumName, endkey: 'enum.' + enumName + '\\u9999'}, function (err, res) {\n if (err) {\n callback(err);\n return;\n }\n var enums = {};\n for (var i = 0; i < res.rows.length; i++) {\n var obj = res.rows[i].value;\n enums[obj._id] = obj;\n }\n if (that._useStorage && typeof storage !== 'undefined') {\n storage.set('enums', enums);\n }\n callback(null, enums);\n });\n }\n },\n // return time when the objects were synchronized\n getSyncTime: function () {\n if (this._useStorage && typeof storage !== 'undefined') {\n var timeSync = storage.get('timeSync');\n if (timeSync) return new Date(timeSync);\n }\n return null;\n },\n addObject: function (objId, obj, callback) {\n if (!this._isConnected) {\n console.log('No connection!');\n } else\n //socket.io\n if (this._socket === null) {\n console.log('socket.io not initialized');\n }\n },\n delObject: function (objId) {\n if (!this._checkConnection('delObject', arguments)) return;\n\n this._socket.emit('delObject', objId);\n },\n httpGet: function (url, callback) {\n if (!this._isConnected) {\n console.log('No connection!');\n return;\n }\n //socket.io\n if (this._socket === null) {\n console.log('socket.io not initialized');\n return;\n }\n this._socket.emit('httpGet', url, function (data) {\n if (callback) callback(data);\n });\n },\n logError: function (errorText) {\n console.log(\"Error: \" + errorText);\n if (!this._isConnected) {\n //console.log('No connection!');\n return;\n }\n //socket.io\n if (this._socket === null) {\n console.log('socket.io not initialized');\n return;\n }\n this._socket.emit('log', 'error', 'Addon DashUI ' + errorText);\n },\n _queueCmdIfRequired: function (func, args) {\n var that = this;\n if (!this._isAuthDone) {\n // Queue command\n this._cmdQueue.push({func: func, args: args});\n\n if (!this._authRunning) {\n this._authRunning = true;\n // Try to read version\n this._checkAuth(function (version) {\n // If we have got version string, so there is no authentication, or we are authenticated\n that._authRunning = false;\n if (version) {\n that._isAuthDone = true;\n // Repeat all stored requests\n var __cmdQueue = that._cmdQueue;\n // Trigger GC\n that._cmdQueue = null;\n that._cmdQueue = [];\n for (var t = 0, len = __cmdQueue.length; t < len; t++) {\n that[__cmdQueue[t].func].apply(that, __cmdQueue[t].args);\n }\n } else {\n // Auth required\n that._isAuthRequired = true;\n // What for AuthRequest from server\n }\n });\n }\n\n return true;\n } else {\n return false;\n }\n },\n authenticate: function (user, password, salt) {\n this._authRunning = true;\n\n if (user !== undefined) {\n this._authInfo = {\n user: user,\n hash: password + salt,\n salt: salt\n };\n }\n\n if (!this._isConnected) {\n console.log('No connection!');\n return;\n }\n\n if (!this._authInfo) {\n console.log(\"No credentials!\");\n }\n },\n getConfig: function (useCache, callback) {\n if (!this._checkConnection('getConfig', arguments)) return;\n\n if (typeof useCache === 'function') {\n callback = useCache;\n useCache = false;\n }\n if (this._useStorage && useCache) {\n if (typeof storage !== 'undefined') {\n var objects = storage.get('objects');\n if (objects && objects['system.config']) {\n return callback(null, objects['system.config'].common);\n }\n } else if (this._objects && this._objects['system.config']) {\n return callback(null, this._objects['system.config'].common);\n }\n }\n var that = this;\n this._socket.emit('getObject', 'system.config', function (err, obj) {\n if (callback && obj && obj.common) {\n\n if (that._useStorage && typeof storage !== 'undefined') {\n var objects = storage.get('objects') || {};\n objects['system.config'] = obj;\n storage.set('objects', objects);\n }\n\n callback(null, obj.common);\n } else {\n callback('Cannot read language');\n }\n });\n },\n sendCommand: function (instance, command, data, ack) {\n this.setState(this.namespace + '.control.instance', {val: instance || 'notdefined', ack: true});\n this.setState(this.namespace + '.control.data', {val: data, ack: true});\n this.setState(this.namespace + '.control.command', {val: command, ack: ack === undefined ? true : ack});\n },\n _detectViews: function (projectDir, callback) {\n this.readDir('/' + this.namespace + '/' + projectDir, function (err, dirs) {\n // find vis-views.json\n for (var f = 0; f < dirs.length; f++) {\n if (dirs[f].file === 'vis-views.json' && (!dirs[f].acl || dirs[f].acl.read)) {\n return callback(err, {name: projectDir, readOnly: (dirs[f].acl && !dirs[f].acl.write), mode: dirs[f].acl ? dirs[f].acl.permissions : 0});\n }\n }\n callback(err);\n });\n },\n readProjects: function (callback) {\n var that = this;\n this.readDir('/' + this.namespace, function (err, dirs) {\n var result = [];\n var count = 0;\n for (var d = 0; d < dirs.length; d++) {\n if (dirs[d].isDir) {\n count++;\n that._detectViews(dirs[d].file, function (subErr, project) {\n if (project) result.push(project);\n\n err = err || subErr;\n if (!(--count)) callback(err, result);\n });\n }\n }\n });\n },\n chmodProject: function (projectDir, mode, callback) {\n //socket.io\n if (this._socket === null) {\n console.log('socket.io not initialized');\n return;\n }\n this._socket.emit('chmodFile', this.namespace, projectDir + '*', {mode: mode}, function (err, data) {\n if (callback) callback(err, data);\n });\n },\n clearCache: function () {\n if (typeof storage !== 'undefined') {\n storage.empty();\n }\n },\n getHistory: function (id, options, callback) {\n if (!this._checkConnection('getHistory', arguments)) return;\n\n if (!options) options = {};\n if (!options.timeout) options.timeout = 2000;\n\n var timeout = setTimeout(function () {\n timeout = null;\n callback('timeout');\n }, options.timeout);\n this._socket.emit('getHistory', id, options, function (err, result) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n callback(err, result);\n });\n },\n getLiveHost: function (cb) {\n var that = this;\n this._socket.emit('getObjectView', 'system', 'host', {startkey: 'system.host.', endkey: 'system.host.\\u9999'}, function (err, res) {\n var _hosts = [];\n for (var h = 0; h < res.rows.length; h++) {\n _hosts.push(res.rows[h].id + '.alive');\n }\n if (!_hosts.length) {\n cb('');\n return;\n }\n that.getStates(_hosts, function (err, states) {\n for (var h in states) {\n if (states.hasOwnProperty(h) && (states[h].val === 'true' || states[h].val === true)) {\n cb(h.substring(0, h.length - '.alive'.length));\n return;\n }\n }\n cb('');\n });\n });\n },\n readDirAsZip: function (project, useConvert, callback) {\n if (!callback) {\n callback = useConvert;\n useConvert = undefined;\n }\n if (!this._isConnected) {\n console.log('No connection!');\n return;\n }\n //socket.io\n if (this._socket === null) {\n console.log('socket.io not initialized');\n return;\n }\n if (project.match(/\\/$/)) project = project.substring(0, project.length - 1);\n var that = this;\n this.getLiveHost(function (host) {\n if (!host) {\n window.alert('No active host found');\n return;\n }\n // to do find active host\n that._socket.emit('sendToHost', host, 'readDirAsZip', {\n id: that.namespace,\n name: project || 'main',\n options: {\n settings: useConvert\n }\n }, function (data) {\n if (data.error) console.error(data.error);\n if (callback) callback(data.error, data.data);\n });\n\n });\n },\n writeDirAsZip: function (project, base64, callback) {\n if (!this._isConnected) {\n console.log('No connection!');\n return;\n }\n //socket.io\n if (this._socket === null) {\n console.log('socket.io not initialized');\n return;\n }\n if (project.match(/\\/$/)) project = project.substring(0, project.length - 1);\n var that = this;\n this.getLiveHost(function (host) {\n if (!host) {\n window.alert('No active host found');\n return;\n }\n that._socket.emit('sendToHost', host, 'writeDirAsZip', {\n id: that.namespace,\n name: project || 'main',\n data: base64\n }, function (data) {\n if (data.error) console.error(data.error);\n if (callback) callback(data.error);\n });\n\n });\n }\n};\n","/**\n * Copyright 2018 bluefox <dogafox@gmail.com>\n *\n * The MIT License (MIT)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n **/\n// Version 0.1.0, 2018.08.14\n\n'use strict';\n\nvar Types = {\n unknown: 'unknown',\n\n blind: 'blind',\n button: 'button',\n camera: 'camera',\n url: 'url',\n image: 'image',\n dimmer: 'dimmer',\n door: 'door',\n fireAlarm: 'fireAlarm',\n floodAlarm: 'floodAlarm',\n gate: 'gate',\n humidity: 'humidity',\n info: 'info',\n instance: 'instance',\n light: 'light',\n lock: 'lock',\n media: 'media',\n motion: 'motion',\n rgb: 'rgb',\n rgbSingle: 'rgbSingle',\n hue: 'hue',\n slider: 'slider',\n socket: 'socket',\n temperature: 'temperature',\n thermostat: 'thermostat',\n valve: 'valve',\n volume: 'volume',\n volumeGroup: 'volumeGroup',\n window: 'window',\n windowTilt: 'windowTilt',\n weatherCurrent: 'weatherCurrent',\n weatherForecast: 'weatherForecast',\n warning: 'warning'\n};\n\n// Description of flags\n// role - RegEx to detect role\n// channelRole - RegEx to detect channel role of state\n// ignoreRole - RegEx to ignore some specific roles\n// indicator - is it will be shown like small icon or as a value\n// type - state type: 'number', 'string' or 'boolean' or array of possible values\n// name - own TAG of the state to process it in the logic\n// write - if set to true or false, it will be checked the write attribute, if no attribute, so \"false\" will be assumed\n// read - if set to true or false, it will be checked the write attribute, if no attribute, so \"true\" will be assumed\n// min - type of attribute: number', 'string' or 'boolean'. This attribute must exists in common\n// max - type of attribute: number', 'string' or 'boolean'. This attribute must exists in common\n// required - if required to detect the pattern as valid\n// noSubscribe - no automatic subscription for this state (e.g if write only)\n// searchInParent - if this pattern should be search in device too and not only in channel\n// enums - function to execute custom category detection\n// multiple - if more than one state may have this pattern in channel\n// noDeviceDetection - do not search indicators in parent device\n// notSingle - this state may belong to more than one tile simultaneously (e.g. volume tile and media with volume)\n// inverted - is state of indicator must be inverted\n// stateName - regex for state names (IDs). Not suggested\n\nfunction ChannelDetector() {\n if (!(this instanceof ChannelDetector)) return new ChannelDetector();\n\n var patternWorking = {role: /^indicator\\.working$/, indicator: true, name: 'WORKING', required: false};\n var patternUnreach = {role: /^indicator(\\.maintenance)?\\.unreach$/, indicator: true, type: 'boolean', name: 'UNREACH', required: false};\n var patternLowbat = {role: /^indicator(\\.maintenance)?\\.lowbat$|^indicator(\\.maintenance)?\\.battery/, indicator: true, type: 'boolean', name: 'LOWBAT', required: false};\n var patternMaintain = {role: /^indicator\\.maintenance$/, indicator: true, type: 'boolean', name: 'MAINTAIN', required: false};\n var patternError = {role: /^indicator\\.error$/, indicator: true, name: 'ERROR', required: false};\n var patternDirection = {role: /^indicator\\.direction$/, indicator: true, name: 'DIRECTION', required: false};\n var patternReachable = {role: /^indicator\\.reachable$/, indicator: true, type: 'boolean', name: 'CONNECTED', required: false, inverted: true};\n\n var patterns = {\n mediaPlayer: {\n // receive the state of player via media.state. Controlling of the player via buttons\n states: [\n // one of\n {role: /^media.state(\\..*)?$/, indicator: false, type: ['boolean', 'number'], name: 'STATE', required: true},\n // optional\n {role: /^button.play(\\..*)?$|^action.play(\\..*)?$/, indicator: false, write: true, type: 'boolean', name: 'PLAY', required: false, noSubscribe: true},\n {role: /^button.pause(\\..*)?$|^action.pause(\\..*)?$/, indicator: false, write: true, type: 'boolean', name: 'PAUSE', required: false, noSubscribe: true},\n {role: /^button.stop(\\..*)?$|^action.stop(\\..*)?$/, indicator: false, write: true, type: 'boolean', name: 'STOP', required: false, noSubscribe: true},\n {role: /^button.next(\\..*)?$|^action.next(\\..*)?$/, indicator: false, write: true, type: 'boolean', name: 'NEXT', required: false, noSubscribe: true},\n {role: /^button.prev(\\..*)?$|^action.prev(\\..*)?$/, indicator: false, write: true, type: 'boolean', name: 'PREV', required: false, noSubscribe: true},\n {role: /^media.mode.shuffle(\\..*)?$/, indicator: false, write: true, type: 'boolean', name: 'SHUFFLE', required: false, noSubscribe: true},\n {role: /^media.mode.repeat(\\..*)?$/, indicator: false, write: true, type: 'number', name: 'REPEAT', required: false, noSubscribe: true},\n {role: /^media.artist(\\..*)?$/, indicator: false, write: false, type: 'string', name: 'ARTIST', required: false},\n {role: /^media.album(\\..*)?$/, indicator: false, write: false, type: 'string', name: 'ALBUM', required: false},\n {role: /^media.title(\\..*)?$/, indicator: false, write: false, type: 'string', name: 'TITLE', required: false},\n // one of following\n [\n {role: /^media.cover$|^media.cover.big$/, indicator: false, write: false, type: 'string', name: 'COVER', required: false, notSingle: true},\n {role: /^media.cover(\\..*)$/, indicator: false, write: false, type: 'string', name: 'COVER', required: false, notSingle: true},\n ],\n {role: /^media.duration(\\..*)?$/, indicator: false, write: false, type: 'number', name: 'DURATION', required: false, noSubscribe: true},\n {role: /^media.elapsed(\\..*)?$/, indicator: false, type: 'number', name: 'ELAPSED', required: false, noSubscribe: true},\n {role: /^media.season(\\..*)?$/, indicator: false, write: true, type: 'number', name: 'SEEK', required: false, noSubscribe: true},\n {role: /^media.seek(\\..*)?$/, indicator: false, write: true, type: 'number', name: 'SEEK', required: false, noSubscribe: true},\n {role: /^media.track(\\..*)?$/, indicator: false, type: 'string', name: 'TRACK', required: false, noSubscribe: true},\n {role: /^media.episode(\\..*)?$/, indicator: false, type: 'string', name: 'EPISODE', required: false, noSubscribe: true},\n {role: /^media.season(\\..*)?$/, indicator: false, type: 'string', name: 'SEASON', required: false, noSubscribe: true},\n {role: /^level.volume?$/, indicator: false, type: 'number', min: 'number', max: 'number', write: true, name: 'VOLUME', required: false, notSingle: true, noSubscribe: true},\n {role: /^value.volume?$/, indicator: false, type: 'number', min: 'number', max: 'number', write: false, name: 'VOLUME_ACTUAL', required: false, notSingle: true, noSubscribe: true},\n {role: /^media.mute?$/, indicator: false, type: 'boolean', write: true, name: 'MUTE', required: false, notSingle: true, noSubscribe: true},\n // Ignore following states of chromecast\n {stateName: /\\.paused$|\\.playerState$/, indicator: false, name: 'IGNORE', required: false, multiple: true, noSubscribe: true},\n patternReachable,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.media\n },\n weatherForecast : {\n states: [\n {role: /^weather.icon$|^weather.icon.forecast.0$/, indicator: false, type: 'string', name: 'ICON', required: true},\n {role: /^value.temperature.min.forecast.0$/, indicator: false, type: 'number', name: 'TEMP_MIN', required: true},\n {role: /^value.temperature.max.forecast.0$/, indicator: false, type: 'number', name: 'TEMP_MAX', required: true},\n // optional\n {role: /^value.precipitation$|^value.precipitation.forecast.0$/, indicator: false, type: 'number', name: 'PRECIPITATION_CHANCE', unit: '%', required: false},\n {role: /^date$|^date.forecast.0$/, indicator: false, type: 'string', name: 'DATE', required: false},\n {role: /^dayofweek$|^dayofweek.forecast.0$/, indicator: false, type: 'string', name: 'DOW', required: false},\n {role: /^weather.state$|^weather.state.forecast.0$/, indicator: false, type: 'string', name: 'STATE', required: false},\n {role: /^value.temperature$|^value.temperature.forecast.0$/, indicator: false, type: 'number', name: 'TEMP', required: false},\n {role: /^value.pressure$/, indicator: false, type: 'number', name: 'PRESSURE', required: false},\n\n {role: /^value.humidity$|value.humidity.forecast.0$/, indicator: false, type: 'number', name: 'HUMIDITY', required: false},\n\n {role: /^value.temperature.windchill$|^value.temperature.windchill.forecast.0$/, indicator: false, type: 'number', name: 'WIND_CHILL', required: false},\n {role: /^value.temperature.feelslike$|^value.temperature.feelslike$.forecast.0$/, indicator: false, type: 'number', name: 'FEELS_LIKE', required: false},\n {role: /^value.speed.wind$|^value.speed.wind.forecast.0$/, indicator: false, type: 'number', name: 'WIND_SPEED', required: false},\n {role: /^value.direction.wind$|^value.direction.wind.forecast.0$/, indicator: false, type: 'number', name: 'WIND_DIRECTION',required: false},\n {role: /^weather.direction.wind$|^weather.direction.wind.forecast.0$/, indicator: false, type: 'string', name: 'WIND_DIRECTION_STR',required: false},\n {role: /^weather.icon.wind$|^weather.icon.wind.forecast.0$/, indicator: false, type: 'string', name: 'WIND_ICON', required: false},\n {role: /^weather.chart.url$/, indicator: false, type: 'string', name: 'HISTORY_CHART', required: false, noSubscribe: true},\n {role: /^weather.chart.url.forecast$/, indicator: false, type: 'string', name: 'FORECAST_CHART', required: false, noSubscribe: true},\n {role: /^location$/, indicator: false, type: 'string', name: 'LOCATION', required: false, multiple: true},\n\n // other days\n {role: /^weather.icon.forecast.(\\d)$/, indicator: false, type: 'string', name: 'ICON%d', required: false, searchInParent: true, multiple: true, noSubscribe: true, notSingle: true},\n\n {role: /^value.temperature.min.forecast.(\\d)$/, indicator: false, type: 'number', name: 'TEMP_MIN%d', required: false, searchInParent: true, multiple: true, noSubscribe: true},\n {role: /^value.temperature.max.forecast.(\\d)$/, indicator: false, type: 'number', name: 'TEMP_MAX%d', required: false, searchInParent: true, multiple: true, noSubscribe: true},\n\n {role: /^date.forecast.(\\d)$/, indicator: false, type: 'string', name: 'DATE%d', required: false, searchInParent: true, multiple: true, noSubscribe: true},\n {role: /^dayofweek.forecast.(\\d)$/, indicator: false, type: 'string', name: 'DOW%d', required: false, searchInParent: true, multiple: true, noSubscribe: true},\n {role: /^weather.state.forecast.(\\d)$/, indicator: false, type: 'string', name: 'STATE%d', required: false, searchInParent: true, multiple: true, noSubscribe: true},\n {role: /^value.temperature.forecast.(\\d)$/, indicator: false, type: 'number', name: 'TEMP%d', required: false, searchInParent: true, multiple: true, noSubscribe: true},\n\n {role: /^value.humidity.forecast.(\\d)$/, indicator: false, type: 'number', name: 'HUMIDITY%d', required: false, searchInParent: true, multiple: true, noSubscribe: true},\n {role: /^value.humidity.max.forecast.(\\d)$/, indicator: false, type: 'number', name: 'HUMIDITY_MAX%d', required: false, searchInParent: true, multiple: true, noSubscribe: true},\n\n {role: /^value.precipitation.forecast.(\\d)$/, indicator: false, type: 'number', unit: '%', name: 'PRECIPITATION_CHANCE%d', required: false, searchInParent: true, multiple: true, noSubscribe: true},\n\n {role: /^value.speed.wind.forecast.(\\d)$/, indicator: false, type: 'number', name: 'WIND_SPEED%d', required: false, searchInParent: true, multiple: true, noSubscribe: true},\n {role: /^value.direction.wind.forecast.(\\d)$/, indicator: false, type: 'number', name: 'WIND_DIRECTION%d',required: false, searchInParent: true, multiple: true, noSubscribe: true},\n {role: /^weather.direction.wind.forecast.(\\d)$/, indicator: false, type: 'string', name: 'WIND_DIRECTION_STR%d',required: false, searchInParent: true, multiple: true, noSubscribe: true},\n {role: /^weather.icon.wind.forecast.(\\d)$/, indicator: false, type: 'string', name: 'WIND_ICON%d', required: false, searchInParent: true, multiple: true, noSubscribe: true},\n ],\n type: Types.weatherForecast\n },\n rgb: {\n states: [\n {role: /^level\\.color\\.red$/, indicator: false, type: 'number', write: true, name: 'RED', required: true},\n {role: /^level\\.color\\.green$/, indicator: false, type: 'number', write: true, name: 'GREEN', required: true},\n {role: /^level\\.color\\.blue$/, indicator: false, type: 'number', write: true, name: 'BLUE', required: true},\n {role: /^level\\.dimmer$/, indicator: false, type: 'number', write: true, name: 'DIMMER', required: false},\n {role: /^level\\.brightness$/, indicator: false, type: 'number', write: true, name: 'BRIGHTNESS', required: false},\n {role: /^level\\.color\\.saturation$/, indicator: false, type: 'number', write: true, name: 'SATURATION', required: false},\n {role: /^level\\.color\\.temperature$/, indicator: false, type: 'number', write: true, name: 'TEMPERATURE', required: false},\n {role: /^switch\\.light$/, indicator: false, type: 'boolean', write: true, name: 'ON_LIGHT', required: false},\n {role: /^switch$/, indicator: false, type: 'boolean', write: true, name: 'ON', required: false},\n patternWorking,\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.rgb\n },\n // remove it when all adapters fixed (2018.08.15) r=>red, g=>green, b=>blue\n rgbOld: {\n states: [\n {role: /^level\\.color\\.r$/, indicator: false, type: 'number', write: true, name: 'RED', required: true},\n {role: /^level\\.color\\.g$/, indicator: false, type: 'number', write: true, name: 'GREEN', required: true},\n {role: /^level\\.color\\.b$/, indicator: false, type: 'number', write: true, name: 'BLUE', required: true},\n {role: /^level\\.dimmer$/, indicator: false, type: 'number', write: true, name: 'DIMMER', required: false},\n {role: /^level\\.brightness$/, indicator: false, type: 'number', write: true, name: 'BRIGHTNESS', required: false},\n {role: /^level\\.color\\.saturation$/, indicator: false, type: 'number', write: true, name: 'SATURATION', required: false},\n {role: /^level\\.color\\.temperature$/, indicator: false, type: 'number', write: true, name: 'TEMPERATURE', required: false},\n {role: /^switch\\.light$/, indicator: false, type: 'boolean', write: true, name: 'ON_LIGHT', required: false},\n {role: /^switch$/, indicator: false, type: 'boolean', write: true, name: 'ON', required: false},\n patternWorking,\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.rgb\n },\n rgbSingle: {\n states: [\n {role: /^level\\.color\\.rgb$/, indicator: false, type: 'string', write: true, name: 'RGB', required: true},\n {role: /^level\\.dimmer$/, indicator: false, type: 'number', write: true, name: 'DIMMER', required: false},\n {role: /^level\\.brightness$/, indicator: false, type: 'number', write: true, name: 'BRIGHTNESS', required: false},\n {role: /^level\\.color\\.saturation$/, indicator: false, type: 'number', write: true, name: 'SATURATION', required: false},\n {role: /^level\\.color\\.temperature$/, indicator: false, type: 'number', write: true, name: 'TEMPERATURE', required: false},\n {role: /^switch\\.light$/, indicator: false, type: 'boolean', write: true, name: 'ON_LIGHT', required: false},\n {role: /^switch$/, indicator: false, type: 'boolean', write: true, name: 'ON', required: false},\n patternWorking,\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.rgbSingle\n },\n hue: {\n states: [\n {role: /^level\\.color\\.hue$/, indicator: false, type: 'number', write: true, name: 'HUE', required: true},\n {role: /^level\\.dimmer$/, indicator: false, type: 'number', write: true, name: 'DIMMER', required: false, searchInParent: true},\n {role: /^level\\.brightness$/, indicator: false, type: 'number', write: true, name: 'BRIGHTNESS', required: false},\n {role: /^level\\.color\\.saturation$/, indicator: false, type: 'number', write: true, name: 'SATURATION', required: false},\n {role: /^level\\.color\\.temperature$/, indicator: false, type: 'number', write: true, name: 'TEMPERATURE', required: false},\n {role: /^switch.light$/, indicator: false, type: 'boolean', write: true, name: 'ON', required: false},\n {role: /^switch$/, indicator: false, type: 'boolean', write: true, name: 'ON', required: false},\n patternWorking,\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.hue\n },\n warning: {\n states: [\n {role: /^value\\.warning$/, indicator: false, name: 'LEVEL', required: true},\n // optional\n {role: /^weather\\.title\\.short$/, indicator: false, type: 'string', name: 'TITLE', required: false},\n {role: /^weather\\.title$/, indicator: false, type: 'string', name: 'INFO', required: false},\n {role: /^date\\.start$/, indicator: false, type: 'string', name: 'START', required: false},\n {role: /^date\\.end$/, indicator: false, type: 'string', name: 'END', required: false},\n {role: /^date$/, indicator: false, type: 'string', name: 'START', required: false},\n {role: /^weather\\.chart\\.url/, indicator: false, type: 'string', name: 'ICON', required: false},\n\n // For detailed screen\n {role: /^weather\\.state$/, indicator: false, type: 'string', name: 'DESC', required: false, noSubscribe: true},\n ],\n type: Types.warning\n },\n thermostat: {\n states: [\n {role: /temperature(\\..*)?$/, indicator: false, write: true, type: 'number', name: 'SET', required: true},\n // optional\n {role: /temperature(\\..*)?$/, indicator: false, write: false, type: 'number', searchInParent: true, name: 'ACTUAL', required: false},\n {role: /humidity(\\..*)?$/, indicator: false, write: false, type: 'number', searchInParent: true, name: 'HUMIDITY', required: false},\n {role: /^switch\\.boost(\\..*)?$/, indicator: false, write: true, type: 'number', searchInParent: true, name: 'BOOST', required: false},\n patternWorking,\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.thermostat\n },\n blinds: {\n states: [\n {role: /^level(\\.blind)?$/, indicator: false, type: 'number', write: true, enums: roleOrEnumBlind, name: 'SET', required: true},\n // optional\n {role: /^value(\\.blind)?$/, indicator: false, type: 'number', enums: roleOrEnumBlind, name: 'ACTUAL', required: false},\n {role: /^button\\.stop$|^action\\.stop$/, indicator: false, type: 'boolean', write: true, enums: roleOrEnumBlind, name: 'STOP', required: false, noSubscribe: true},\n patternDirection,\n patternWorking,\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.blind\n },\n lock: {\n states: [\n {role: /^switch\\.lock$/, indicator: false, type: 'boolean', write: true, name: 'SET', required: true},\n // optional\n {role: /^state$/, indicator: false, type: 'boolean', write: false, name: 'ACTUAL', required: false},\n { indicator: false, type: 'boolean', write: true, read: false, name: 'OPEN', required: false, noSubscribe: true},\n patternDirection,\n patternWorking,\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.lock\n },\n motion: {\n states: [\n {role: /^state\\.motion$|^sensor\\.motion$/, indicator: false, type: 'boolean', name: 'ACTUAL', required: true},\n // optional\n {role: /brightness$/, indicator: false, type: 'number', name: 'SECOND', required: false},\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.motion\n },\n window: {\n states: [\n {role: /^state(\\.window)?$|^sensor(\\.window)?/, indicator: false, type: 'boolean', enums: roleOrEnumWindow, name: 'ACTUAL', required: true},\n // optional\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.window\n },\n windowTilt: {\n states: [\n {role: /^state?$|^value(\\.window)?$/, indicator: false, type: 'number', enums: roleOrEnumWindow, name: 'ACTUAL', required: true},\n // optional\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.windowTilt\n },\n fireAlarm: {\n states: [\n {role: /^state?$|^sensor(\\.alarm)?\\.fire/, indicator: false, type: 'boolean', name: 'ACTUAL', required: true, channelRole: /^sensor(\\.alarm)?\\.fire$/},\n // optional\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.fireAlarm\n },\n door: {\n states: [\n {role: /^state?$|^state(\\.door)?$|^sensor(\\.door)?/, indicator: false, type: 'boolean', write: false, enums: roleOrEnumDoor, name: 'ACTUAL', required: true},\n // optional\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.door\n },\n dimmer: {\n states: [\n {role: /^level(\\.dimmer)?|^level\\.brightness$/, indicator: false, type: 'number', write: true, enums: roleOrEnumLight, name: 'SET', required: true},\n // optional\n {role: /^value(\\.dimmer)?$/, indicator: false, type: 'number', write: false, enums: roleOrEnumLight, name: 'ACTUAL', required: false},\n {role: /^switch(\\.light)?$|^state$/, indicator: false, type: 'boolean', write: true, enums: roleOrEnumLight, name: 'ON_SET', required: false},\n {role: /^switch(\\.light)?$|^state$/, indicator: false, type: 'boolean', write: false, enums: roleOrEnumLight, name: 'ON_ACTUAL', required: false},\n patternWorking,\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.dimmer\n },\n light: {\n states: [\n {role: /^switch(\\.light)?$|^state$/, indicator: false, type: 'boolean', write: true, enums: roleOrEnumLight, name: 'SET', required: true},\n // optional\n {role: /^switch(\\.light)?$|^state$/, indicator: false, type: 'boolean', write: false, enums: roleOrEnumLight, name: 'ACTUAL', required: false},\n patternWorking,\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.light\n },\n volume: {\n states: [\n {role: /^level\\.volume$/, indicator: false, type: 'number', min: 'number', max: 'number', write: true, name: 'SET', required: true},\n // optional\n {role: /^value\\.volume$/, indicator: false, type: 'number', min: 'number', max: 'number', write: false, name: 'ACTUAL', required: false},\n {role: /^media\\.mute$/, indicator: false, type: 'boolean', write: true, name: 'MUTE', required: false},\n patternWorking,\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.volume\n },\n volumeGroup: {\n states: [\n {role: /^level\\.volume\\.group?$/, indicator: false, type: 'number', min: 'number', max: 'number', write: true, name: 'SET', required: true},\n {role: /^value\\.volume\\.group$/, indicator: false, type: 'number', min: 'number', max: 'number', write: false, name: 'ACTUAL', required: false},\n {role: /^media\\.mute\\.group$/, indicator: false, type: 'boolean', write: true, name: 'MUTE', required: false},\n patternWorking,\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.volumeGroup\n },\n levelSlider: {\n states: [\n {role: /^level(\\..*)?$/, indicator: false, type: 'number', min: 'number', max: 'number', write: true, name: 'SET', required: true},\n {role: /^value(\\..*)?$/, indicator: false, type: 'number', min: 'number', max: 'number', write: false, name: 'ACTUAL', required: false},\n patternWorking,\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.slider\n },\n socket: {\n states: [\n {role: /^switch$|^state$|^switch\\.active$/, indicator: false, type: 'boolean', write: true, name: 'SET', required: true},\n {role: /^state$|^state\\.active$/, indicator: false, type: 'boolean', write: false, name: 'ACTUAL', required: false},\n patternWorking,\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.socket\n },\n button: {\n states: [\n {role: /^button(\\.[.\\w]+)?$|^action(\\.[.\\w]+)?$/, indicator: false, type: 'boolean', read: false, write: true, name: 'SET', required: true, noSubscribe: true},\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.button\n },\n temperature: {\n states: [\n {role: /temperature$/, indicator: false, write: false, type: 'number', name: 'ACTUAL', required: true},\n {role: /humidity$/, indicator: false, write: false, type: 'number', name: 'SECOND', required: false},\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.temperature\n },\n info: {\n states: [\n { indicator: false, name: 'ACTUAL', required: true, multiple: true, noDeviceDetection: true, ignoreRole: /\\.inhibit$/},\n patternWorking,\n patternUnreach,\n patternLowbat,\n patternMaintain,\n patternError\n ],\n type: Types.info\n }\n };\n\n function checkEnum(obj, enums, words) {\n var found = false;\n if (enums) {\n enums.forEach(function(en) {\n var pos = en.lastIndexOf('.');\n if (pos !== -1) {\n en = en.substring(pos + 1);\n }\n for (var lang in words) {\n if (words.hasOwnProperty(lang)) {\n if (words[lang].find(function (reg) {return reg.test(en);})) {\n found = true;\n return false;\n }\n }\n }\n });\n }\n return found;\n }\n\n function roleOrEnum(obj, enums, roles, words) {\n if (roles && roles.indexOf(obj.common.role) !== -1) {\n return true;\n }\n return checkEnum(obj, enums, words);\n }\n\n// -------------- LIGHT -----------------------------------------\n var lightWords = {\n en: [/lights?/i, /lamps?/i, /ceilings?/i],\n de: [/licht(er)?/i, /lampen?/i, /beleuchtung(en)?/i],\n ru: [/свет/i, /ламп[аы]/i, /торшеры?/, /подсветк[аи]/i, /лампочк[аи]/i, /светильники?/i]\n };\n var lightRoles = ['switch.light', 'dimmer', 'value.dimmer', 'level.dimmer', 'sensor.light', 'state.light'];\n function roleOrEnumLight(obj, enums) {\n return roleOrEnum(obj, enums, lightRoles, lightWords);\n }\n\n// -------------- BLINDS -----------------------------------------\n var blindWords = {\n en: [/blinds?/i, /windows?/i, /shutters?/i],\n de: [/rollladen?/i, /fenstern?/i, /beschattung(en)?/i],\n ru: [/ставни/i, /рольставни/i, /окна|окно/, /жалюзи/i]\n };\n\n var blindRoles = ['blind', 'level.blind', 'value.blind', 'action.stop', 'button.stop'];\n function roleOrEnumBlind(obj, enums) {\n return roleOrEnum(obj, enums, blindRoles, blindWords);\n }\n\n// -------------- WINDOWS -----------------------------------------\n var windowRoles = ['window', 'state.window', 'sensor.window', 'value.window'];\n function roleOrEnumWindow(obj, enums) {\n return roleOrEnum(obj, enums, windowRoles, blindWords);\n }\n\n// -------------- DOORS -----------------------------------------\n var doorsWords = {\n en: [/doors?/i, /gates?/i, /wickets?/i, /entry|entries/i],\n de: [/türe?/i, /tuere?/i, /tore?/i, /einfahrt(en)?/i, /pforten?/i],\n ru: [/двери|дверь/i, /ворота/i, /калитка|калитки/, /въезды?/i, /входы?/i]\n };\n\n var doorsRoles = ['door', 'state.door', 'sensor.door'];\n function roleOrEnumDoor(obj, enums) {\n return roleOrEnum(obj, enums, doorsRoles, doorsWords);\n }\n\n function getAllStatesInChannel(keys, channelId) {\n var list = [];\n var reg = new RegExp('^' + channelId.replace(/\\./g, '\\\\.') + '\\\\.[^.]+$');\n keys.forEach(function(_id) {\n if (reg.test(_id)) list.push(_id);\n });\n return list;\n }\n function getAllStatesInDevice(keys, channelId) {\n var list = [];\n var reg = new RegExp('^' + channelId.replace(/\\./g, '\\\\.') + '\\\\.[^.]+\\\\.[^.]+$');\n keys.forEach(function(_id) {\n if (reg.test(_id)) list.push(_id);\n });\n return list;\n }\n\n function getFunctionEnums(objects) {\n var enums = [];\n var reg = /^enum\\.functions\\./;\n for (var id in objects) {\n if (objects.hasOwnProperty(id) && reg.test(id) && objects[id] && objects[id].type === 'enum' && objects[id].common && objects[id].common.members && objects[id].common.members.length) {\n enums.push(id);\n }\n }\n return enums;\n }\n\n function getParentId(id) {\n var pos = id.lastIndexOf('.');\n if (pos !== -1) {\n return id.substring(0, pos);\n } else {\n return id;\n }\n }\n\n this._applyPattern = function (objects, id, statePattern) {\n if (objects[id] && objects[id].common) {\n var role = null;\n if (!statePattern) {\n debugger;\n }\n if (statePattern.role) {\n role = statePattern.role.test(objects[id].common.role || '');\n\n if (role && statePattern.channelRole) {\n var channelId = getParentId(id);\n if (objects[channelId] && (objects[channelId].type === 'channel' || objects[channelId].type === 'device')) {\n role = statePattern.channelRole.test(objects[channelId].common.role);\n } else {\n role = false;\n }\n }\n }\n if (role === false) {\n return;\n }\n\n if (statePattern.stateName && !statePattern.stateName.test(id)) {\n return false;\n }\n if (statePattern.unit && statePattern.unit !== objects[id].common.unit) {\n return false;\n }\n\n if (statePattern.ignoreRole && statePattern.ignoreRole.test(objects[id].common.role)) {\n return;\n }\n\n if (statePattern.indicator === false && (objects[id].common.role || '').match(/^indicator(\\.[.\\w]+)?$/)) {\n return;\n }\n\n if (statePattern.state && !statePattern.state.test(id.split('.').pop())) {\n return;\n }\n\n if (statePattern.write !== undefined && statePattern.write !== (objects[id].common.write || false)) {\n return;\n }\n if (statePattern.min === 'number' && typeof objects[id].common.min !== 'number') {\n return;\n }\n if (statePattern.max === 'number' && typeof objects[id].common.max !== 'number') {\n return;\n }\n\n if (statePattern.read !== undefined && statePattern.read !== (objects[id].common.read === undefined ? true : objects[id].common.read)) {\n return;\n }\n\n if (statePattern.type) {\n if (typeof statePattern.type === 'string') {\n if (statePattern.type !== objects[id].common.type) {\n return;\n }\n } else {\n var noOneOk = true;\n for (var t = 0; t < statePattern.type.length; t++) {\n if (statePattern.type[t] === objects[id].common.type) {\n noOneOk = false;\n break;\n }\n }\n if (noOneOk) {\n return;\n }\n }\n }\n\n if (statePattern.enums && typeof statePattern.enums === 'function') {\n var enums = this._getEnumsForId(objects, id);\n if (!statePattern.enums(objects[id], enums)) {\n return;\n }\n }\n\n return true;\n } else {\n return false;\n }\n };\n\n this._getEnumsForId = function (objects, id) {\n this.enums = this.enums || getFunctionEnums(objects);\n var result = [];\n this.enums.forEach(function (e) {\n if (objects[e].common.members.indexOf(id) !== -1) {\n result.push(e);\n }\n });\n if (!result.length && objects[id] && objects[id].type === 'state') {\n var channel = getParentId(id);\n if (objects[channel] && (objects[channel].type === 'channel' || objects[channel].type === 'device')) {\n this.enums.forEach(function (e) {\n if (objects[e].common.members.indexOf(channel) !== -1) {\n result.push(e);\n }\n });\n }\n }\n\n return result.length ? result : null;\n };\n\n function copyState(oldState, newState) {\n if (!newState) {\n newState = JSON.parse(JSON.stringify(oldState));\n }\n\n if (newState instanceof Array) {\n for (var t = 0; t < newState.length; t++) {\n newState[t].original = oldState[t].original || oldState[t];\n if (oldState[t].enums) {\n newState[t].enums = oldState[t].enums;\n }\n if (oldState[t].role) {\n newState[t].role = oldState[t].role;\n }\n if (oldState[t].channelRole) {\n newState[t].channelRole = oldState[t].channelRole;\n }\n if (oldState[t].icon) {\n newState[t].icon = oldState[t].icon;\n }\n }\n } else {\n newState.original = oldState.original || oldState;\n if (oldState.enums) {\n newState.enums = oldState.enums;\n }\n if (oldState.role) {\n newState.role = oldState.role;\n }\n if (oldState.channelRole) {\n newState.channelRole = oldState.channelRole;\n }\n if (oldState.icon) {\n newState.icon = oldState.icon;\n }\n }\n\n return newState;\n }\n\n this._testOneState = function (context) {\n var objects = context.objects;\n var pattern = context.pattern;\n var state = context.state;\n var channelStates = context.channelStates;\n var usedIds = context.usedIds;\n var _usedIds = context._usedIds;\n var ignoreIndicators = context.ignoreIndicators;\n var result = context.result;\n var found = false;\n\n channelStates.forEach(function (_id) {\n if ((state.indicator || (usedIds.indexOf(_id) === -1 && (state.notSingle || _usedIds.indexOf(_id) === -1))) &&\n this._applyPattern(objects, _id, state)) {\n if (state.indicator && ignoreIndicators) {\n var parts = _id.split('.');\n\n if (ignoreIndicators.indexOf(parts.pop()) !== -1) {\n console.log(_id + ' ignored');\n return;\n }\n }\n\n if (!state.indicator && !state.notSingle){\n _usedIds.push(_id);\n }\n if (!result) {\n context.result = result = JSON.parse(JSON.stringify(patterns[pattern]));\n result.states.forEach(function (state, j) {\n copyState(patterns[pattern].states[j], state);\n });\n }\n if (!result.type) {\n debugger;\n }\n\n if (!result.states.find(function (e) {return e.id === _id;})) {\n var _found = false;\n for (var u = 0; u < result.states.length; u++) {\n if (result.states[u] instanceof Array) {\n for (var c = 0; c < result.states[u].length; c++) {\n if (result.states[u][c].name === state.name && result.states[u][c].role === state.role) {\n result.states[u] = result.states[u][c];\n result.states[u].id = _id;\n _found = true;\n break;\n }\n }\n if (_found) {\n break;\n }\n } else {\n if (result.states[u].name === state.name) {\n result.states[u].id = _id;\n _found = true;\n break;\n }\n }\n }\n if (!_found) {\n console.error('Cannot find state for ' + _id);\n }\n }\n found = true;\n if (state.multiple && channelStates.length > 1) {\n // execute this rule for every state in this channel\n channelStates.forEach(function (cid) {\n if (cid === _id) return;\n if ((state.indicator || (usedIds.indexOf(cid) === -1 && (state.notSingle || _usedIds.indexOf(cid) === -1))) &&\n this._applyPattern(objects, cid, state)) {\n if (!state.indicator && !state.notSingle){\n _usedIds.push(cid);\n }\n var newState = copyState(state);\n newState.id = cid;\n result.states.push(newState);\n }\n }.bind(this));\n }\n return false; // stop iteration\n }\n }.bind(this));\n return found;\n };\n\n this._detectNext = function (options) {\n var objects = options.objects;\n var id = options.id;\n var keys = options._keysOptional;\n var usedIds = options._usedIdsOptional;\n var ignoreIndicators = options.ignoreIndicators;\n var allowedTypes = options.allowedTypes;\n\n if (!usedIds) {\n usedIds = [];\n options._usedIdsOptional = usedIds;\n }\n\n if (objects[id] && objects[id].common) {\n var channelStates;\n\n if (objects[id].type === 'state') {\n channelStates = [id];\n } else if (objects[id].type === 'device') {\n channelStates = getAllStatesInDevice(keys, id);\n } else { // channel\n channelStates = getAllStatesInChannel(keys, id);\n }\n\n if (id.indexOf('javascript.0.devices.valueSimple') !== -1) {\n console.log('aaa');\n }\n var context = {\n objects: objects,\n channelStates: channelStates,\n usedIds: usedIds,\n ignoreIndicators: ignoreIndicators\n };\n\n for (var pattern in patterns) {\n if (!patterns.hasOwnProperty(pattern) || (allowedTypes && allowedTypes.indexOf(patterns[pattern].type) === -1)) continue;\n context.result = null;\n\n if (pattern === 'hue' && id.indexOf('yeelight-2.0') !== -1) {\n console.log(pattern);\n }\n\n var _usedIds = [];\n context.pattern = pattern;\n context._usedIds = _usedIds;\n patterns[pattern].states.forEach(function (state) {\n var found = false;\n\n if (state.name === 'ON') {\n //console.log('ON');\n }\n\n // one of following\n if (state instanceof Array) {\n for (var s = 0; s < state.length; s++) {\n context.state = state[s];\n if (this._testOneState(context)) {\n found = true;\n break;\n }\n }\n if (!found) {\n context.result = null;\n return false;\n }\n } else {\n context.state = state;\n if (this._testOneState(context)) {\n found = true;\n }\n if (state.required && !found) {\n context.result = null;\n return false;\n }\n }\n }.bind(this));\n\n // if all required states found?\n var allRequiredFound = true;\n if (context.result) {\n for (var a = 0; a < context.result.states.length; a++) {\n if (context.result.states[a] instanceof Array) {\n // one of\n var oneOf = false;\n for (var b = 0; b < context.result.states[a].length; b++) {\n if (context.result.states[a][b].required && context.result.states[a].id) {\n oneOf = true;\n break;\n }\n }\n if (!oneOf) {\n allRequiredFound = false;\n break;\n }\n } else {\n if (context.result.states[a].required && !context.result.states[a].id) {\n allRequiredFound = false;\n break;\n }\n }\n }\n } else {\n allRequiredFound = false;\n }\n\n\n if (allRequiredFound) {\n _usedIds.forEach(function (id) {usedIds.push(id);});\n // context.result.id = id;\n //this.cache[id] = context.result;\n var deviceStates;\n\n if (pattern === 'info') {\n //console.log('AA');\n }\n\n // looking for indicators and special states\n if (objects[id].type !== 'device') {\n // get device name\n var deviceId = getParentId(id);\n if (objects[deviceId] && (objects[deviceId].type === 'channel' || objects[deviceId].type === 'device')) {\n deviceStates = getAllStatesInDevice(keys, deviceId);\n if (deviceStates) {\n deviceStates.forEach(function (_id) {\n context.result.states.forEach(function (state, i) {\n if (!state.id && (state.indicator || state.searchInParent) && !state.noDeviceDetection) {\n if (this._applyPattern(objects, _id, state.original)) {\n context.result.states[i].id = _id;\n }\n }\n }.bind(this));\n }.bind(this));\n }\n }\n }\n context.result.states.forEach(function (state) {\n if (state.name.indexOf('%d') !== -1 && state.role && state.id) {\n var m = state.role.exec(context.objects[state.id].common.role);\n if (m) {\n state.name = state.name.replace('%d', m[1]);\n }\n }\n if (state.role) {\n delete state.role;\n }\n if (state.enums) {\n delete state.enums;\n }\n if (state.original) {\n if (state.original.icon) {\n state.icon = state.original.icon;\n }\n delete state.original;\n }\n });\n\n return context.result;\n }\n }\n }\n return null;\n };\n\n this.detect = function (options) {\n var objects = options.objects;\n var id = options.id;\n var _keysOptional = options._keysOptional;\n var _usedIdsOptional = options._usedIdsOptional;\n var ignoreIndicators = options.ignoreIndicators;\n var allowedTypes = options.allowedTypes;\n\n if (this.cache[id] !== undefined) {\n return this.cache[id];\n }\n\n if (!_keysOptional) {\n _keysOptional = Object.keys(objects);\n _keysOptional.sort();\n options._keysOptional = _keysOptional;\n }\n\n var result = [];\n if (_usedIdsOptional) {\n _usedIdsOptional = [];\n options._usedIdsOptional = _usedIdsOptional;\n }\n\n var detected;\n\n while((detected = this._detectNext(options))) {\n result.push(detected);\n }\n\n this.cache[id] = result.length ? result : null;\n\n return this.cache[id];\n };\n\n (function _constructor (that) {\n that.enums = null;\n that.cache = {};\n })(this);\n\n return this;\n}\n\nif (typeof module !== 'undefined' && module.parent) {\n module.exports = {\n Types: Types,\n ChannelDetector: ChannelDetector\n };\n}"]} |