Mozilla IoT

WoT Capability Schemas

iot.mozilla.org/schemas

Introduction

This web page describes a repository of Web of Things capability schemas to be used as optional semantic markup in Web Thing Descriptions.

To use a schema from this repository, a Thing Description must define a @context of "https://iot.mozilla.org/schemas", define one or more device capability types as a top level @type array and define at least the required properties, actions and events for those capabilities with an appropriate @type annotation.

Example

{
  "@context": "https://iot.mozilla.org/schemas/",
  "@type": ["Light", "OnOffSwitch"],
  "name":"My Lamp",
  "description": "A web connected lamp",
  "properties": {
    "on": {
      "@type": "OnOffProperty",
      "type": "boolean",
      "description": "Whether the lamp is turned on",
      "href": "/things/lamp/properties/on"
    },
    "brightness" : {
      "@type": "BrightnessProperty",
      "type": "number",
      "description": "The level of light from 0-100",
      "minimum" : 0,
      "maximum" : 100,
      "href": "/things/lamp/properties/brightness"
    }
  },
  "actions": {
    "fade": {
      "@type": "FadeAction",
      "description": "Fade the lamp to a given level",
      "input": {
        "type": "object",
        "properties": {
          "level": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "duration": {
            "type": "number",
            "unit": "milliseconds"
          }
        }
      },
      "href": "/things/lamp/actions/fade"
    }
  },
  "events": {
    "overheated": {
      "@type": "OverheatedEvent",
      "type": "number",
      "unit": "celsius",
      "description": "The lamp has exceeded its safe operating temperature",
      "href": "/things/lamp/events/overheated"
    }
  },
  "links": [
    {
      "rel": "properties",
      "href": "/things/lamp/properties"
    },
    {
      "rel": "actions",
      "href": "/things/lamp/actions"
    },
    {
      "rel": "events",
      "href": "/things/lamp/events"
    },
    {
      "rel": "alternate",
      "href": "wss://mywebthingserver.com/things/lamp"
    },
    {
      "rel": "alternate",
      "mediaType": "text/html",
      "href": "/things/lamp"
    }
  ]
}

Contents

Capabilities

OnOffSwitch

A simple switch which has an on state and an off state.

Properties

Type Required
OnOffProperty Yes

Actions

Type Required
ToggleAction No

Events

None.

MultiLevelSwitch

A fader or dimmer switch with a range of levels.

Properties

Type Required
LevelProperty Yes

Actions

Type Required
FadeAction No

Events

None.

BinarySensor

A simple sensor with an active (true) and inactive (false) state.

Properties

Type Required
BooleanProperty Yes

Actions

None.

Events

None.

MultiLevelSensor

A sensor with a range of values.

Properties

Type Required
LevelProperty Yes

Actions

None.

Events

None.

ColorControl

The ability to set a color, e.g. for a colored light.

Properties

Type Required
ColorProperty No
ColorTemperatureProperty No

Note: A device implementing the ColorControl capability MUST include either a ColorProperty or a ColorTemperatureProperty.

Actions

None.

Events

None.

EnergyMonitor

Capability to monitor current energy usage.

Properties

Type Required
InstantaneousPowerProperty Yes
VoltageProperty No
CurrentProperty No
FrequencyProperty No

Actions

None.

Events

None.

SmartPlug

A plug or mains outlet which can control power output and optionally monitor energy usage.

Properties

Type Required
OnOffProperty Yes
LevelProperty No
InstantaneousPowerProperty No
VoltageProperty No
CurrentProperty No
FrequencyProperty No

Actions

Type Required
ToggleAction No
FadeAction No

Events

None.

Light

A device which emits light, can be turned on and off and optionally have its brightness, color and color temperature controlled.

Properties

Type Required
OnOffProperty Yes
BrightnessProperty No
ColorProperty No
ColorTemperatureProperty No

Actions

Type Required
ToggleAction No
FadeAction No

Events

Type Required
OverheatedEvent No

MotionSensor

A device which detects moving objects.

Properties

Type Writable Required
MotionProperty No Yes

Actions

None.

Events

None.

DoorSensor

A device which detects whether a door or window is open or closed.

Properties

Type Writable Required
OpenProperty No Yes

Actions

None.

Events

None.

PushButton

A momentary switch which can be pushed and returns to an un-pushed state when released.

Properties

Type Writable Required
PushedProperty No Yes

Actions

None.

Events

None.

Properties

BooleanProperty

type boolean

OnOffProperty

An OnOffProperty is like a BooleanProperty, but with the added semantics that true means "on" and false means "off".

type boolean

MotionProperty

A MotionProperty is like a BooleanProperty, but with the added semantics that true means "motion" and false means "no motion".

type boolean

PushedProperty

A PushedProperty is like a BooleanProperty, but with the added semantics that true means "pushed" and false means "not pushed".

type boolean

OpenProperty

An OpenProperty is like a BooleanProperty, but with the added semantics that true means "open" and false means "closed".

type boolean

LevelProperty

type number
minimum number
maximum number
unit (optional)

BrightnessProperty

type number
minimum 0
maximum 100
unit percent

ColorProperty

type string (hexidecimal RGB color code, e.g. #FF0000)

ColorTemperatureProperty

type number
unit kelvin

InstantaneousPowerProperty

type number
unit watt

CurrentProperty

type number
unit ampere

VoltageProperty

type number
unit volt

FrequencyProperty

type number
unit hertz

Actions

ToggleAction

Toggles a boolean state on and off.

input

None.

FadeAction

Fades a multi level switch to a given level over a given duration.

input

type object
properties
  • level
    • type: number
    • unit: percent
    • minimum: 0
    • maximum: 100
  • duration
    • type: number
    • unit: second

Events

OverheatedEvent

Indicates a device has exceeded its safe operating temperature.

data

type number
unit degree celcius