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.
- For detailed python interactions, more examples, see: Devices @ Yombo Python API
- This module calls various hooks. For a listing, see Hooking into hooks
- _device_added_ - Called after a device has been added to the system.
- _device_before_add_ - Called before a new device is submitted to Yombo API to be added.
- _device_before_delete_ - Called before a device about to be delete from both the Yombo API and the system.
- _device_before_edit_ - Called before the device details have been updated with the Yombo API.
- _device_before_update_ - Called just before a device is updated.
- _device_deleted_ - Called after a device has been deleted from the system.
- _device_edited_ - Called after the device details have been updated with the Yombo API.
- _device_status_ - Sent when a device changes status.
- _device_updated_ - Called just after a device has been updated.
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].
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').