API: Gateway Modules

From Yombo
Jump to: navigation, search

Summary

Display and manage modules installed on a gateway. Modules extend the functionality of gateways by adding new protocols or logic.

GET - List gateway modules

Get all modules assigned to a gateway.

Filters

List of available filters:

  • status

Request URLs

  • GET https://api.yombo.net/api/v1/gateway/{gateway_id}/module

Parameters

None

Example

  <div id="curl<random_number></random_number>" class="tab-pane fade in active" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
curl \
-H "x-api-key: abc123xyz789" \
-H "authorization: Bearer Waro7g0Mwl4YBJ..." \
https://api.yombo.net/api/v1/gateway/PZywd7j0VLR4PzWz/module?_pagelimit=1
  <div id="python<random_number></random_number>" class="tab-pane fade" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
import requests

url = 'https://api.yombo.net/api/v1/gateway/PZywd7j0VLR4PzWz/module?_pagelimit=1'
headers = {
    'x-api-key': 'abc123xyz789',
    'authorization': 'Waro7g0Mwl4YBJ...',
    }
response = requests.get(url, headers=headers)
  <div id="output<random_number></random_number>" class="tab-pane fade" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
{
    "response": {
        "uri": "/api/v1/gateway/PZywd7j0VLR4PzWz/module?_pagelimit=1",
        "uri_description": "List of modules attached to a gateway.",
        "doc_uri": "https://yombo.net/API:Gateway_modules",
        "gateway_module": [
            {
                "gateway_id": "PZywd7j0VLR4PzWz",
                "module_id": "E2dJKdPKWRn",
                "install_branch": "production",
                "module_type": "logic",
                "machine_label": "Presence",
                "label": "Presence",
                "short_description": "Tracks devices to determine their location in relation to a gateway location. This module only provides a framework.",
                "medium_description": "",
                "description": "Track devices. More details to come.",
                "medium_description_html": null,
                "description_html": null,
                "see_also": null,
                "repository_link": "https://bitbucket.org/yombo/module-presence-bluetooth",
                "issue_tracker_link": "",
                "install_count": 0,
                "doc_link": "https://bitbucket.org/yombo/module-presence-bluetooth",
                "git_link": "https://bitbucket.org/yombo/module-presence-bluetooth.git",
                "prod_branch": "master",
                "dev_branch": "",
                "prod_version": "8f04fd359d6673e46c00",
                "dev_version": null,
                "public": 2,
                "created_at": 1501369614,
                "updated_at": 1501369614,
                "status": 1,
                "variable_groups": [],
                "variable_fields": [],
                "variable_data": [],
                "device_types": [
                    {
                        "id": "4lmEgBYemYz1yPAJ",
                        "module_id": "E2dJKdPKWRn",
                        "device_type_id": "n7x5vzXg",
                        "created_at": 1499902495
                    }
                ]
            }
        ],
        "locator": "gateway_module",
        "locator_type": "objects"
    },
    "code": 200,
    "warnings": [],
    "pages": {
        "total_items": 26,
        "page_limit": 1,
        "total_pages": 26,
        "page_start": 1
    },
    "message": "OK",
    "html_message": "OK"
}

GET - Specific gateway module

Retrieve a specific module for a gateway.

Request URLs

  • GET https://api.yombo.net/api/v1/gateway/{gateway_id}/module/{module_id}

Parameters

None

Example

  <div id="curl<random_number></random_number>" class="tab-pane fade in active" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
curl \
-H "x-api-key: abc123xyz789" \
-H "authorization: Bearer Waro7g0Mwl4YBJ..." \
https://api.yombo.net/api/v1/gateway/PZywd7j0VLR4PzWz/module/E2dJKdPKWRn
  <div id="python<random_number></random_number>" class="tab-pane fade" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
import requests

url = 'https://api.yombo.net/api/v1/gateway/PZywd7j0VLR4PzWz/module/E2dJKdPKWRn'
headers = {
    'x-api-key': 'abc123xyz789',
    'authorization': 'Waro7g0Mwl4YBJ...',
    }
