Developing modules

From Yombo
Jump to: navigation, search

Creating new modules, or enhancing an existing module is simple. Modules are written in python, however, due to our framework, non-programmers can implement advanced logic and deploy local modules. Modules allow the gateway to communicate with various automation devices using any type of protocol and communication method.

Getting Started

The following articles walk you step by step on building a custom module. It starts off slowly and continues to build in complexity and function.

  1. Building your first module - A quick guide on building your first module.
  2. Controlling devices - Learn how to control devices and receive status updates from devices.
  3. Magic features - Learn about magic attributes, functions & methods, and files.
  4. Hooking into hooks - Hooks allows modules to interact closely with the Yombo gateway framework. They make it possible to see all commands being sent, statistics being generated, and more.
  5. Version control - It's importing to save your work and track changes to your work. This article discusses the use of git as a revision tracking system. You can skip this step if you know git.
  6. localmodule.ini - To test or use the module locally without publishing it publicly, use the localmodule.ini file.
  7. Publishing your module - Distribute your module for others to use. Yombo allows modules to be marked for download and installation.

Getting the most from libraries

The libraries provide a lot of useful functionality and provide easy to use components to handle common and/or complex tasks. For example, if you want to know if it's light or dark outside, use the States module. If you want to know the operating system being used, use the Atoms module. If you want to know if the moon, Saturn, or any planet is above or below the horizon, use the time's library.

Libraries

Check out the full list of libraries available.

Exceptions

Exceptions are raised when an error is caught or something bad happened.

Utility Functions

Utility functions are provided to help a module developer get through a task faster. Such as, seeing if a value exists in a dictionary, or convert a string to a bool (True/False). For these, and much more, see Utility Functions from the source code documentation.

See Utilities documentation for more.

Other References

  • API - Documentation for API.Yombo.Net - Manage various items for a Yombo Gateway, including it's devices and configuration.
  • Runtime data reference - See currently available commands, input types, device types, and more.

Module Types

Yombo modules can consist of three kinds of modules:

  1. Command modules are responsible for receiving commands for a specific device type (example: X10 Lamp module), and formatting the command into a usable form for an interface module.
  2. Interface modules are responsible for interacting with devices on the outside world. For example, they interact with USB devices, serial port, IO ports, network devices, file system, or anything that can be imagined. They receive commands from command modules and send device status updates to command modules. Think of interface modules as the glue between a command and the end device.
  3. Logic modules don't manage any specific device, however, they can send commands to be processed by command modules. In the demo module below, this is considered a logic module.