tum-esi / wade

WoT API Development Environment built on top of thingweb.node-wot
https://www.ei.tum.de/en/esi/home/
MIT License
26 stars 6 forks source link

Bug: No CoAP Communication Possible #69

Closed sebastiankb closed 4 years ago

sebastiankb commented 4 years ago

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?

eileenoo commented 4 years ago

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

egekorkan commented 4 years ago

@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"
        }
      ]
    }
  }
}
sebastiankb commented 4 years ago

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?

sebastiankb commented 4 years ago

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

egekorkan commented 4 years ago

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.

eileenoo commented 4 years ago

I see! Will fix this :)

egekorkan commented 4 years ago

Fixed by #87