MCPcopy Create free account
hub / github.com/bdring/FluidNC / handle_read

Method handle_read

examples/http_command/http_command_server.py:145–153  ·  view source on GitHub ↗

Respond to /api/read with multiple sensor values

(self)

Source from the content-addressed store, hash-verified

143 self.send_json_response(response_data)
144
145 def handle_read(self):
146 """Respond to /api/read with multiple sensor values"""
147 response_data = {
148 "temp": round(23.0 + random.uniform(-2, 2), 1),
149 "humidity": round(52 + random.uniform(-8, 8), 1),
150 "pressure": round(1013.25 + random.uniform(-5, 5), 2),
151 "timestamp": datetime.now().isoformat()
152 }
153 self.send_json_response(response_data)
154
155 def handle_health(self):
156 """Respond to /health with simple health check"""

Callers 1

do_GETMethod · 0.95

Calls 1

send_json_responseMethod · 0.95

Tested by

no test coverage detected