eclipse-thingweb / node-wot

Components for building WoT devices or for interacting with them over various IoT protocols
https://thingweb.io
Other
161 stars 78 forks source link

Ditto Thing Descriptions #745

Open stormtroober opened 2 years ago

stormtroober commented 2 years ago

Eclipse Ditto™ is a technology in the IoT implementing a software pattern called “digital twins”. It recently added integration for Web Of Things, details of this integration can be found here. I think it is an important point to make Thing Descriptions generated by Ditto also working in thingweb.node-wot. Looking at the implementation, i think that the problem could be in the fact that Ditto Features are allocated in an external TD.

stormtroober commented 2 years ago

Providing also an example of Thing Descriptions generated by Ditto. Here you can find:

danielpeintner commented 2 years ago

May I ask you to provide a simple script "what" exactly is not working OR can you describe what you tried and didn't work.

stormtroober commented 2 years ago

Of course. These are the steps:

  1. Connected to http://plugfest.thingweb.io/webui/
  2. Tried with success with the TD provided in the example.
  3. Tried with unsuccess with a TD generated by Ditto.

In fact, i know this can't work, because Ditto links Features Thing Descriptions via link, and for what i understood about node-wot, it parses only a TD that has all the information in one file.

danielpeintner commented 2 years ago

In most of the cases I get the following Error "error: TypeError: (destructured parameter) is undefined". I think this comes from uriVariables and/or basic security.

You are right, there are still features missing in node-wot. I would like to identify step by step "what" is missing. In the Ditto TDs I see

I am not sure what you mean by

[...] can't work, because Ditto links Features Thing Descriptions via link

The TD itself should be self-contained. On the contrary, TMs can be composed by several "links" ..

In general I would say the browser UI is not the best to test interoperability. I do not have a running ditto instance but I would assume something like the following gist might work for the lamp status see https://gist.github.com/danielpeintner/ed6d6d0c6a1e511d81a4571be48d35b8

stormtroober commented 2 years ago

I'll try to make myself more clear with an example of how the generation of TDs via TMs works. A Lamp TM is provided, with every feature linked as a submodel. This is the TM of the Lamp. When TDs are generated, you have one for the Thing, and one for each Feature you specify. You can see Here that the status Feature is an "item" and there is a href that links that. Some weeks ago, i created a Thing Description fetcher/parser in Java, and for doing that, i started from the initial TD(The "Thing" one) and then i retrieved all the Feature TDs.

relu91 commented 2 years ago

Following "links" to retrieve additional TDs has been recently described in the Discovery spec. Being a fairly new feature of WoT node-wot does not still support it. Therefore, currently, you are left on your own, but you can manually fetch linked TDs using the WoTHelpers fetch function.

stormtroober commented 2 years ago

That's good to know. Also the example that @danielpeintner sent was very useful.