OK, this may be obvious to everyone else except me.
Settings/addons/webthing > Configure thing-url-adapter - this adds the server url, and mozilla-iot will poll this url (root) to get a list of devices: GET http://myhost/
The server then responds with a list of things:
[{
"@context": "https://iot.mozilla.org/schemas/",
"@type": ["Light", "OnOffSwitch"],
"name":"LED",
"description": "LED",
"properties": {
"on": {
"@type": "OnOffProperty",
"type": "boolean",
"href": "/things/led/properties/on",
"value": false
}
}
}
]
the gateway will then query the webserver for the thing status:
GET http://myhost//things/led/properties/on
The server then responds with the status:
{"led":true/false}
If you toggle the thing on/off, then the iot-gateway sends a POST instead of a GET, the web server can then perform it’s I/O and reply with the same status as for the query.
I don’t know if this is the correct usage, but it seems to work, now I understand this I can also create web server devices on other platforms such as micropython.
This is what I was trying to understand.