Source code for device_client.client_magnets_psswitch
from device_client import DeviceClient
from device.magnets_ps_switch import PowerSupply_Magnets_SwitchOnOff
description = """
Use command **Switch ON** to turn on the power supply devices (big and small).
Once the devices appear, you do not need to interact with this device anymore.
"""
[docs]
def connect(name, password, server, serial):
client = DeviceClient(name, password,
title="Magnetic field: Switch for PS", description=description)
hw = PowerSupply_Magnets_SwitchOnOff(
bus=serial,
log_callback=client.emit_log,
)
client.register_command(hw.switch_on, "Switch ON")
client.register_command(hw.switch_off, "Switch OFF")
client.keep_server_updated(
hw.is_ready, 1, server, retry_on_error=True
)