tbottest.powercontrol

A module containing various additional connectors for controlling power. These are:

class tbottest.powercontrol.GpiopmControl[source]

Bases: PowerControl

control Power On/off through a Gpio pin

Example: (board config)

from tbot.machine import board
from tbottest.powercontrol import GpiopmControl

class MyControl(GpiopmControl, board.Board):
    gpiopmctl_pin = "17"
    gpiopmctl_state = "1"
class tbottest.powercontrol.PowerShellScriptControl[source]

Bases: PowerControl

control Power On/off with a shell script

The shell script needs to evaluate the first parameter passed to the script. Values are:

“on” for powering on the board

“off” for powering off the board

Example: (board config)

from tbot.machine import board
from tbottest.powercontrol import PowerShellScriptControl

class MyControl(PowerShellScriptControl, board.Board):
    shell_script = "<path to shell script"
abstract property shell_script: str

shell command executed

This property is required.

class tbottest.powercontrol.ShellyControl[source]

Bases: PowerControl

control Power On/off with a Shelly device through shelly-ctrl

https://github.com/EmbLux-Kft/shelly-ctrl

shelly-ctrl runs on the lab host, which must reach the Shelly device in its network. By default tbot uses shelly-ctrl.py from the PATH of the lab host, else shelly-ctrl from the directory shelly-ctrl in the toolsdir of the lab host. If it is in neither place, tbot clones it into this directory and installs its python dependencies into a virtual environment .venv in it, unless shelly_install is False. tbot looks for it only once per run.

Example: (board config)

from tbot.machine import board
from tbottest.powercontrol import ShellyControl

class MyControl(ShellyControl, board.Board):
    shelly_device = "192.168.1.86"
    shelly_id = "0"
abstract property shelly_device: str

the Shelly device, given by IP, by MAC or by its mDNS name

This property is required.

property shelly_id: str

channel of multi channel devices, default “0”

property shelly_command: str | None

shelly-ctrl command on the lab host. Leave unset to use shelly-ctrl.py from the PATH of the lab host, else shelly-ctrl in shelly_tooldir(), installed there if needed. A command given here is not installed, tbot stops if it is not found.

property shelly_tooldir: Path

directory of shelly-ctrl on the lab host, default shelly-ctrl in the toolsdir of the lab host

property shelly_repo: str

git repository tbot clones shelly-ctrl from

property shelly_install: bool

clone and install shelly-ctrl into shelly_tooldir() if it is in neither place, default True. With False tbot stops instead.

property shelly_timeout: str | None

maximum time in seconds to look up MAC or mDNS name, leave unset to use the default of shelly-ctrl

class tbottest.powercontrol.SispmControl[source]

Bases: PowerControl

control Power On/off with sispmctl

http://sispmctl.sourceforge.net/

Example: (board config)

from tbot.machine import board
from tbottest.powercontrol import SispmControl

class MyControl(SispmControl, board.Board):
    sispmctl_device = "01:01:5c:29:39"
    sispmctl_port = "2"
abstract property sispmctl_device: str

Device used. Get device id with sispcmtl -s

This property is required.

abstract property sispmctl_port: str

port used.

This property is required.

class tbottest.powercontrol.TboxCtrlControl[source]

Bases: PowerControl

control Power On/off through tbox-ctrl (a tbox SYSTEM Controller Modul, talking to the board over USB HID)

https://gitlab.nabladev.com/nabla/tbox/tbox-ctrl

Example: (board config)

from tbot.machine import board
from tbottest.powercontrol import TboxCtrlControl

class MyControl(TboxCtrlControl, board.Board):
    tbox_powerpin = "P1_5V_EN"
abstract property tbox_powerpin: str

the tbox-firmware pin to switch, e.g. “P1_5V_EN”, “P2_12V_EN”, “P3_24V_EN”, … (see tbox-firmware/src/pins.h for the full list)

This property is required.

property tbox_vid: int | None

optional USB VID override for tbox-ctrl’s –vid - leave unset to use tbox-ctrl’s own default (0x1209, pid.codes shared VID).

property tbox_pid: int | None

optional USB PID override for tbox-ctrl’s –pid - leave unset to use tbox-ctrl’s own default (0x0001).

class tbottest.powercontrol.TinkerforgeControl[source]

Bases: PowerControl

control Power On/off with Tinkerforge

https://www.tinkerforge.com/

Example: (board config)

from tbot.machine import board
from tbottest.powercontrol import TinkerforgeControl

class MyControl(TinkerforgeControl, board.Board):
    channel = ""
    uid = ""
abstract property channel: str

channel used.

This property is required.

abstract property uid: str

This property is required.

class tbottest.powercontrol.TM021Control[source]

Bases: PowerControl

control Power On/off with DH Electronics TM-021 4-fach Relaismodul

https://www.dh-electronics.com

Example: (board config)

from tbot.machine import board
from tbottest.powercontrol import TM021Control

class MyControl(TM021Control, board.Board):
    tm021_device = "/dev/relais"
    tm021_baudrate = "500000"
    tm021_timeout = "5"
    tm021_address = "0"
    tm021_port = "1"
    tm021_debug = False
abstract property tm021_baudrate: str

Baudrate for serial device

abstract property tm021_timeout: str

timeout for one command in seconds

abstract property tm021_device: str

linux device used.

This property is required.

abstract property tm021_address: str

The address of the relais

This property is required.

abstract property tm021_port: str

The port of the relais

This property is required.

abstract property tm021_debug: str

Enable debug traces