-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
enhancementNew feature or requestNew feature or requestquestionFurther information is requestedFurther information is requested
Description
It would be pretty cool to have a full decorator-styled syntax for a server to provide access to the various data points that could be defined for SEL Protocol Regions. Take this for example:
from selprotopy.server import SELProtoServer
# Create a simple server listening on all network interfaces on port 23
server = SELProtoServer(
host="0.0.0.0",
port=23,
fid="SEL-751....",
)
@server.fast_meter_binary("52A")
def serve_52A() -> bool:
"""Respond with a Boolean to Represent the 52A Status."""
return True
@server.fast_meter_analog("IA")
def serve_IA() -> complex:
"""Return the Complex Value for the Phase-A Current."""
# Return the static value: 67 /_ 120
return complex(-33.45 + 58.024j)
@server.command_response("MET E")
def met_e_command() -> str:
"""Respond to the `MET E` Command with an Appropriate set of Data."""
with open("my_saved_met_e.txt", 'r', encoding='utf-8') as file:
return file.read()
if __name__ == "__main__":
server.run()Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestquestionFurther information is requestedFurther information is requested