Brief Thoughts on Open Connectivity Foundation Models
Here's the OCF Model for "Brightness", which I've shameless copied and stripped of excess crap:
description: | This resource describes the brightness of a light or lamp. The brightness percentage is an integer showing the current brightness level. A brightness of 0 is the minimum for the resource. A brightness of 100 is the maximum for the resource. displayName: Brightness is: [ interface ] # valid for all methods get: description: | Retrieves the current brightness level. responses: 200: body: application/json: schema: Brightness example: | { "rt": "oic.r.light.brightness", "id": "unique_example_id", "brightness": 50 } post: description: | Sets the desired brightness level. body: application/json: schema: Brightness example: | { "id": "unique_example_id", "brightness": 10 } responses: 200: description: | Indicates that the brightness was changed. The new brightness level is provided in the response. body: application/json: schema: Brightness example: | { "id": "unique_example_id", "brightness": 10 }
So there's two ways you can interact with this:
you can GET the current brightness, which will return a value between 0 and 100
you can POST a new brightness (between 0 and 100). When the brightness is set, it will return it.
they create Thing definitions using composition I think
how if you have a Thing with only 10 levels of Brightness?
how do you tell if a light is in an interstitial state, that is, how do you tell if the light's brightness is currently being changed? Yes, if you're the person doing it's obvious, but not if you're a third party?
why use magic words oic.r.light.brightness when could have easily defined this with Linked Data and QNames, e.g. something like oic:light.brightness
The problem with this scheme becomes more evident when you deal with concepts like Temperature. How if you want to specify and min and max range? What if you want to specify units other than Celsius? What if you want to specify the precision?
Note how we deal with this in IoTDB, e.g. with a LIFX Light (JSON here):
ATTRIBUTE brightness WITH schema:name = "brightness", iot:purpose = iot-purpose:brightness, iot:type = iot:type.integer, iot:unit = iot-unit:math.fraction.percent, iot:minimum = 0, iot:maximum = 100, iot:actuator = true, iot:sensor = true, iot:write = true, iot:read = true
Everything is spelled out: if you need different minimum or maximum values, you can change them. If you want to use numbers rather than integers, you just specify it. If you want something that can read the brightness only (maybe it's a side effect of the color selected) you can. If you want to use a different term than "brightness" you can. Interstitial state is discovered by the Band concept.