response = requests.get(url, headers=headers)
  <div id="output<random_number></random_number>" class="tab-pane fade" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
{
    "response": {
        "uri": "/api/v1/gateway/PZywd7j0VLR4PzWz/module/E2dJKdPKWRn",
        "uri_description": "Detailed information for a single module installed on a gateway.",
        "doc_uri": "https://yombo.net/API:Gateway_modules",
        "gateway_module": {
            "gateway_id": "PZywd7j0VLR4PzWz",
            "module_id": "E2dJKdPKWRn",
            "install_branch": "production",
            "module_type": "logic",
            "machine_label": "Presence",
            "label": "Presence",
            "short_description": "Tracks devices to determine their location in relation to a gateway location. This module only provides a framework.",
            "medium_description": "",
            "description": "Track devices. More details to come.",
            "medium_description_html": null,
            "description_html": null,
            "see_also": null,
            "repository_link": "https://bitbucket.org/yombo/module-presence-bluetooth",
            "issue_tracker_link": "",
            "install_count": 0,
            "doc_link": "https://bitbucket.org/yombo/module-presence-bluetooth",
            "git_link": "https://bitbucket.org/yombo/module-presence-bluetooth.git",
            "prod_branch": "master",
            "dev_branch": "",
            "prod_version": "8f04fd359d6673e46c00",
            "dev_version": null,
            "public": 2,
            "created_at": 1501369614,
            "updated_at": 1501369614,
            "status": 1,
            "variable_groups": [],
            "variable_fields": [],
            "variable_data": []
        },
        "locator": "gateway_module",
        "locator_type": "object"
    },
    "code": 200,
    "warnings": [],
    "message": "OK",
    "html_message": "OK"
}

POST - Install module

Adds a new module to be installed on the gateway.

Request URLs

  • POST https://api.yombo.net/api/v1/gateway/{gateway_id}/module

Parameters

Name Type Description
Required
module_id string Module to assign to gateway.
install_branch string Which development branch to install, one of: “production” or “development”
Optional
voice_cmd string Used by various systems to compile a possible list of voice commands for devices. This is what the person would say or type to activate the command. Usually the same as the label or machine_label.
status string Default: 1 - The status of the module. Default=1. Possible values: 0=disabled, 1=enabled, 2=mark for deletion

Example

  <div id="curl<random_number></random_number>" class="tab-pane fade in active" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
curl \
-H "x-api-key: abc123xyz789" \
-H "authorization: Bearer Waro7g0Mwl4YBJ..." \
-X POST -d '{"module_id": "3M2VK9x7q9r", "install_branch": "production"}' \
https://api.yombo.net/api/v1/gateway/PZywd7j0VLR4PzWz/module
  <div id="python<random_number></random_number>" class="tab-pane fade" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
import requests

url = 'https://api.yombo.net/api/v1/gateway/PZywd7j0VLR4PzWz/module'
headers = {
    'x-api-key': 'abc123xyz789',
    'authorization': 'Waro7g0Mwl4YBJ...',
    }

payload = {
    "module_id": "3M2VK9x7q9r",
    "install_branch": "production"
    }

response = requests.post(url, headers=headers, json=payload)
  <div id="output<random_number></random_number>" class="tab-pane fade" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
{
    "response": {
        "uri": "/api/v1/gateway/PZywd7j0VLR4PzWz/module",
        "uri_description": "Link module to gateway.",
        "doc_uri": "https://yombo.net/api/#gw-modules",
        "gateway_module": {
            "module_id": "3M2VK9x7q9r",
            "install_branch": "production",
            "gateway_id": "PZywd7j0VLR4PzWz",
            "updated_at": 1518681246,
            "created_at": 1518681246
        },
        "locator": "gateway_module",
        "locator_type": "object"
    },
    "code": 201,
    "warnings": [],
    "message": "Created",
    "html_message": "Created"
}

PUT / PATCH - Update a gateway module

Update settings for a gateway module. When using PUT, all required parameters must be sent. When using PATCH, only send in desired changes.

Request URLs

  • PATCH https://api.yombo.net/api/v1/gateway/{gateway_id}/module/{module_id}
  • PUT https://api.yombo.net/api/v1/gateway/{gateway_id}/module/{module_id}

Parameters

See post new command parameters.

Example

  <div id="curl<random_number></random_number>" class="tab-pane fade in active" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
curl \
-H "x-api-key: abc123xyz789" \
-H "authorization: Bearer Waro7g0Mwl4YBJ..." \
-X PUT -d '{"install_branch": "development"}' \
https://api.yombo.net/api/v1/gateway/PZywd7j0VLR4PzWz/module/3M2VK9x7q9r
  <div id="python<random_number></random_number>" class="tab-pane fade" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
import requests

url = 'https://api.yombo.net/api/v1/gateway/PZywd7j0VLR4PzWz/module/3M2VK9x7q9r'
headers = {
    'x-api-key': 'abc123xyz789',
    'authorization': 'Waro7g0Mwl4YBJ...',
    }

payload = {
    "install_branch": "development",
    }

