I'm going to do a project of controlling Tuya smart device with phone without using Tuya apps. I now have python code for calling Tuya API. I would like to now implement middle man that handling API calling and send data/ receive command to/from the Android application (kotlin) like Google Cloud for example. I want middle man and separate application because I want to also implement AI recognizing usage pattern later.
Could you recommend what kind of middle man platform would be capable of handling both task? What do I have to implement allowing the middle man to able to connect with the Android application?
Here's example of code of calling API from python:
def connect_to_tuya(access_endpoint:str, access_id:str, access_key:str):
openapi = TuyaOpenAPI(access_endpoint, access_id, access_key)
openapi.connect()
return openapi
def power_device(openapi:TuyaOpenAPI, device_id:str, state:bool):
commands = {'commands': [{'code': 'switch_led', 'value': state}]}
response = openapi.post('/v1.0/iot-03/devices/{}/commands'.format(device_id), commands)
return response
A way or diagram with some details about what to implement, what platforms to used