eclipse-thingweb / eclipse-thingweb/node-wot

ContentType seems to confuse OPC UA

Open
#1,400 11 comments 0 reactions 0 assignees Claimed by @erossignon View on GitHub
binding-opcua
Dominant language
TypeScript
Stars
192
Forks
100
Avg merge
3d 2h
Merged PRs (30d)
6

Description

The following code tries to read an OPC UA property

```
const read1 = await thing.readProperty("1:Speed");
console.log("speed value is: ", await read1.value());
```

with the following TD

```
"properties": {
"1:Speed": {
"title": "Speed",
"type": "number",
"forms": [
{
"href": "/?id=ns=1;s=MotorSpeed"
}
],
"observable": true
}
}
```

everything works fine while adding a `"contentType": "application/octet-stream"` which looks like this breaks it.

```
"properties": {
"1:Speed": {
"title": "Speed",
"type": "number",
"forms": [
{
"href": "/?id=ns=1;s=MotorSpeed",
"contentType": "application/octet-stream"
}
],
"observable": true
}
}
```

fails with

```
TypeError: dataType.toLowerCase is not a function
at OctetstreamCodec.valueToBytes
```

This seems to indicate that OPC UA data is processed by OctetstreamCodec also (again?)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.