-
Notifications
You must be signed in to change notification settings - Fork 3
Peripheral Drivers
- What Is A Peripheral
- What Are Peripheral Drivers?
- Location On Disk
- Installing And Using Peripheral Drivers
- Writing Peripheral Drivers
The qToggle API allows a device to expose ports. These ports are usually ways to communicate with peripherals physically or logically attached to the device.
While a GPIO pin may be represented by a single boolean port, a Bluetooth thermostat or a 1-wire temperature & humidity sensor may require multiple ports to represent their state. These multiple ports must be managed together since they share way they communicate with the peripheral.
qToggleServer introduces the concept of peripheral to make it easier to manage multiple ports corresponding to the same peripheral.
A peripheral driver creates one ore more ports that correspond to the same peripheral and that will be exposed by the server. Peripheral drivers indicate:
- the name of the peripheral, normally supplied by the user, which becomes part of the ids of exposed ports
- the exposed ports, similarly to a port driver
- what actually happens when values are written to or read from ports
For example, qtoggleserver-paradox provides a driver that will create ports for indicated areas & zones of a Paradox alarm installation.
Peripheral drivers provided by qToggleServer are found in the qtoggleserver/drivers/peripherals
package.
External peripheral drivers may be provided by add-ons, shipped via Python packages that usually go into your Python virtual environment or directly into your system's Python site packages path.
User-provided drivers can be placed in any folder covered by the Python interpreter path. The PYTHONPATH
environment variable can be adjusted to include custom paths.
Most peripheral drivers come in the form of an add-on and are installable using pip
. Adding a port to qToggleServer is done by adding an entry in the peripherals
section of the qtoggleserver.conf
file. Follow the add-on documentation in order to install and add it to qToggleServer.
If you haven't found an add-on that offers the functionality you need and you're interested in writing one yourself, start off by reading the Writing Peripheral Drivers page.