iotcloud - iotcloud Cloud platform library (supported: tengxun cloud ariyun onenet huawei cloud graffiti cloud baidu cloud others will also support, useful issue will accelerate support )#

Adaptation status unknown

Note

This page document is automatically generated by this file. If there is any error, please submit issue or help modify pr, thank you!

Example

--Note: due to the use of sys.wait() all apis need to be used in the coroutine

Constant#

constant

type

explanation

iotcloud.TENCENT

string

Tencent Cloud

iotcloud.ALIYUN

string

Alibaba Cloud

iotcloud.ONENET

string

China Mobile Cloud

iotcloud.HUAWEI

string

HUAWEI CLOUD

iotcloud.TUYA

string

graffiti cloud

iotcloud.BAIDU

string

Baiduyun

iotcloud.CONNECT

string

Connect to the server

iotcloud.SEND

string

Send Message

iotcloud.RECEIVE

string

Message received

iotcloud.DISCONNECT

string

Server Disconnected

iotcloud.OTA

string

ota Message

iotcloud.new(cloud,iot_config,connect_config)#

Create a cloud platform object

Parameters

Incoming Value Type

Explanation

string

Cloud Platform iotcloud.TENCENT: Tencent Cloud iotcloud.ALIYUN: Alibaba Cloud iotcloud.ONENET: China Mobile Cloud iotcloud.HUAWEI: Huawei Cloud iotcloud.TUYA: Graffiti Cloud

table

iot Cloud platform configuration, device_name: optional, default is imei, otherwise it is unique_id iot_config.product_id: product id (ariyun is product key) iot_config.product_secret: product key, if there is this item, it is dynamic registration iot_config.key: device secret key, if there is this item, it is secret key connection userid: user ID,onenet dedicated, dynamic registration userkey: user Accesskey, onet dynamic registration

table

mqtt Configuration, host: optional, default is platform default host ip: optional, default is platform default ip tls: encryption, if there is this item is generally product certification keepalive: heartbeat time, unit s is optional, default 240

Return Value

return value type

explanation

table

Cloud Platform Objects

Examples

-- alibaba cloud dynamic registration
iotcloudc = iotcloud.new(iotcloud.ALIYUN,{product_id = "xxx",product_secret = "xxx"})

cloudc:connect()#

Cloud Platform Connectivity

Parameters

None

Return Value

None

Examples

iotcloudc:connect()

cloudc:disconnect()#

Cloud platform disconnected

Parameters

None

Return Value

None

Examples

iotcloudc:disconnect()

cloudc:subscribe(topic, qos)#

Cloud Platform Subscription

Parameters

Incoming Value Type

Explanation

string/table

Theme

number

topic 0/1/2 Default 0

Return Value

None

Examples

None


cloudc:unsubscribe(topic)#

Cloud platform unsubscribe

Parameters

Incoming Value Type

Explanation

string/table

Theme

Return Value

None

Examples

None


cloudc:publish(topic,data,qos,retain)#

Cloud platform release

Parameters

Incoming Value Type

Explanation

string/table

Theme

string

Message, required, but length can be 0

number

Message Level 0/1 Default 0

number

Archive, 0/1, default 0

Return Value

None

Examples

None


cloudc:close()#

Cloud platform shutdown

Parameters

None

Return Value

None

Examples

iotcloudc:close()