diff --git a/README.md b/README.md index d821a36..e8ab529 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,11 @@ This adapter is still in development. You can use it but without support and hel ## Changelog +### 0.0.2 +* Language support for objects tree + ### 0.0.1 -* initial release +* Initial release ## License The MIT License (MIT) diff --git a/admin/index_m.html b/admin/index_m.html index c22d3bb..65460db 100644 --- a/admin/index_m.html +++ b/admin/index_m.html @@ -104,16 +104,31 @@
-
+
Log in at https://www.nibeuplink.com. It is the number in the URL.
-
+
Time in minutes of fetching data from Nibe Uplink.
+
+ + + The language for naming the data objects. +
diff --git a/io-package.json b/io-package.json index 645ae32..1f200ef 100644 --- a/io-package.json +++ b/io-package.json @@ -1,10 +1,14 @@ { "common": { "name": "nibeuplink", - "version": "0.0.1", + "version": "0.0.2", "news": { + "0.0.2": { + "en": "Language support for objects tree", + "de": "Unterstützung von Sprachen im Objektbaum" + }, "0.0.1": { - "en": "initial adapter", + "en": "Initial adapter", "de": "Initiale Version", "ru": "Первоначальный адаптер", "pt": "Versão inicial", @@ -50,7 +54,8 @@ }, "native": { "CallbackURL": "https://z0mt3c.github.io/nibe.html", - "Interval": 1 + "Interval": 1, + "Language": "en" }, "objects": [ ] diff --git a/main.js b/main.js index 7d84955..a2abea8 100644 --- a/main.js +++ b/main.js @@ -168,7 +168,8 @@ function main() { redirectUri: adapter.config.CallbackURL, interval: refreshInterval * 60, authCode: adapter.config.AuthCode, - systemId: adapter.config.SystemId + systemId: adapter.config.SystemId, + language: adapter.config.Language }, adapter); f.on('data', (data) => { diff --git a/nibe-fetcher.js b/nibe-fetcher.js index c0b8665..07900ad 100644 --- a/nibe-fetcher.js +++ b/nibe-fetcher.js @@ -236,6 +236,7 @@ const defaultOptions = { }, interval: 60, timezone: 'Europe/Berlin', + language: 'en', renewBeforeExpiry: 5 * 60 * 1000, sessionStore: Path.join(__dirname, './.session.json') } @@ -408,7 +409,8 @@ class Fetcher extends EventEmitter { return new Promise((resolve, reject) => { this.wreck.get(`/api/v1/systems/${systemId}/serviceinfo/categories`, { headers: { - Authorization: 'Bearer ' + this.getSession('access_token') + Authorization: 'Bearer ' + this.getSession('access_token'), + 'Accept-Language': this.options.language, }, json: true }, (error, response, payload) => { @@ -428,7 +430,8 @@ class Fetcher extends EventEmitter { return new Promise((resolve, reject) => { this.wreck.get(`/api/v1/systems/${systemId}/serviceinfo/categories/status?categoryId=${category}`, { headers: { - Authorization: 'Bearer ' + this.getSession('access_token') + Authorization: 'Bearer ' + this.getSession('access_token'), + 'Accept-Language': this.options.language, }, json: true }, (error, response, payload) => { @@ -448,7 +451,7 @@ class Fetcher extends EventEmitter { async.map(categories, (item, reply) => { this.fetchParams(item.categoryId).then((result) => { result.forEach((i) => { - const name = i.parameterId || (item.categoryId + '_' + i.title.split(/[^a-z]+/gi).join('_')).toLowerCase().replace(/[_]+$/, ''); + const name = i.parameterId || (item.categoryId + '_' + i.title.split(/[^a-z]+/gi).join('_')).toUpperCase().replace(/[_]+$/, ''); const parameters = this.options.parameters[name]; Object.assign(i, { key: name, diff --git a/package.json b/package.json index 885d2b7..2fb9f07 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iobroker.nibeuplink", - "version": "0.0.1", + "version": "0.0.2", "description": "nibeuplink", "author": { "name": "Sebastian Haesselbarth",