This guide implements a transport-independent DeviceClass, exposes it through an ese774 Frame device server, and calls it from a separate client process. This is a minimal HTTP / FastAPI example, not a gRPC Frame startup procedure.
Install ese774 Frame in your Python environment.
pip install ese774-frame
Using a DeviceClass directly in Python does not require starting a server or client.
Save the following as server.py.
from ese774_frame.api_server import FastApiServer
class SimpleCtrl:
def __init__(self, name: str = "simple", logger=None):
self._name = name
self._logger = logger
def echo(self, value: str) -> str:
return value
@property
def name(self) -> str:
return self._name
if __name__ == "__main__":
server = FastApiServer(
device_cls=SimpleCtrl,
router_cls=None,
config=None,
api_spec=None,
device_kwargs={"name": "simple"},
object_name="simple",
)
server.run(host="127.0.0.1", port=8000)
SimpleCtrl is an ordinary Python class with no knowledge of HTTP, FastAPI, gRPC, or client implementations. At startup, FastApiServer instantiates it with device_cls(**device_kwargs, logger=self.logger), so its constructor accepts logger. The server’s object_name="simple" must match the client’s object name.
This example selects automatic dispatch with api_spec=None and the standard DeviceRouter with router_cls=None. For custom routers or explicit APIs, see Dynamic dispatch and explicit APIs.
Run the following in a terminal.
python server.py
The server listens on 127.0.0.1:8000, a loopback address not intended for external network exposure.
Save the following as client.py. Run it in another terminal while the server remains running.
from ese774_frame.clients.sync_device_client import SyncDeviceClient
client = SyncDeviceClient(
server_ip="127.0.0.1",
server_port=8000,
object_name="simple",
)
try:
print(client.echo("hello")) # hello
print(client.name) # simple
finally:
client.close()
When api_spec is omitted, SyncDeviceClient uses automatic dispatch. Here, echo() and the readable name property are exposed by the DeviceClass. client.close() releases the HTTP client resources.
This example does not require DeviceProxy registration. Dedicated client registration and the Factory are covered separately in DeviceProxy and Factory usage.
For real hardware, design initialization and shutdown, mutual exclusion, connection-loss handling, and device-specific error handling. The Frame handles request/response transport and error propagation across the network boundary; the DeviceClass must not depend on HTTP-specific operations. Exposing the server beyond the local machine also requires access controls and network configuration.
ese774 Frame source code and README
The earlier Quick Start is preserved as historical documentation, not as the current specification.