Skip to content

Commit b80c462

Browse files
committed
Bugfix for issue #117; Update of list of data points for E3 devices to version 20250307
1 parent 1ff9a29 commit b80c462

File tree

3 files changed

+67
-15
lines changed

3 files changed

+67
-15
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ If you enjoyed this project — or just feeling generous, consider buying me a b
135135
### **WORK IN PROGRESS**
136136
-->
137137
### **WORK IN PROGRESS**
138+
* (MyHomeMyData) Bugfix for issue #117
138139
* (MyHomeMyData) Updated data point 381, refer to discussion https://github.com/open3e/open3e/discussions/212
140+
* (MyHomeMyData) Update of list of data points for E3 devices to version 20250307
139141

140142
### 0.10.7 (2025-02-26)
141143
* (MyHomeMyData) Updated dependencies according to issue #111

lib/canUds.js

+18-10
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,14 @@ class uds {
394394
// ======================
395395
if (id.includes(this.userReadByDidId)) {
396396
// User requests ReadByDid
397-
const dids = JSON.parse(state.val);
398-
await ctx.log.debug('User command UDS ReadByDid on '+this.config.stateBase+'. Dids='+JSON.stringify(dids));
399-
await this.pushCmnd(ctx, 'read', dids);
400-
await ctx.setStateAsync(id, { val: JSON.stringify(dids), ack: true }); // Acknowlegde user command
397+
try {
398+
const dids = JSON.parse(state.val);
399+
await ctx.log.debug('User command UDS ReadByDid on '+this.config.stateBase+'. Dids='+JSON.stringify(dids));
400+
await this.pushCmnd(ctx, 'read', dids);
401+
await ctx.setStateAsync(id, { val: JSON.stringify(dids), ack: true }); // Acknowlegde user command
402+
} catch(e) {
403+
ctx.log.error('ReadByDid(): Parsing of list of DIDs failed on '+this.config.stateBase+'; err='+JSON.stringify(e)+' - You have to provide a list of numerical values.');
404+
}
401405
return;
402406
}
403407

@@ -439,12 +443,16 @@ class uds {
439443
break;
440444
case 'raw':
441445
// Change in raw data
442-
byteArr = this.storage.storageDids.toByteArray(await JSON.parse(state.val));
443-
if (byteArr) {
444-
await this.pushCmnd(ctx, 'write', [[did,byteArr]]);
445-
ctx.setTimeout(function(ctxWorker,did){ctxWorker.cmndsQueue.push({'mode':'read', 'did': did});},2500,this,did); // Read value after 2500 ms
446-
} else {
447-
ctx.log.error('User command UDS WriteByDid on '+this.config.stateBase+': Encoding of data failed.');
446+
try {
447+
byteArr = this.storage.storageDids.toByteArray(await JSON.parse(state.val));
448+
if (byteArr) {
449+
await this.pushCmnd(ctx, 'write', [[did,byteArr]]);
450+
ctx.setTimeout(function(ctxWorker,did){ctxWorker.cmndsQueue.push({'mode':'read', 'did': did});},2500,this,did); // Read value after 2500 ms
451+
} else {
452+
ctx.log.error('User command UDS WriteByDid on '+this.config.stateBase+': Encoding of data failed.');
453+
}
454+
} catch(e) {
455+
ctx.log.error('WriteByDid(): Encoding of data failed on '+this.config.stateBase+'.'+String(did)+'; err='+JSON.stringify(e)+' - You have to provide JSON formatted data.');
448456
}
449457
break;
450458
case 'tree':

lib/didsE3.json

+47-5
Original file line numberDiff line numberDiff line change
@@ -8907,16 +8907,58 @@
89078907
}
89088908
},
89098909
"1006": {
8910-
"codec": "RawCodec",
8910+
"codec": "O3EComplexType",
89118911
"len": 4,
89128912
"id": "TargetQuickMode",
8913-
"args": {}
8913+
"args": {
8914+
"subTypes": [
8915+
{
8916+
"codec": "O3EByteVal",
8917+
"len": 1,
8918+
"id": "OpMode",
8919+
"args": {}
8920+
},
8921+
{
8922+
"codec": "O3EBool",
8923+
"len": 1,
8924+
"id": "Required",
8925+
"args": {}
8926+
},
8927+
{
8928+
"codec": "RawCodec",
8929+
"len": 2,
8930+
"id": "Unknown",
8931+
"args": {}
8932+
}
8933+
]
8934+
}
89148935
},
89158936
"1007": {
8916-
"codec": "RawCodec",
8937+
"codec": "O3EComplexType",
89178938
"len": 4,
89188939
"id": "CurrentQuickMode",
8919-
"args": {}
8940+
"args": {
8941+
"subTypes": [
8942+
{
8943+
"codec": "O3EByteVal",
8944+
"len": 1,
8945+
"id": "OpMode",
8946+
"args": {}
8947+
},
8948+
{
8949+
"codec": "O3EBool",
8950+
"len": 1,
8951+
"id": "Required",
8952+
"args": {}
8953+
},
8954+
{
8955+
"codec": "RawCodec",
8956+
"len": 2,
8957+
"id": "Unknown",
8958+
"args": {}
8959+
}
8960+
]
8961+
}
89208962
},
89218963
"1008": {
89228964
"codec": "RawCodec",
@@ -32001,5 +32043,5 @@
3200132043
]
3200232044
}
3200332045
},
32004-
"Version": "20250302"
32046+
"Version": "20250307"
3200532047
}

0 commit comments

Comments
 (0)