Library: devices

From Yombo
Jump to: navigation, search
devices
Commonly Used Yes
Status Active

Summary
Managing devices, sendings commands, etc.

Introduction

Devices are anything that can be monitored and/or controlled. This includes items like lights, fans, garage doors, thermostats and alarm systems. Devices can be non-physical things, such as a text file, twitter account, email address, etc.

  • The devices library is primarily responsible for:
  • Keeping track of all devices.
  • Maintaining device state.
  • Routing commands to modules for processing.
  • Managing delay commands to send later.

See also

Hooks

Usage

The Devices library can act as both a dictionary and an object. For doing simple lookups for devices, access it as a dictionary. The devices library can be accessed from any module through a pre-defined variable called [filebg]self._Devices[/filebg].

Common Functions

For complete list of functions and additional examples,see: Devices @ Yombo Python API

  • command('device-label', 'command-label') (source) (doc) - Sends a command to a device. Accepts either device-label or device-id for a device and command-machine_label or command-id for the command.
  • get('device-label'|'device_id') (source) (doc) - A the device instance (see below). It's easier to use self._Devices[device-label'|'device_id]
  • search(kwargs) (source) (doc) - Search any device attribute. For example, to search for any devices who's device_type_id is 'abc123': search(device_type_id='abc123').


This page was last edited on 13 September 2018.