Home automation

This example describes possibility of controlling home devices.

Description

Imagine that we have following home devices:

  • Living room thermostat
  • Living room light bulb
  • Bedroom thermostat

/sitemap.meta

application/x.meta+json

{
    "@doctype": "meta/sitemap",
    "items": [
        "url": "/overview.meta",
        "label": "Overview",
        "items": [
            {
                "url": "/tm1.meta",
                "label": "Living room thermostat"
            },
            {
                "url": "/lb1.meta",
                "label": "Living room lights"
            },
            {
                "url": "/tm2.meta",
                "label": "Bedroom thermostat"
            }
        ]
    ]
}

/overview.meta

application/x.meta+json

{
    "@doctype": "meta/resource",
    "label": "Overview",
    "icon": "/icons/dashboard.svg",
    "image": "/images/header.jpg",
    "properties": [
        {
            "@type": "meta/group",
            "label": "Thermostats",
            "properties": [
                {
                    "@type": "meta/embed",
                    "uri": "/tm1.meta",
                    "link": true
                },
                {
                    "@type": "meta/embed",
                    "uri": "/tm2.meta",
                    "link": true
                }
            ]
        },
        {
            "@type": "meta/group",
            "label": "Lights",
            "properties": [
                {
                    "@type": "meta/embed",
                    "uri": "/lb1.meta",
                    "link": true
                }
            ]
        }
    ]
}

/tm1.meta

application/x.meta+json

{
    "@doctype": "meta/property",
    "@type": "meta/properties/meter",
    "$data": {
        "@type": "meta/data",
        "uri": "/tm1.json"
    },
    "label": "Living room temperature",
    "min": 0,
    "max": 30,
    "units": "Degress",
    
    "actions": [
        {
            "method": "PUT",
            "url": "/tm1.json",
            "id": "set",
            "label": "Set"
        }
    ]
}

/tm1.json

application/json

{
    "value": 23,
    "state": 22.5
}

/tm2.meta

application/x.meta+json

{
    "@doctype": "meta/property",
    "@type": "meta/properties/meter",
    "$data": {
        "@type": "meta/data",
        "uri": "/tm1.json"
    },
    "label": "Bedroom temperature",
    "min": 0,
    "max": 30,
    "units": "Degress",
    
    "actions": [
        {
            "method": "PUT",
            "url": "/tm2.json",
            "id": "set",
            "label": "Set"
        }
    ]
}

/tm2.json

application/json

{
    "value": 22,
    "state": 23.0
}

/lb1.meta

application/x.meta+json

{
    "@doctype": "meta/property",
    "@type": "meta/properties/boolean",
    "$data": {
        "@type": "meta/data",
        "uri": "/lb1.json"
    },
    "$on": {
        "@type": "meta/data",
        "value": true
    },
    "$off": {
        "@type": "meta/data",
        "value": true
    },
    "model": "$data",
    "label": "Living room lights",
    "style": "switch",
    "min": 0,
    "max": 30,
    "units": "Degress",
    
    "actions": [
        {
            "method": "PUT",
            "url": "/tm1.json",
            "model": "$data",
            "id": "set",
            "label": "Set",
        },
        {
            "method": "PUT",
            "url": "/tm1.json",
            "model": "$on",
            "label": "Turn on",
            "aliases": [ "Switch on", "Light on" ]
        },
        {
            "method": "PUT",
            "url": "/tm1.json",
            "model": "$off",
            "label": "Turn off",
            "aliases": [ "Switch off", "Light off" ]
        }
    ]
}

/lb1.json

application/json

{
    "value": true
}

Voice commands

Beacuse we have following resources with actions:

  • Living room temperature with action set
  • Bedroom temperature with action set
  • Living room lights with action set, turn on, turn off

It will be simple to implement natural language processing voice interface to control our devices.

Image following commands:

  • Set living room temperature to 25
  • Set temperature of living room to 23
  • Set living room lights to on
  • Set living room lights to off
  • Turn on the living room lights
  • Turn off the living room lights
  • What is state of living room temperature
  • Are living room lights on?