response = requests.put(url, headers=headers, json=payload)
  <div id="output<random_number></random_number>" class="tab-pane fade" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
{
    "response": {
        "uri": "/api/v1/gateway/PZywd7j0VLR4PzWz/module/3M2VK9x7q9r",
        "uri_description": "Update gateway module.",
        "doc_uri": "https://yombo.net/API:Gateway_modules",
        "gateway_module": {
            "gateway_id": "PZywd7j0VLR4PzWz",
            "module_id": "3M2VK9x7q9r",
            "install_branch": "development",
            "module_type": "interface",
            "machine_label": "InsteonPLM",
            "label": "Insteon PLM",
            "short_description": "A Yombo Module that adds support for sending Insteon commands to the power lines through a USB or serial port. An Insteon API module is required.",
            "medium_description": "A Yombo Module that adds support for sending Insteon commands to the power lines through a USB or serial port. An Insteon API module is required.\r\n\r\n* asdf\r\n* zxcv",
            "description": "= Summary =\r\nA Yombo module that adds support for sending Insteon commands to the power lines through a USB or serial port. An Insteon API module is required.\r\n\r\n= Usage=\r\nThis module is an interface module between the Insteon API module and an Insteon PLM. The Insteon API module is required before this module can be used.\r\n\r\n= Installation = \r\nFrom the Gateway web interface (or other application), simply mark this module as being used by the gateway, and the gateway will download and install this module automatically.\r\n\r\n= Requirements =\r\nAn Insteon interface module is required to send commands to Insteon devices.\r\n\r\n= License =\r\n\r\nSee LICENSE.md in reposiorty for full details.\r\n\r\nThis module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r\n\r\nThe GNU General Public License can be found here: [http://www.gnu.org/licenses GNU.Org]\r\n\r\nThe [https://yombo.net Yombo] team and other contributors hopes that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.",
            "medium_description_html": "<p>A Yombo Module that adds support for sending Insteon commands to the power lines through a USB or serial port. An Insteon API module is required.</p>\n<ul><li>asdf</li>\n<li>zxcv</li>\n</ul>",
            "description_html": "<h1>Summary</h1>\n<p>A Yombo module that adds support for sending Insteon commands to the power lines through a USB or serial port. An Insteon API module is required.</p>\n<h1>Usage</h1>\n<p>This module is an interface module between the Insteon API module and an Insteon PLM. The Insteon API module is required before this module can be used.</p>\n<h1>Installation</h1>\n<p>From the Gateway web interface (or other application), simply mark this module as being used by the gateway, and the gateway will download and install this module automatically.</p>\n<h1>Requirements</h1>\n<p>An Insteon interface module is required to send commands to Insteon devices.</p>\n<h1>License</h1>\n<p>See LICENSE.md in reposiorty for full details.</p>\n<p>This module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</p>\n<p>The GNU General Public License can be found here: <a class=\"external text\" href=\"http://www.gnu.org/licenses\">GNU.Org</a></p>\n<p>The <a class=\"external text\" href=\"https://yombo.net\">Yombo</a> team and other contributors hopes that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>",
            "see_also": null,
            "repository_link": "https://github.com/yombo/module-insteonplm",
            "issue_tracker_link": "https://github.com/yombo/module-insteonplm/issues",
            "install_count": 0,
            "doc_link": "https://yombo.net/modules/insteonplm",
            "git_link": "https://github.com/yombo/module-insteonplm.git",
            "prod_branch": "master",
            "dev_branch": "",
            "prod_version": "278d0504f4d7a1b59bc1",
            "dev_version": null,
            "public": 2,
            "created_at": 1518681523,
            "updated_at": 1518681567,
            "status": 1
        },
        "locator": "gateway_module",
        "locator_type": "object"
    },
    "code": 200,
    "warnings": [],
    "message": "Updated",
    "html_message": "Updated"
}

DELETE - Uninstall module

Uninstall a module from a gateway. This will also delete any variable data assigned to this module.

Request URLs

  • DELETE https://api.yombo.net/api/v1/gateway/{gateway_id}/module/{module_id}

Parameters

None

Example

  <div id="curl<random_number></random_number>" class="tab-pane fade in active" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
curl \
-H "x-api-key: abc123xyz789" \
-H "authorization: Bearer Waro7g0Mwl4YBJ..." \
-X DELETE https://api.yombo.net/api/v1/gateway/PZywd7j0VLR4PzWz/module/3M2VK9x7q9r
  <div id="python<random_number></random_number>" class="tab-pane fade" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
import requests

url = 'https://api.yombo.net/api/v1/gateway/PZywd7j0VLR4PzWz/module/3M2VK9x7q9r'
headers = {
    'x-api-key': 'abc123xyz789',
    'authorization': 'Waro7g0Mwl4YBJ...',
    }

response = requests.put(url, headers=headers)
  <div id="output<random_number></random_number>" class="tab-pane fade" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
{
    "response": {
        "uri": "/api/v1/gateway/PZywd7j0VLR4PzWz/module/3M2VK9x7q9r",
        "uri_description": "Gateway mdoule deleted",
        "doc_uri": "https://yombo.net/API:Gateway_modules",
        "gateway_module": "Deleted",
        "locator": "gateway_module",
        "locator_type": "string"
    },
    "code": 200,
    "warnings": [],
    "message": "Deleted",
    "html_message": "Deleted"
}