API
PyWiThrottle.
Connect to a WiThrottle server and return a connection object.
__init__(self, server_ip=None, server_port=None, dcc_address_scheme='S')
special
PyWiThrottle.
Connect to a WiThrottle server and return a connection object.
- Parameters:
server_ip:
str– The IP Address of the serverserver_port:
int– The TCP Port of the serverdcc_address_scheme:
str– A single, upper-case character denoting short (S) or long (L) DCC Addresses
connect(self)
connect.
Connect to the server.
disconnect(self)
disconnect.
Disconnect from the server and close the connection.
function_control(self, loco_id, state, function_id)
function_control
Control the DCC functions of the locomotive (lights, sound, etc)
- Parameters:
loco_id:
int– The DCC channel that the logo is configured to listen onstate:
int– The target state of the DCC function - 0 = off, 1 = onfunction_id:
int– The DCC Function ID to toggle
register_loco(self, dcc_id, roster_id)
register_loco
Register a new locomotive with the server so we can control it
- Parameters:
dcc_id:
int– The DCC Channel that the logo is configured to listen onroster_id:
int– The ID to use when selecting from the roster (currently unused)