Web Thing API: Read-only and slow properties

I read https://iot.mozilla.org/wot/#property-resource.

The section includes an example of a successful PUT response for a property, however, I wonder what an unsuccessful response should look like.

In the case that the value is not changeable:
Should I return an HTTP 403, if the value is a read only value?
Should I return an HTTP 200 but the value stays the same? (how is it different from a slow value?)

And what if it takes my web thing a couple of seconds (or minutes) to change the value:

  1. If my web thing needs to talk to a couple of slow servers to change a property, should I return the response early with the unchanged value?
  2. Should a temperature control (or similar) implement temperature and target_temperature? The temperature surely won’t change quickly.

I know that error codes at a certain point make properties “read-only”, however I can’t really tell you what exactly to do, since I use the official language wrappers. Sadly there’s no actual UI for read-only properties though.

There are both approaches out there, where the adpater immediately reflects the change and then later on corrects the value back if the change failed (you can change a property without user input).

It seems pretty agreed that you should do the second thing for thermostats though: https://github.com/mozilla-iot/wot/issues/61 and
iotschema.org (which is an independent effort, I think), has a TargetTemparature property type: http://iotschema.org/TargetTemperature

I think it should be mentioned in the specification to not provide (false) target values for sensors.
If I PUT a temperature value to a heater with a thermostat and it immediately responds with the target value, it might trigger rules.

Imagine a cold room that opens the window when it’s hot. When I set the heating to a hot value, the heater replies with the hot target value. In this case the windows would open in a cold room.

The comment below mentions the possibility of additional target temperatures as well. Thanks for the link to that discussion.

Read-only properties are something we’ve been wanting to implement for a long time. We’ve been waiting for the W3C to settle on terminology, but it appears that they’ve now settled on writable. That is probably something we’ll try to pull into the 0.6 version of the gateway, as our 0.5 cycle is wrapping up soon. The relevant issue is here.

As for your other question, about the thermostat’s “slow properties”:

  1. I see TemperatureProperty as a read-only property giving the current temperature reading.
  2. TargetTemperatureProperty should be the thermostat’s set-point.

Neither of these values should be slow.

1 Like