tum-esi / wade

WoT API Development Environment built on top of thingweb.node-wot

Home Page:https://www.ei.tum.de/en/esi/home/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: No CoAP Communication Possible

sebastiankb opened this issue · comments

Yesterday I did a fresh new install of W-ADE and tried to test a TD that is based on CoAP interactions. When I click on "invoke interactions" all result fields show me an error message "... missing ClientFactory for 'coap' ".

Any ideas?

@sebastiankb thanks for adding the issue. I will check it out and see if I can reproduce & fix it 🙂

@sebastiankb Which TD/Thing did you try? Do you see the same errors when you interact with the following TD/Thing at coap://129.187.45.174:5683/Virtual-Coffee-Machine_2_16

{
  "@context":[
    "https://www.w3.org/2019/wot/td/v1",
    {
      "@language":"en"
    }
  ],
  "@type":"Thing",
  "id":"de:tum:ei:esi:fp:coffee:2-16",
  "title":"Virtual-Coffee-Machine_2_16",
  "description":"A virtual coffee machine to learn the WoT TD standard",
  "security":"nosec_sc",
  "securityDefinitions":{
    "nosec_sc":{
      "scheme":"nosec"
    }
  },
  "properties":{
    "state":{
      "type":"string",
      "readOnly":true,
      "enum":[
        "Ready",
        "Brewing",
        "Error"
      ],
      "forms":[
        {
          "href":"coap://esiremotelab.esi.ei.tum.de:5683/Virtual-Coffee-Machine_2_16/properties/state",
          "contentType":"application/json",
          "op":[
            "readproperty"
          ]
        }
      ],
      "writeOnly":false,
      "observable":false
    },
    "waterStatus":{
      "type":"integer",
      "readOnly":true,
      "unit":"%",
      "maximum":100,
      "minimum":0,
      "forms":[
        {
          "href":"coap://esiremotelab.esi.ei.tum.de:5683/Virtual-Coffee-Machine_2_16/properties/waterStatus",
          "contentType":"application/json",
          "op":[
            "readproperty"
          ]
        }
      ],
      "writeOnly":false,
      "observable":false
    },
    "coffeeStatus":{
      "type":"integer",
      "readOnly":true,
      "unit":"%",
      "maximum":100,
      "minimum":0,
      "forms":[
        {
          "href":"coap://esiremotelab.esi.ei.tum.de:5683/Virtual-Coffee-Machine_2_16/properties/coffeeStatus",
          "contentType":"application/json",
          "op":[
            "readproperty"
          ]
        }
      ],
      "writeOnly":false,
      "observable":false
    },
    "binStatus":{
      "type":"integer",
      "readOnly":true,
      "unit":"%",
      "maximum":100,
      "minimum":0,
      "forms":[
        {
          "href":"coap://esiremotelab.esi.ei.tum.de:5683/Virtual-Coffee-Machine_2_16/properties/binStatus",
          "contentType":"application/json",
          "op":[
            "readproperty"
          ]
        }
      ],
      "writeOnly":false,
      "observable":false
    }
  },
  "actions":{
    "brew":{
      "input":{
        "type":"string",
        "enum":[
          "latte-machiato",
          "espresso",
          "cappuccino"
        ]
      },
      "forms":[
        {
          "href":"coap://esiremotelab.esi.ei.tum.de:5683/Virtual-Coffee-Machine_2_16/actions/brew",
          "contentType":"application/json",
          "op":"invokeaction"
        }
      ],
      "idempotent":false,
      "safe":false
    },
    "abort":{
      "forms":[
        {
          "href":"coap://esiremotelab.esi.ei.tum.de:5683/Virtual-Coffee-Machine_2_16/actions/abort",
          "contentType":"application/json",
          "op":"invokeaction"
        }
      ],
      "idempotent":false,
      "safe":false
    },
    "shutdown":{
      "forms":[
        {
          "href":"coap://esiremotelab.esi.ei.tum.de:5683/Virtual-Coffee-Machine_2_16/actions/shutdown",
          "contentType":"application/json",
          "op":"invokeaction"
        }
      ],
      "idempotent":false,
      "safe":false
    }
  },
  "events":{
    "maintenance":{
      "data":{
        "type":"string"
      },
      "forms":[
        {
          "href":"coap://esiremotelab.esi.ei.tum.de:5683/Virtual-Coffee-Machine_2_16/events/maintenance",
          "contentType":"application/json",
          "op":"subscribeevent"
        }
      ]
    },
    "error":{
      "data":{
        "type":"string"
      },
      "forms":[
        {
          "href":"coap://esiremotelab.esi.ei.tum.de:5683/Virtual-Coffee-Machine_2_16/events/error",
          "contentType":"application/json",
          "op":"subscribeevent"
        }
      ]
    }
  }
}

Your TD works! However, this TD does not work:

{
  "@context": [
    "https://www.w3.org/2019/wot/td/v1"
  ],
  "id": "urn:sensor",
  "securityDefinitions": {
    "nosec_sc": {
      "scheme": "nosec"
    }
  },
  "security": [
    "nosec_sc"
  ],
  "@type": [
    "Thing"
  ],
  "base": "coap://esiremotelab.esi.ei.tum.de:5683",
  "title": "Sensors",
  "properties": {
    "brightness": {
      "minimum": 0,
      "maximum": 100,
      "type": "integer",
      "title": "Light Brightness",
      "forms": [
        {
          "href": "/Virtual-Coffee-Machine_2_16/properties/waterStatus",
          "op": [
            "observeproperty",
            "readproperty",
            "writeproperty"
          ]
        }
      ]
    }
  }
}

Maybe some issues withe the base arithmetic?

btw: I just changed the resource address in my TD so that you can test this with the coffee machine.

ah now I see where the error originates from. @neniman the protocols that are passed on to the TD Consumer are built based on the href of forms. So basically the protocol present in base URI should also be added.

I see! Will fix this :)

Fixed by #87