Search code examples
thingsboard

How to get current time in thingsboard MQTT exchange


request time from thingsboard.io through its time plugin RPC using MQTT.
will it be accurate.


Solution

  • def getTime():
    requestId = '1'
    request = {
        "method": "getTime",
        "params": {}
    }
    client.publish('v1/devices/me/rpc/request/' + requestId, json.dumps(request))
    

    and subsrcibe to rpc on connect callback.