Creating Controllers
Basic Controller Structure
from core.controller import Controller
class DeviceController(Controller):
@staticmethod
async def handle_message(device_id: str, payload, client):
"""Handle incoming MQTT messages for devices"""
# Your business logic here
return {"status": "success"}Controller Requirements
1. Extend Controller Base Class
from core.controller import Controller
class MyController(Controller):
# Your controller methods here2. Use Static Async Methods
3. Method Parameters
Example Controllers
Simple Message Handler
Device Control Controller
Controller Organization
File Naming
Class Naming
Method Naming
Error Handling
Next Steps
Last updated