pdf-icon

Tencent

Connect to the Tencent IoT cloud service platform.


from IoTcloud.Tencent import Tencent

# Initialize connection
tencent = Tencent(
    product_id='XXXXXXXXXXX', 
    device_name='XXXXXXX', 
    username='XXXXXXXXXXXXXXXXXX;12010126;B335D;1702277766',
    password='e822dc0027a1b363f9ed1a23fb77860c0b707d7d;hmacsha1',
    port=1883,
    keepalive=30
)

# Upload data
tencent.publish_property_msg(temperature=temp,humidity=humid)


# Downlink data callback
def tencent_fun(property_data):
  print(property_data)

# Subscribe to platform-issued messages
tencent.subscribe_property_msg(tencent_fun)

On This Page