UNPKG

@openhab-ui/setup-and-maintenance

Version:

Configuration and maintenance interface for openHAB

1,915 lines (1,852 loc) 113 kB
function toArray(arr) { return Array.prototype.slice.call(arr); } function promisifyRequest(request) { return new Promise(function(resolve, reject) { request.onsuccess = function() { resolve(request.result); }; request.onerror = function() { reject(request.error); }; }); } function promisifyRequestCall(obj, method, args) { var request; var p = new Promise(function(resolve, reject) { request = obj[method].apply(obj, args); promisifyRequest(request).then(resolve, reject); }); p.request = request; return p; } function promisifyCursorRequestCall(obj, method, args) { var p = promisifyRequestCall(obj, method, args); return p.then(function(value) { if (!value) return; return new Cursor(value, p.request); }); } function proxyProperties(ProxyClass, targetProp, properties) { properties.forEach(function(prop) { Object.defineProperty(ProxyClass.prototype, prop, { get: function() { return this[targetProp][prop]; }, set: function(val) { this[targetProp][prop] = val; } }); }); } function proxyRequestMethods(ProxyClass, targetProp, Constructor, properties) { properties.forEach(function(prop) { if (!(prop in Constructor.prototype)) return; ProxyClass.prototype[prop] = function() { return promisifyRequestCall(this[targetProp], prop, arguments); }; }); } function proxyMethods(ProxyClass, targetProp, Constructor, properties) { properties.forEach(function(prop) { if (!(prop in Constructor.prototype)) return; ProxyClass.prototype[prop] = function() { return this[targetProp][prop].apply(this[targetProp], arguments); }; }); } function proxyCursorRequestMethods(ProxyClass, targetProp, Constructor, properties) { properties.forEach(function(prop) { if (!(prop in Constructor.prototype)) return; ProxyClass.prototype[prop] = function() { return promisifyCursorRequestCall(this[targetProp], prop, arguments); }; }); } function Index(index) { this._index = index; } proxyProperties(Index, '_index', [ 'name', 'keyPath', 'multiEntry', 'unique' ]); proxyRequestMethods(Index, '_index', IDBIndex, [ 'get', 'getKey', 'getAll', 'getAllKeys', 'count' ]); proxyCursorRequestMethods(Index, '_index', IDBIndex, [ 'openCursor', 'openKeyCursor' ]); function Cursor(cursor, request) { this._cursor = cursor; this._request = request; } proxyProperties(Cursor, '_cursor', [ 'direction', 'key', 'primaryKey', 'value' ]); proxyRequestMethods(Cursor, '_cursor', IDBCursor, [ 'update', 'delete' ]); // proxy 'next' methods ['advance', 'continue', 'continuePrimaryKey'].forEach(function(methodName) { if (!(methodName in IDBCursor.prototype)) return; Cursor.prototype[methodName] = function() { var cursor = this; var args = arguments; return Promise.resolve().then(function() { cursor._cursor[methodName].apply(cursor._cursor, args); return promisifyRequest(cursor._request).then(function(value) { if (!value) return; return new Cursor(value, cursor._request); }); }); }; }); function ObjectStore(store) { this._store = store; } ObjectStore.prototype.createIndex = function() { return new Index(this._store.createIndex.apply(this._store, arguments)); }; ObjectStore.prototype.index = function() { return new Index(this._store.index.apply(this._store, arguments)); }; proxyProperties(ObjectStore, '_store', [ 'name', 'keyPath', 'indexNames', 'autoIncrement' ]); proxyRequestMethods(ObjectStore, '_store', IDBObjectStore, [ 'put', 'add', 'delete', 'clear', 'get', 'getAll', 'getKey', 'getAllKeys', 'count' ]); proxyCursorRequestMethods(ObjectStore, '_store', IDBObjectStore, [ 'openCursor', 'openKeyCursor' ]); proxyMethods(ObjectStore, '_store', IDBObjectStore, [ 'deleteIndex' ]); function Transaction(idbTransaction) { this._tx = idbTransaction; this.complete = new Promise(function(resolve, reject) { idbTransaction.oncomplete = function() { resolve(); }; idbTransaction.onerror = function() { reject(idbTransaction.error); }; idbTransaction.onabort = function() { reject(idbTransaction.error); }; }); } Transaction.prototype.objectStore = function() { return new ObjectStore(this._tx.objectStore.apply(this._tx, arguments)); }; proxyProperties(Transaction, '_tx', [ 'objectStoreNames', 'mode' ]); proxyMethods(Transaction, '_tx', IDBTransaction, [ 'abort' ]); function UpgradeDB(db, oldVersion, transaction) { this._db = db; this.oldVersion = oldVersion; this.transaction = new Transaction(transaction); } UpgradeDB.prototype.createObjectStore = function() { return new ObjectStore(this._db.createObjectStore.apply(this._db, arguments)); }; proxyProperties(UpgradeDB, '_db', [ 'name', 'version', 'objectStoreNames' ]); proxyMethods(UpgradeDB, '_db', IDBDatabase, [ 'deleteObjectStore', 'close' ]); function DB(db) { this._db = db; } DB.prototype.transaction = function() { return new Transaction(this._db.transaction.apply(this._db, arguments)); }; proxyProperties(DB, '_db', [ 'name', 'version', 'objectStoreNames' ]); proxyMethods(DB, '_db', IDBDatabase, [ 'close' ]); // Add cursor iterators // TODO: remove this once browsers do the right thing with promises ['openCursor', 'openKeyCursor'].forEach(function(funcName) { [ObjectStore, Index].forEach(function(Constructor) { // Don't create iterateKeyCursor if openKeyCursor doesn't exist. if (!(funcName in Constructor.prototype)) return; Constructor.prototype[funcName.replace('open', 'iterate')] = function() { var args = toArray(arguments); var callback = args[args.length - 1]; var nativeObject = this._store || this._index; var request = nativeObject[funcName].apply(nativeObject, args.slice(0, -1)); request.onsuccess = function() { callback(request.result); }; }; }); }); // polyfill getAll [Index, ObjectStore].forEach(function(Constructor) { if (Constructor.prototype.getAll) return; Constructor.prototype.getAll = function(query, count) { var instance = this; var items = []; return new Promise(function(resolve) { instance.iterateCursor(query, function(cursor) { if (!cursor) { resolve(items); return; } items.push(cursor.value); if (count !== undefined && items.length == count) { resolve(items); return; } cursor.continue(); }); }); }; }); function openDb(name, version, upgradeCallback) { var p = promisifyRequestCall(indexedDB, 'open', [name, version]); var request = p.request; if (request) { request.onupgradeneeded = function(event) { if (upgradeCallback) { upgradeCallback(new UpgradeDB(request.result, event.oldVersion, request.transaction)); } }; } return p.then(function(db) { return new DB(db); }); } class FetchError extends Error { constructor(message, status) { super(message); if (Error.captureStackTrace) { Error.captureStackTrace(this, FetchError); } this.message = message; this.status = status; } networkErrorMessage() { return this.message + " (" + this.status + ")"; } toString() { return this.message + " (" + this.status + ")"; } } async function fetchWithTimeout(url, timeout = 5000) { const controller = new AbortController(); const signal = controller.signal; setTimeout(() => controller.abort(), timeout); const response = await fetch(url, { signal: signal, validateHttpsCertificates: false, muteHttpExceptions: true }).catch(e => { throw (e instanceof DOMException && e.name === "AbortError" ? "Timeout after " + (timeout / 1000) + "s." : e); }); if (!response.ok) { const body = await response.text(); throw new FetchError(response.statusText + " " + body, response.status); } return response; } const EQ_TRESHOLD = 3; /** * This class takes one list of items ("old") and another list of items ("new"). * It computes a hash for each item in the old list and stores them in an associative * map indexed by the property given with "key_id". If you now call "compareNewAndOld" * with a "new" item the method will also compute a hash and can tell you if the * old and new item are different (ignoring the order of properties). * * ## Implementation * * This is a fast, not a perfect implementation. Objects are flattened before * they are hashed. Properties are sorted via the standard JS sort algorithm. * The hash is a 32bit number and basically a sum up of all values converted to string. */ class CompareTwoDataSets { /** * @param {String} key_id The key name for this store (e.g. "id","uid" etc) * @param {String} storename The storename for debugging messages * @param {Object} oldData The old data */ constructor(key_id, oldData) { this.key_id = key_id; this.ok = true; var indexedData = {}; if (this.key_id) { if (this.key_id) { indexedData._ok = true; for (let d of oldData) indexedData[d[this.key_id]] = hashCode(d); } } this.indexedData = indexedData; this.listOfUnequal = []; } /** * Compare old entry with new one. If different: Add to `listOfUnequal`. * * @returns Return true if equal and false otherwise. */ compareNewAndOld(entry, storename) { if (!this.ok) return false; const newHash = hashCode(entry); const id = entry[this.key_id]; const oldHash = this.indexedData[id]; if (newHash != oldHash) { if (storename) console.debug("replaceStore !entry", storename, id, newHash, oldHash); this.listOfUnequal.push(entry); if (this.listOfUnequal.length > EQ_TRESHOLD) this.ok = false; return false; } return true; } } function flattenObject(ob) { var toReturn = {}; for (var i in ob) { if ((typeof ob[i]) == 'object') { var flatObject = flattenObject(ob[i]); for (var x in flatObject) { toReturn[i + '.' + x] = flatObject[x]; } } else { toReturn[i] = ob[i]; } } return toReturn; } function hashCode(obj) { obj = flattenObject(obj); var str = ""; Object.keys(obj).sort().forEach(key => str += obj[key]); let hash = 0; if (str.length == 0) { return hash; } for (let i = 0; i < str.length; i++) { const char = str.charCodeAt(i); hash = ((hash << 5) - hash) + char; hash = hash & hash; // Convert to 32bit integer } return hash; } const iconset = [ "attic", "bath", "bedroom", "cellar", "corridor", "firstfloor", "garage", "garden", "groundfloor", "kitchen", "office", "terrace", "battery", "blinds", "camera", "door", "frontdoor", "garagedoor", "lawnmower", "lightbulb", "lock", "poweroutlet", "projector", "receiver", "screen", "siren", "wallswitch", "whitegood", "window", "colorpicker", "group", "rollershutter", "slider", "switch", "text", "humidity", "moon", "rain", "snow", "sun", "sun_clouds", "temperature", "wind", "batterylevel", "carbondioxide", "colorlight", "energy", "fire", "flow", "gas", "light", "lowbattery", "motion", "oil", "pressure", "price", "qualityofservice", "smoke", "soundvolume", "temperature", "time", "water", "heating", "mediacontrol", "movecontrol", "zoom", "alarm", "party", "presence", "vacation", "baby_1", "baby_2", "baby_3", "baby_4", "baby_5", "baby_6", "bedroom_blue", "bedroom_orange", "bedroom_red", "bluetooth", "boy_1", "boy_2", "boy_3", "boy_4", "boy_5", "boy_6", "calendar", "chart", "cinema", "cinemascreen", "cistern", "climate", "colorwheel", "contact", "dryer", "error", "fan", "fan_box", "fan_ceiling", "faucet", "flowpipe", "garage_detached", "garage_detached_selected", "girl_1", "girl_2", "girl_3", "girl_4", "girl_5", "girl_6", "greenhouse", "house", "incline", "keyring", "line", "man_1", "man_2", "man_3", "man_4", "man_5", "man_6", "microphone", "network", "niveau", "none", "outdoorlight", "pantry", "parents_1_1", "parents_1_2", "parents_1_3", "parents_1_4", "parents_1_5", "parents_1_6", "parents_2_1", "parents_2_2", "parents_2_3", "parents_2_4", "parents_2_5", "parents_2_6", "parents_3_1", "parents_3_2", "parents_3_3", "parents_3_4", "parents_3_5", "parents_3_6", "parents_4_1", "parents_4_2", "parents_4_3", "parents_4_4", "parents_4_5", "parents_4_6", "parents_5_1", "parents_5_2", "parents_5_3", "parents_5_4", "parents_5_5", "parents_5_6", "parents_6_1", "parents_6_2", "parents_6_3", "parents_6_4", "parents_6_5", "parents_6_6", "pie", "piggybank", "player", "poweroutlet_au", "poweroutlet_eu", "poweroutlet_uk", "poweroutlet_us", "pump", "radiator", "recorder", "returnpipe", "rgb", "settings", "sewerage", "shield", "smiley", "sofa", "softener", "solarplant", "soundvolume_mute", "status", "suitcase", "sunrise", "sunset", "temperature_cold", "temperature_hot", "toilet", "video", "wardrobe", "washingmachine", "washingmachine_2", "woman_1", "woman_2", "woman_3", "woman_4", "woman_5", "woman_6", ]; const osgibundles = [ { "id": 20, "state": "Active", "lvl": 80, "version": "5.3.1.201602281253", "name": "OSGi JAX-RS Connector" }, { "id": 21, "state": "Active", "lvl": 80, "version": "2.7.0.v20170129-0911", "name": "Gson: Google Json Library for Java" }, { "id": 23, "state": "Active", "lvl": 80, "version": "3.0.0.v201312141243", "name": "Google Guice (No AOP)" }, { "id": 26, "state": "Active", "lvl": 80, "version": "3.5.4", "name": "JmDNS" }, { "id": 28, "state": "Active", "lvl": 80, "version": "1.0.0", "name": "Units of Measurement API" }, { "id": 30, "state": "Active", "lvl": 80, "version": "1.1.0.Final", "name": "Bean Validation API" }, { "id": 31, "state": "Active", "lvl": 80, "version": "2.0.1", "name": "javax.ws.rs-api" }, { "id": 32, "state": "Active", "lvl": 80, "version": "3.2.0.v201101311130", "name": "ANTLR Runtime" }, { "id": 35, "state": "Active", "lvl": 80, "version": "3.2.1", "name": "Commons Collections" }, { "id": 36, "state": "Active", "lvl": 80, "version": "1.1", "name": "Commons Exec" }, { "id": 37, "state": "Active", "lvl": 80, "version": "2.2.0", "name": "Commons IO" }, { "id": 38, "state": "Active", "lvl": 80, "version": "2.6", "name": "Commons Lang" }, { "id": 47, "state": "Active", "lvl": 80, "version": "4.2.1", "name": "Apache Karaf :: OSGi Services :: Event" }, { "id": 63, "state": "Active", "lvl": 80, "version": "4.6.0", "name": "Apache XBean OSGI Bundle Utilities" }, { "id": 64, "state": "Active", "lvl": 80, "version": "4.6.0", "name": "Apache XBean :: Classpath Resource Finder" }, { "id": 65, "state": "Active", "lvl": 80, "version": "2.12.0.v20160420-0247", "name": "EMF Common" }, { "id": 66, "state": "Active", "lvl": 80, "version": "2.12.0.v20160420-0247", "name": "EMF Ecore" }, { "id": 67, "state": "Active", "lvl": 80, "version": "2.11.0.v20160420-0247", "name": "EMF Change Model" }, { "id": 68, "state": "Active", "lvl": 80, "version": "2.12.0.v20160420-0247", "name": "EMF XML/XMI Persistence" }, { "id": 69, "state": "Active", "lvl": 80, "version": "3.8.0.v20160509-1230", "name": "Common Eclipse Runtime" }, { "id": 70, "state": "Active", "lvl": 80, "version": "3.6.100.v20160223-2218", "name": "Extension Registry Support" }, { "id": 80, "state": "Active", "lvl": 80, "version": "9.4.11.v20180605", "name": "Jetty :: Proxy" }, { "id": 94, "state": "Active", "lvl": 80, "version": "0.4.1.v20180515-1321", "name": "org.eclipse.lsp4j" }, { "id": 95, "state": "Active", "lvl": 80, "version": "0.4.1.v20180515-1321", "name": "org.eclipse.lsp4j.jsonrpc" }, { "id": 96, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Config Core" }, { "id": 97, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Configuration Discovery" }, { "id": 98, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Configuration mDNS Discovery" }, { "id": 99, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Config Dispatcher" }, { "id": 100, "state": "Active", "lvl": 75, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Config XML" }, { "id": 101, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Core" }, { "id": 102, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Core Audio" }, { "id": 103, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Core Binding XML" }, { "id": 104, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Core ID" }, { "id": 105, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Core Persistence" }, { "id": 106, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Scheduler Service" }, { "id": 107, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Core Thing" }, { "id": 108, "state": "Active", "lvl": 75, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Core Thing XML" }, { "id": 109, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Transformation Service" }, { "id": 110, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Core Voice" }, { "id": 111, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Console" }, { "id": 112, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Console for OSGi runtime Karaf" }, { "id": 113, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome JavaSound I/O, Fragments: 180" }, { "id": 114, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Monitor" }, { "id": 115, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Net I/O Bundle" }, { "id": 116, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome REST Interface Bundle" }, { "id": 117, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Core REST API" }, { "id": 118, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome REST mDNS Announcer" }, { "id": 119, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome REST Interface JAX-RS optimization Bundle" }, { "id": 120, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Sitemap REST API" }, { "id": 121, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome SSE REST API" }, { "id": 122, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Voice REST API" }, { "id": 123, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Bonjour/MDS Service Discovery Bundle" }, { "id": 124, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Web Audio Support" }, { "id": 125, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Model Core" }, { "id": 126, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Item Model" }, { "id": 127, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Item Model IDE" }, { "id": 128, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Item Model Runtime" }, { "id": 129, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Language Server" }, { "id": 130, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Persistence Model" }, { "id": 131, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Persistence Model IDE" }, { "id": 132, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Persistence Runtime" }, { "id": 133, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Rule Model" }, { "id": 134, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Rule Model IDE" }, { "id": 135, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Rule Runtime" }, { "id": 136, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Script" }, { "id": 137, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Script Model IDE" }, { "id": 138, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Script Runtime" }, { "id": 139, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Sitemap Model" }, { "id": 140, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Sitemap Model IDE" }, { "id": 141, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Sitemap Runtime" }, { "id": 142, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Thing Model" }, { "id": 143, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Thing Model IDE" }, { "id": 144, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Thing Model Runtime" }, { "id": 145, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Json Storage Service" }, { "id": 146, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome UI" }, { "id": 147, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome UI Icons" }, { "id": 148, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Classic IconSet" }, { "id": 149, "state": "Active", "lvl": 80, "version": "2.14.0.v20180522-1629", "name": "Xtend Runtime Library" }, { "id": 150, "state": "Active", "lvl": 80, "version": "2.14.0.v20180522-1629", "name": "Xtend Macro Interfaces" }, { "id": 151, "state": "Active", "lvl": 80, "version": "2.14.0.v20180522-1821", "name": "Xtext" }, { "id": 152, "state": "Active", "lvl": 80, "version": "2.14.0.v20180522-1833", "name": "Xtext Common Types" }, { "id": 153, "state": "Active", "lvl": 80, "version": "2.14.0.v20180522-1821", "name": "Xtext IDE Core" }, { "id": 154, "state": "Active", "lvl": 80, "version": "2.14.0.v20180522-1821", "name": "Xtext Utility" }, { "id": 155, "state": "Active", "lvl": 80, "version": "2.14.0.v20180522-1833", "name": "Xbase Model" }, { "id": 156, "state": "Active", "lvl": 80, "version": "2.14.0.v20180522-1833", "name": "Xbase Generic IDE Services" }, { "id": 157, "state": "Active", "lvl": 80, "version": "2.14.0.v20180522-1629", "name": "Xbase Runtime Library" }, { "id": 172, "state": "Active", "lvl": 80, "version": "1.9.6", "name": "MIME streaming extension" }, { "id": 174, "state": "Active", "lvl": 80, "version": "6.2.0", "name": "org.objectweb.asm" }, { "id": 175, "state": "Active", "lvl": 80, "version": "6.2.0", "name": "org.objectweb.asm.commons" }, { "id": 176, "state": "Active", "lvl": 80, "version": "6.2.0", "name": "org.objectweb.asm.tree" }, { "id": 177, "state": "Active", "lvl": 90, "version": "2.4.0.201810032130", "name": "openHAB Core" }, { "id": 178, "state": "Active", "lvl": 80, "version": "2.4.0.201810032130", "name": "openHAB Karaf Integration" }, { "id": 180, "state": "Resolved", "lvl": 80, "version": "2.4.0.201810032130", "name": "openHAB Sound Support, Hosts: 113" }, { "id": 181, "state": "Active", "lvl": 80, "version": "2.4.0.201810032130", "name": "openHAB Dashboard UI" }, { "id": 186, "state": "Active", "lvl": 80, "version": "1.0.2", "name": "Units of Measurement Common Library" }, { "id": 187, "state": "Active", "lvl": 80, "version": "1.0.8", "name": "Units of Measurement Implementation for Java SE" }, { "id": 188, "state": "Active", "lvl": 80, "version": "3.3.0", "name": "Commons Net" }, { "id": 189, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Basic UI, Fragments: 192" }, { "id": 190, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Paper UI, Fragments: 194" }, { "id": 191, "state": "Active", "lvl": 80, "version": "2.4.0.201810032130", "name": "Hue Emulation Service" }, { "id": 192, "state": "Resolved", "lvl": 75, "version": "2.4.0.201810032130", "name": "openHAB Basic UI Fragment, Hosts: 189" }, { "id": 193, "state": "Active", "lvl": 80, "version": "2.4.0.201810032130", "name": "HABPanel User Interface" }, { "id": 194, "state": "Resolved", "lvl": 75, "version": "2.4.0.201810032130", "name": "openHAB Paper UI Theme Fragment, Hosts: 190" }, { "id": 198, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Automation API" }, { "id": 199, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Automation commands" }, { "id": 200, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Automation Core" }, { "id": 201, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Automation Module Core" }, { "id": 202, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Automation Media Modules" }, { "id": 203, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Automation Module Script" }, { "id": 204, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Automation Script Globals" }, { "id": 205, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Automation Script RuleSupport" }, { "id": 206, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Automation Module Timer" }, { "id": 207, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Automation GSON Parser" }, { "id": 208, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Automation Providers" }, { "id": 209, "state": "Active", "lvl": 80, "version": "0.10.0.201809271800", "name": "Eclipse SmartHome Automation REST API" }, { "id": 239, "state": "Installed", "lvl": 80, "version": "0.10.0.201810051534", "name": "Eclipse SmartHome MQTT Binding" }, { "id": 240, "state": "Installed", "lvl": 80, "version": "0.10.0.201810051534", "name": "Eclipse SmartHome Embedded Mqtt Broker" }, { "id": 241, "state": "Installed", "lvl": 80, "version": "0.10.0.201810051534", "name": "Eclipse SmartHome MQTT Thing Binding" }, { "id": 242, "state": "Installed", "lvl": 80, "version": "0.10.0.201810051534", "name": "Eclipse SmartHome MQTT Transport Bundle" }, { "id": 243, "state": "Active", "lvl": 80, "version": "1.1.1.201605111122", "name": "Swagger Provider" }, { "id": 244, "state": "Active", "lvl": 80, "version": "2.4.5", "name": "Jackson-annotations" }, { "id": 245, "state": "Active", "lvl": 80, "version": "2.4.5", "name": "Jackson-core" }, { "id": 246, "state": "Active", "lvl": 80, "version": "2.4.5", "name": "jackson-databind" }, { "id": 247, "state": "Active", "lvl": 80, "version": "2.4.5", "name": "Jackson-dataformat-XML" }, { "id": 248, "state": "Active", "lvl": 80, "version": "2.4.5", "name": "Jackson-dataformat-YAML" }, { "id": 249, "state": "Active", "lvl": 80, "version": "2.4.5", "name": "Jackson-module-JAXB-annotations" }, { "id": 250, "state": "Active", "lvl": 80, "version": "18.0.0", "name": "Guava: Google Core Libraries for Java" }, { "id": 251, "state": "Active", "lvl": 80, "version": "1.5.8", "name": "swagger-annotations" }, { "id": 252, "state": "Active", "lvl": 80, "version": "1.5.8", "name": "swagger-core" }, { "id": 253, "state": "Active", "lvl": 80, "version": "1.5.8", "name": "swagger-jaxrs" }, { "id": 254, "state": "Active", "lvl": 80, "version": "1.5.8", "name": "swagger-models" }, { "id": 255, "state": "Active", "lvl": 80, "version": "3.19.0.GA", "name": "Javassist" }, { "id": 256, "state": "Active", "lvl": 80, "version": "3.2.1", "name": "Apache Commons Lang" }, { "id": 259, "state": "Active", "lvl": 80, "version": "2.4.0.201810032130", "name": "openHAB REST Documentation" }, { "id": 260, "state": "Active", "lvl": 80, "version": "0.9.10.v20160429-1435", "name": "reflections (wrap)" }, { "id": 261, "state": "Active", "lvl": 80, "version": "3.1.4", "name": "Stax2 API" }, { "id": 262, "state": "Active", "lvl": 80, "version": "1.5.8.v20160511-1038", "name": "swagger-jersey2-jaxrs (wrap)" }, { "id": 263, "state": "Active", "lvl": 75, "version": "0.10.0.201812160950", "name": "Eclipse SmartHome JavaScript Transformation Service" }, { "id": 270, "state": "Active", "lvl": 75, "version": "0.10.0.201812160950", "name": "Eclipse SmartHome XPath Transformation Service" }, { "id": 271, "state": "Active", "lvl": 80, "version": "2.1.0", "name": "json-path" }, { "id": 272, "state": "Active", "lvl": 80, "version": "2.2", "name": "json-smart" }, { "id": 273, "state": "Active", "lvl": 75, "version": "0.10.0.201812160950", "name": "Eclipse SmartHome JSonPath Transformation Service" }, { "id": 274, "state": "Active", "lvl": 75, "version": "0.10.0.201812160950", "name": "Eclipse SmartHome RegEx Transformation Service" }, { "id": 275, "state": "Active", "lvl": 75, "version": "0.10.0.201812160950", "name": "Eclipse SmartHome Exec Transformation Service" }, { "id": 276, "state": "Active", "lvl": 75, "version": "0.10.0.201812160950", "name": "Eclipse SmartHome Map Transformation Service" } ]; const semantic = [ { type: "Location", tag: "Indoor", parent: "NO", label: "Indoor", synonyms: [], description: "Anything that is inside a closed building" }, { type: "Location", tag: "Building", parent: "Indoor", label: "Building", synonyms: ["Buildings"], description: "" }, { type: "Location", tag: "Garage", parent: "Building", label: "Garage", synonyms: ["Garages"], description: "" }, { type: "Location", tag: "Floor", parent: "Indoor", label: "Floor", synonyms: ["Floors"], description: "" }, { type: "Location", tag: "GroundFloor", parent: "Floor", label: "Ground Floor", synonyms: ["Ground Floors", "Downstairs"], description: "" }, { type: "Location", tag: "FirstFloor", parent: "Floor", label: "First Floor", synonyms: ["First Floors", "Upstairs"], description: "" }, { type: "Location", tag: "Attic", parent: "Floor", label: "Attic", synonyms: ["Attics"], description: "" }, { type: "Location", tag: "Basement", parent: "Floor", label: "Basement", synonyms: ["Basements", "Cellar", "Cellars"], description: "" }, { type: "Location", tag: "Corridor", parent: "Indoor", label: "Corridor", synonyms: ["Corridors"], description: "" }, { type: "Location", tag: "Room", parent: "Indoor", label: "Room", synonyms: ["Rooms"], description: "" }, { type: "Location", tag: "Bedroom", parent: "Room", label: "Bedroom", synonyms: ["Bedrooms"], description: "" }, { type: "Location", tag: "Kitchen", parent: "Room", label: "Kitchen", synonyms: ["Kitchens"], description: "" }, { type: "Location", tag: "Bathroom", parent: "Room", label: "Bathroom", synonyms: ["Bathrooms", "Bath", "Baths"], description: "" }, { type: "Location", tag: "LivingRoom", parent: "Room", label: "Living Room", synonyms: ["Living Rooms"], description: "" }, { type: "Location", tag: "Outdoor", parent: "NO", label: "Outdoor", synonyms: [], description: "" }, { type: "Location", tag: "Garden", parent: "Outdoor", label: "Garden", synonyms: ["Gardens"], description: "" }, { type: "Location", tag: "Terrace", parent: "Outdoor", label: "Terrace", synonyms: ["Terraces", "Deck", "Decks"], description: "" }, { type: "Location", tag: "Carport", parent: "Outdoor", label: "Carport", synonyms: ["Carports"], description: "" }, { type: "Property", tag: "Temperature", parent: "NO", label: "Temperature", synonyms: ["Temperatures"], description: "" }, { type: "Property", tag: "Light", parent: "NO", label: "Light", synonyms: ["Lights", "Lighting"], description: "" }, { type: "Property", tag: "ColorTemperature", parent: "NO", label: "Color Temperature", synonyms: [], description: "" }, { type: "Property", tag: "Humidity", parent: "NO", label: "Humidity", synonyms: ["Moisture"], description: "" }, { type: "Property", tag: "Presence", parent: "NO", label: "Presence", synonyms: [], description: "" }, { type: "Property", tag: "Pressure", parent: "NO", label: "Pressure", synonyms: [], description: "" }, { type: "Property", tag: "Smoke", parent: "NO", label: "Smoke", synonyms: [], description: "" }, { type: "Property", tag: "Noise", parent: "NO", label: "Noise", synonyms: [], description: "" }, { type: "Property", tag: "Rain", parent: "NO", label: "Rain", synonyms: [], description: "" }, { type: "Property", tag: "Wind", parent: "NO", label: "Wind", synonyms: [], description: "" }, { type: "Property", tag: "Water", parent: "NO", label: "Water", synonyms: [], description: "" }, { type: "Property", tag: "CO2", parent: "NO", label: "CO2", synonyms: ["Carbon Dioxide"], description: "" }, { type: "Property", tag: "CO", parent: "NO", label: "CO", synonyms: ["Carbon Monoxide"], description: "" }, { type: "Property", tag: "Energy", parent: "NO", label: "Energy", synonyms: [], description: "" }, { type: "Property", tag: "Power", parent: "NO", label: "Power", synonyms: [], description: "" }, { type: "Property", tag: "Voltage", parent: "NO", label: "Voltage", synonyms: [], description: "" }, { type: "Property", tag: "Current", parent: "NO", label: "Current", synonyms: [], description: "" }, { type: "Property", tag: "Frequency", parent: "NO", label: "Frequency", synonyms: [], description: "" }, { type: "Property", tag: "Gas", parent: "NO", label: "Gas", synonyms: [], description: "" }, { type: "Property", tag: "SoundVolume", parent: "NO", label: "Sound Volume", synonyms: [], description: "" }, { type: "Property", tag: "Oil", parent: "NO", label: "Oil", synonyms: [], description: "" }, { type: "Point", tag: "Alarm", parent: "NO", label: "Alarm", synonyms: [], description: "" }, { type: "Point", tag: "Control", parent: "NO", label: "Control", synonyms: [], description: "" }, { type: "Point", tag: "Switch", parent: "Control", label: "Switch", synonyms: [], description: "" }, { type: "Point", tag: "Measurement", parent: "NO", label: "Measurement", synonyms: [], description: "" }, { type: "Point", tag: "Setpoint", parent: "NO", label: "Setpoint", synonyms: [], description: "" }, { type: "Point", tag: "Status", parent: "NO", label: "Status", synonyms: [], description: "" }, { type: "Point", tag: "LowBattery", parent: "Status", label: "LowBattery", synonyms: [], description: "" }, { type: "Point", tag: "OpenState", parent: "Status", label: "OpenState", synonyms: [], description: "" }, { type: "Point", tag: "Tampered", parent: "Status", label: "Tampered", synonyms: [], description: "" }, { type: "Point", tag: "OpenLevel", parent: "Status", label: "OpenLevel", synonyms: [], description: "" }, { type: "Point", tag: "Tilt", parent: "Status", label: "Tilt", synonyms: [], description: "" }, { type: "Equipment", tag: "Battery", parent: "NO", label: "Battery", synonyms: ["Batteries"], description: "" }, { type: "Equipment", tag: "Blinds", parent: "NO", label: "Blinds", synonyms: ["Rollershutter", "Rollershutters", "Roller shutter", "Roller shutters", "Shutter", "Shutters"], description: "" }, { type: "Equipment", tag: "Camera", parent: "NO", label: "Camera", synonyms: ["Cameras"], description: "" }, { type: "Equipment", tag: "Car", parent: "NO", label: "Car", synonyms: ["Cars"], description: "" }, { type: "Equipment", tag: "CleaningRobot", parent: "NO", label: "Cleaning Robot", synonyms: ["Cleaning Robots", "Vacuum robot", "Vacuum robots"], description: "" }, { type: "Equipment", tag: "Door", parent: "NO", label: "Door", synonyms: ["Doors"], description: "" }, { type: "Equipment", tag: "FrontDoor", parent: "Door", label: "Front Door", synonyms: ["Front Doors", "Frontdoor", "Frontdoors"], description: "" }, { type: "Equipment", tag: "GarageDoor", parent: "Door", label: "Garage Door", synonyms: ["Garage Doors"], description: "" }, { type: "Equipment", tag: "HVAC", parent: "NO", label: "HVAC", synonyms: ["Heating", "Ventilation", "Air Conditioning", "A/C", "A/Cs", "AC"], description: "" }, { type: "Equipment", tag: "Inverter", parent: "NO", label: "Inverter", synonyms: ["Inverters"], description: "" }, { type: "Equipment", tag: "LawnMower", parent: "NO", label: "Lawn Mower", synonyms: ["Lawn Mowers"], description: "" }, { type: "Equipment", tag: "Lightbulb", parent: "NO", label: "Lightbulb", synonyms: ["Lightbulbs", "Bulb", "Bulbs", "Lamp", "Lamps", "Lights", "Lighting"], description: "" }, { type: "Equipment", tag: "Lock", parent: "NO", label: "Lock", synonyms: ["Locks"], description: "" }, { type: "Equipment", tag: "MotionDetector", parent: "NO", label: "Motion Detector", synonyms: ["Motion Detectors", "Motion sensor", "Motion sensors"], description: "" }, { type: "Equipment", tag: "NetworkAppliance", parent: "NO", label: "Network Appliance", synonyms: ["Network Appliances"], description: "" }, { type: "Equipment", tag: "PowerOutlet", parent: "NO", label: "Power Outlet", synonyms: ["Power Outlets", "Outlet", "Outlets"], description: "" }, { type: "Equipment", tag: "Projector", parent: "NO", label: "Projector", synonyms: ["Projectors", "Beamer", "Beamers"], description: "" }, { type: "Equipment", tag: "RadiatorControl", parent: "NO", label: "Radiator Control", synonyms: ["Radiator Controls", "Radiator", "Radiators"], description: "" }, { type: "Equipment", tag: "Receiver", parent: "NO", label: "Receiver", synonyms: ["Receivers", "Audio Receiver", "Audio Receivers", "AV Receiver", "AV Receivers"], description: "" }, { type: "Equipment", tag: "RemoteControl", parent: "NO", label: "Remote Control", synonyms: ["Remote Controls"], description: "" }, { type: "Equipment", tag: "Screen", parent: "NO", label: "Screen", synonyms: ["Screens", "Television", "Televisions", "TV", "TVs"], description: "" }, { type: "Equipment", tag: "Siren", parent: "NO", label: "Siren", synonyms: ["Sirens"], description: "" }, { type: "Equipment", tag: "SmokeDetector", parent: "NO", label: "Smoke Detector", synonyms: ["Smoke Detectors"], description: "" }, { type: "Equipment", tag: "Speaker", parent: "NO", label: "Speaker", synonyms: ["Speakers"], description: "" }, { type: "Equipment", tag: "Valve", parent: "NO", label: "Valve", synonyms: ["Valves"], description: "" }, { type: "Equipment", tag: "WallSwitch", parent: "NO", label: "Wall Switch", synonyms: ["Wall Switches"], description: "" }, { type: "Equipment", tag: "WebService", parent: "NO", label: "Web Service", synonyms: ["Web Services"], description: "" }, { type: "Equipment", tag: "Window", parent: "NO", label: "Window", synonyms: ["Windows"], description: "" }, { type: "Equipment", tag: "WhiteGood", parent: "NO", label: "White Good", synonyms: ["White Goods"], description: "" } ]; async function addManualExtensions(tx) { const store = tx.objectStore('manualextensions'); await store.clear(); const data = [ { "id": "binding-avmfritz", "label": "AVM FRITZ!Box Binding", "filepath": "binding-avmfritz-2.4.0.SNAPSHOT.jar", "version": "2.4.0.SNAPSHOT", "link": "https://www.openhab.org/addons/bindings/avmfritz/", "enabled": true, "installed": 1546950225013, "type": "binding" }, { "id": "binding-airvisualnode", "label": "AirVisual Node Binding", "filepath": "binding-airvisualnode-2.4.0.SNAPSHOT.jar", "version": "2.4.0.SNAPSHOT", "link": "https://www.openhab.org/addons/bindings/airvisualnode/", "enabled": true, "installed": 1546950221013, "type": "binding" }, { "id": "webinterface", "label": "Paper UI NG Alpha", "filepath": "webinterface-paperui-ng-0.1.zip", "version": "0.1", "link": "https://davidgraeff.github.io/paperui-ng/", "enabled": true, "installed": 1546950125013, "type": "webinterface" } ]; for (let d of data) await store.add(d); } async function addExtensionRepositories(tx) { const scriptStore = tx.objectStore('extension-repositories'); await scriptStore.clear(); const scripts = [ { "extensionservice": "org.openhab.addons", "label": "Release builds", "description": "The main maven repository for openHAB releases", "url": "https://dl.bintray.com/openhab/mvn", "type": "maven_repository", "fixed": true, "enabled": false }, { "extensionservice": "org.openhab.addons", "label": "Milestone builds", "description": "openHAB Milestone repository", "url": "https://openhab.jfrog.io/openhab/online-repo-milestone/2.5", "type": "maven_repository", "fixed": true, "enabled": true }, { "extensionservice": "org.openhab.addons", "label": "Legacy OH1 addons", "description": "Add-ons in this repository have a newer version already. For compatibility and old installations you might want to enable this however.", "url": "mvn:org.openhab.distro/openhab-addons-legacy/%version%/xml/features", "type": "karaf_features", "fixed": true, "enabled": false }, { "id": "eclipse_marketplace_rules", "label": "Eclipse Marketplace", "description": "Bindings, Rule Templates, Voice services on the Eclipse Marketplace.", "url": "https://marketplace.eclipse.org/taxonomy/term/4988%2C4396/api/p?client=org.eclipse.smarthome", "type": "bundles", "fixed": true, "enabled": true }, ]; for (let d of scripts) await scriptStore.add(d); } async function addScripts(tx) { const scriptStore = tx.objectStore('scripts'); await scriptStore.clear(); const scripts = [ { "filename": "a_script_file.js", "description": "My first rule", "mime": "application/javascript", } ]; for (let d of scripts) await scriptStore.add(d); } async function addPersistenceServices(tx) { const store = tx.objectStore('persistence-services'); await store.clear(); const data = [ { "id": "influxdb", "description": "This service allows you to persist and query states using the InfluxDB time series database.", "label": "InfluxDB", "configDescriptionURI": "persistence:influxdb", strategies: [ { label: "Every change", id: "onchange" }, { label: "Every update", id: "onupdate" } ] }, { "id": "jpa", "description": "This service allows you to persist state updates using a SQL or NoSQL database through the Java Persistence API", "label": "Java Persistence API", "configDescriptionURI": "persistence:jpa", strategies: [ { label: "Every change", id: "onchange" }, { label: "Every update", id: "onupdate" } ] }, { "id": "dynamodb", "description": "This service allows you to persist state updates using the Amazon DynamoDB database. ", "label": "Amazon DynamoDB Persistence", "configDescriptionURI": "persistence:dynamodb", strategies: [ { label: "Every change", id: "onchange" } ] }, { "id": "mapdb", "description": "The mapdb Persistence Service is based on simple key-value store that only saves the last value. The intention is to use this for restoreOnStartup items because all other persistence options have their drawbacks if values are only needed for reload.", "label": "mapdb", "configDescriptionURI": "persistence:mapdb", strategies: [ { label: "Every change", id: "onchange" }, { label: "Restore on startup", id: "restore" } ] }, { "id": "rrd4j", "description": "rrd4j is a round-robin database and does not grow in size - it has a fixed allocated size, which is used. This is accomplished by doing data compression, which means that the older the data is, the less values are available. So while you might have a value every minute for the last 24 hours, you might only have one every day for the last year.", "label": "rrd4j", "configDescriptionURI": "persistence:rrd4j", strategies: [ { label: "Cron strategy", id: "cron" } ] } ]; for (let d of data) await store.add(d); } async function addPersistence(tx) { const store = tx.objectStore('persistence'); await store.clear(); const data = [ { "uid": "e7773915-cd05-4376-813f-b35de6a98bf2", "annotation": "Used for charting", "label": "InfluxDB Charting", "serviceid": "influxdb", "items": [], "itemByNamePattern": "", "itemByLabelPattern": "", "itemByTags": [], "strategy": ["onchange"] }, { "uid": "30179c6a-2a3c-4435-a7ff-c7448e6df17d", "annotation": "Allows an overview of when my items updated to a new value", "label": "InfluxDB History", "serviceid": "influxdb", "items": [], "itemByNamePattern": "", "itemByLabelPattern": "", "itemByTags": [], "strategy": ["onupdate"] }, { "uid": "8c7e5ce1-578c-4ac4-bc9e-fd20ab6be70e", "annotation": "Stores all items to mapDB for a later restart", "label": "MapDB Store", "serviceid": "mapdb", "items": [], "itemByNamePattern": "", "itemByLabelPattern": "", "itemByTags": [], "strategy": ["onchange"] }, { "uid": "66e7b0d9-3de6-479a-9873-a5347878923d", "annotation": "Restores all my items on startup", "label":