WebThingsIO / thing-url-adapter

Proxy adapter for Web Thing API endpoints
Mozilla Public License 2.0
22 stars 18 forks source link

Invalid thing description by adding by URL #33

Closed novski closed 6 years ago

novski commented 6 years ago

Adding myStrom device with REST API using the things/+/Add by URL.. link and typing the API URL: http://192.168.178.77/toggle shows a error: Invalid thing description that prevents me from saving that thing. Althroug it switches perfectly if i press the submit button. bildschirmfoto 2018-04-26 um 09 44 48

The device has a simple (to simple?) API that is described here: https://mystrom.ch/de/mystrom-for-developers/ and the dedicated API-description file is this: https://mystrom.ch/wp-content/uploads/REST_API_SWI.txt

mrstegeman commented 6 years ago

@novski This is only for adding native Web Things that conform to the WoT spec. Anything else requires a separate adapter.

Timmeey commented 6 years ago

@novski Well. From what i can see in their REST-API documentation, it just does not conform with the WOT-API that the thing-url-adapter is expecting.

When you call the /toggle ressource it toggles (because that is what the switch does when that ressource is called), but the response is not WOT conform (https://iot.mozilla.org/wot/#thing-resource).

There is nothing we can do from here. You can write your own adapter(which then runs on the Gateway), that wrapps the switch API into a WOT confrom response. That way you could get it to work properly. Examples/Tutorial: https://hacks.mozilla.org/2018/02/creating-an-add-on-for-the-project-things-gateway/ https://hacks.mozilla.org/2018/02/making-a-clap-sensing-web-thing/ https://github.com/mozilla-iot/example-adapter