Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Commit e416fc0

Browse files
committed
Language support for objects tree
1 parent 4b3486a commit e416fc0

File tree

6 files changed

+38
-11
lines changed

6 files changed

+38
-11
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ This adapter is still in development. You can use it but without support and hel
55

66
## Changelog
77

8+
### 0.0.2
9+
* Language support for objects tree
10+
811
### 0.0.1
9-
* initial release
12+
* Initial release
1013

1114
## License
1215
The MIT License (MIT)

admin/index_m.html

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,31 @@
104104
</div>
105105
</div>
106106
<div class="row">
107-
<div class="input-field col s12 m6 l6">
107+
<div class="input-field col s12 m4 l4">
108108
<input type="number" class="value" id="SystemId" />
109109
<label for="SystemId" class="translate">System ID</label>
110110
<span class="translate">Log in at https://www.nibeuplink.com. It is the number in the URL.</span>
111111
</div>
112-
<div class="input-field col s12 m6 l6">
112+
<div class="input-field col s12 m4 l4">
113113
<input type="number" class="value" id="Interval" min="1" />
114114
<label for="Interval" class="translate">Refresh interval</label>
115115
<span class="translate">Time in minutes of fetching data from Nibe Uplink.</span>
116116
</div>
117+
<div class="input-field col s12 m4 l4">
118+
<select class="value" id="Language">
119+
<option value="en" class="translate">English</option>
120+
<option value="de" class="translate">German</option>
121+
<option value="cs" class="translate">Czech</option>
122+
<option value="da" class="translate">Danish</option>
123+
<option value="nl" class="translate">Dutch</option>
124+
<option value="fi" class="translate">Finnish</option>
125+
<option value="fr" class="translate">French</option>
126+
<option value="pl" class="translate">Polish</option>
127+
<option value="sv" class="translate">Swedish</option>
128+
</select>
129+
<label for="Language" class="translate">Language</label>
130+
<span class="translate">The language for naming the data objects.</span>
131+
</div>
117132
</div>
118133
</div>
119134
</div>

io-package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
{
22
"common": {
33
"name": "nibeuplink",
4-
"version": "0.0.1",
4+
"version": "0.0.2",
55
"news": {
6+
"0.0.2": {
7+
"en": "Language support for objects tree",
8+
"de": "Unterstützung von Sprachen im Objektbaum"
9+
},
610
"0.0.1": {
7-
"en": "initial adapter",
11+
"en": "Initial adapter",
812
"de": "Initiale Version",
913
"ru": "Первоначальный адаптер",
1014
"pt": "Versão inicial",
@@ -50,7 +54,8 @@
5054
},
5155
"native": {
5256
"CallbackURL": "https://z0mt3c.github.io/nibe.html",
53-
"Interval": 1
57+
"Interval": 1,
58+
"Language": "en"
5459
},
5560
"objects": [
5661
]

main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ function main() {
168168
redirectUri: adapter.config.CallbackURL,
169169
interval: refreshInterval * 60,
170170
authCode: adapter.config.AuthCode,
171-
systemId: adapter.config.SystemId
171+
systemId: adapter.config.SystemId,
172+
language: adapter.config.Language
172173
}, adapter);
173174

174175
f.on('data', (data) => {

nibe-fetcher.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ const defaultOptions = {
236236
},
237237
interval: 60,
238238
timezone: 'Europe/Berlin',
239+
language: 'en',
239240
renewBeforeExpiry: 5 * 60 * 1000,
240241
sessionStore: Path.join(__dirname, './.session.json')
241242
}
@@ -408,7 +409,8 @@ class Fetcher extends EventEmitter {
408409
return new Promise((resolve, reject) => {
409410
this.wreck.get(`/api/v1/systems/${systemId}/serviceinfo/categories`, {
410411
headers: {
411-
Authorization: 'Bearer ' + this.getSession('access_token')
412+
Authorization: 'Bearer ' + this.getSession('access_token'),
413+
'Accept-Language': this.options.language,
412414
},
413415
json: true
414416
}, (error, response, payload) => {
@@ -428,7 +430,8 @@ class Fetcher extends EventEmitter {
428430
return new Promise((resolve, reject) => {
429431
this.wreck.get(`/api/v1/systems/${systemId}/serviceinfo/categories/status?categoryId=${category}`, {
430432
headers: {
431-
Authorization: 'Bearer ' + this.getSession('access_token')
433+
Authorization: 'Bearer ' + this.getSession('access_token'),
434+
'Accept-Language': this.options.language,
432435
},
433436
json: true
434437
}, (error, response, payload) => {
@@ -448,7 +451,7 @@ class Fetcher extends EventEmitter {
448451
async.map(categories, (item, reply) => {
449452
this.fetchParams(item.categoryId).then((result) => {
450453
result.forEach((i) => {
451-
const name = i.parameterId || (item.categoryId + '_' + i.title.split(/[^a-z]+/gi).join('_')).toLowerCase().replace(/[_]+$/, '');
454+
const name = i.parameterId || (item.categoryId + '_' + i.title.split(/[^a-z]+/gi).join('_')).toUpperCase().replace(/[_]+$/, '');
452455
const parameters = this.options.parameters[name];
453456
Object.assign(i, {
454457
key: name,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iobroker.nibeuplink",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"description": "nibeuplink",
55
"author": {
66
"name": "Sebastian Haesselbarth",

0 commit comments

Comments
 (0)