{"id":27861014,"url":"https://github.com/iot-thingscloud/luatos-thingscloud-sdk","last_synced_at":"2025-05-04T18:26:24.074Z","repository":{"id":174328642,"uuid":"611277177","full_name":"IoT-ThingsCloud/luatos-thingscloud-sdk","owner":"IoT-ThingsCloud","description":"基于合宙模组 LuatOS 快速接入 ThingsCloud 物联网平台的 SDK ，帮你 10 分钟完成模组到云平台的双向通信。","archived":false,"fork":false,"pushed_at":"2024-03-18T12:41:50.000Z","size":4321,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-03-18T13:47:46.464Z","etag":null,"topics":["air780e","air780eg","luatos","mqtt","thingscloud"],"latest_commit_sha":null,"homepage":"https://www.thingscloud.xyz/","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IoT-ThingsCloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-03-08T13:50:24.000Z","updated_at":"2023-10-17T15:57:59.000Z","dependencies_parsed_at":"2023-07-05T07:15:16.798Z","dependency_job_id":"794dd02f-c2d9-42cf-83ed-fd8bbd5d3d20","html_url":"https://github.com/IoT-ThingsCloud/luatos-thingscloud-sdk","commit_stats":null,"previous_names":["iot-thingscloud/luatos-thingscloud-sdk"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IoT-ThingsCloud%2Fluatos-thingscloud-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IoT-ThingsCloud%2Fluatos-thingscloud-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IoT-ThingsCloud%2Fluatos-thingscloud-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IoT-ThingsCloud%2Fluatos-thingscloud-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IoT-ThingsCloud","download_url":"https://codeload.github.com/IoT-ThingsCloud/luatos-thingscloud-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252379851,"owners_count":21738657,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["air780e","air780eg","luatos","mqtt","thingscloud"],"created_at":"2025-05-04T18:26:23.449Z","updated_at":"2025-05-04T18:26:24.066Z","avatar_url":"https://github.com/IoT-ThingsCloud.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# luatos-thingscloud-sdk\n\n这里是基于合宙模组 [LuatOS](https://wiki.luatos.com/) 快速接入 [ThingsCloud](https://www.thingscloud.xyz) 物联网平台的 SDK ，帮你 10 分钟完成模组到云平台的双向通信，一键生成物联网 SaaS 后台，以及用户 App，快速落地物联网项目和产品。\n\n## 特点\n\n- 简单，简单，简单，填写几个参数就可以烧录运行。\n- 可实现传感器数据上报和控制下发，利用各种外设发挥你的想象空间。\n- 封装了 ThingsCloud 接入协议，只需调用函数和绑定事件，就可以实现设备和云平台双向通信。\n- 支持自定义Topic，通过云平台设备类型的自定义数据流。\n- 支持一型一密/自动注册设备，用于量产设备。\n- 享受 ThingsCloud 云平台所有特性，一键生成物联网 SaaS 后台，以及用户 App，快速落地物联网项目和产品。\n\n## 支持模组\n\n- Air780E\n- Air780EG\n- Air700E\n- Air600E\n\n对于 Air724/820 系列模组，请移步到 [luat-thingscloud-libs](https://github.com/IoT-ThingsCloud/luat-thingscloud-libs)\n\n## ThingsCloud 准备工作\n\n- [快速上手控制台](https://www.thingscloud.xyz/docs/guide/quickstart/signin-console.html)\n- [如何获得设备证书？](https://www.thingscloud.xyz/docs/guide/connect-device/device-certificate.html)\n- [ThingsCloud MQTT 接入文档](https://docs.thingscloud.xyz/guide/connect-device/mqtt.html)\n\n\n## 使用方法\n\n### 引用库文件\n\n在主程序中引入库文件：\n\n```lua\nlocal ThingsCloud = require \"ThingsCloud\"\n```\n\n然后将 `libs/` 下的库文件添加到项目的脚本列表中。\n\n\n### 定义设备证书和连接参数\n\n- 进入 ThingsCloud 控制台：https://www.thingscloud.xyz\n- 创建项目，可选择免费版。\n- 创建设备，进入设备详情页的【连接】页面，复制设备证书和MQTT接入点地址。请勿泄露你的设备证书。\n\n![articles/2023/20230308225114_a177c9cd9a38216ca9872f51c8c31f9f.png](https://img-1300291923.cos.ap-beijing.myqcloud.com/articles/2023/20230308225114_a177c9cd9a38216ca9872f51c8c31f9f.png)\n\n```lua\n-- 一机一密方式\n-- ProjectKey\nlocal projectKey = \"\"\n-- AccessToken\nlocal accessToken = \"\"\n-- MQTT 接入点，只需主机名部分\nlocal host = \"\"\n```\n\n### 连接 ThingsCloud\n\n```lua\n-- 设备接入云平台的初始化逻辑，在独立协程中完成\nsys.taskInit(function()\n    -- 连接云平台，支持判断网络可用性、MQTT自动重连\n    -- 这里采用了设备一机一密方式，需要为每个设备固件单独写入证书。另外也支持一型一密，相同设备类型下的所有设备使用相同固件。\n    ThingsCloud.connect({\n        host = host,\n        projectKey = projectKey,\n        accessToken = accessToken,\n    })\nend)\n```\n\n### 烧录固件\n\n使用 Luatools 烧录底层固件和脚本，底层固件在 core/ 目录下。\n\n![articles/2023/20230309183140_8791097d56f2594bb981b675615b3842.png](https://img-1300291923.cos.ap-beijing.myqcloud.com/articles/2023/20230309183140_8791097d56f2594bb981b675615b3842.png)\n\n\n## 示例项目\n\n[点此进入示例目录](https://github.com/IoT-ThingsCloud/luatos-thingscloud-sdk/tree/main/examples)\n\n\n### 连接云平台\n\n#### 普通连接（一机一密）\n\n[01.ThingsCloud_Connect/basic_connect](examples/01.ThingsCloud_Connect/basic_connect)\n\n#### 动态获取证书（一型一密）\n\n[01.ThingsCloud_Connect/fetch_certificate](examples/01.ThingsCloud_Connect/fetch_certificate)\n\n#### 自动创建设备+动态获取证书（一型一密）\n\n[01.ThingsCloud_Connect/fetch_certificate_auto_create](examples/01.ThingsCloud_Connect/fetch_certificate_auto_create)\n\n### 和云平台双向通信\n\n#### 属性上报\n\n[02.ThingsCloud_Communicate/attributes_report](examples/02.ThingsCloud_Communicate/attributes_report)\n\n#### 接收下发属性\n\n[02.ThingsCloud_Communicate/attributes_push](examples/02.ThingsCloud_Communicate/attributes_push)\n\n#### 获取云端属性\n\n[02.ThingsCloud_Communicate/attributes_get](examples/02.ThingsCloud_Communicate/attributes_get)\n\n#### 事件上报\n\n[02.ThingsCloud_Communicate/event_report](examples/02.ThingsCloud_Communicate/event_report)\n\n#### 接收下发命令\n\n[02.ThingsCloud_Communicate/command_send](examples/02.ThingsCloud_Communicate/command_send)\n\n#### 自定义数据流\n\n[02.ThingsCloud_Communicate/custom_data](examples/02.ThingsCloud_Communicate/custom_data)\n\n### 综合示例\n\n#### 透传 DTU（支持二进制通信，也可用于 RS485 透传）\n\n[10.IoT_Tutorials/uart_dtu](examples/10.IoT_Tutorials/uart_dtu)\n\n#### 透传 DTU（JSON 透传）\n\n[10.IoT_Tutorials/uart_json](examples/10.IoT_Tutorials/uart_json)\n\n#### 透传 DTU（支持 GPS 模块）\n\n[10.IoT_Tutorials/air780eg_dtu_json](examples/10.IoT_Tutorials/air780eg_dtu_json)\n\n#### GPS 上报\n\n[10.IoT_Tutorials/air780eg_gps_tracker](examples/10.IoT_Tutorials/air780eg_gps_tracker)\n\n#### 云平台控制 GPIO 输出 —— 网络继电器\n\n[10.IoT_Tutorials/gpio_out](examples/10.IoT_Tutorials/gpio_out)\n\n#### SHT30 传感器上报\n\n[10.IoT_Tutorials/sht30_sensor](examples/10.IoT_Tutorials/sht30_sensor)\n\n#### 云平台控制 PWM 输出 —— 电机调速\n\n[10.IoT_Tutorials/pwm_out](examples/10.IoT_Tutorials/pwm_out)\n\n#### ADC 模拟量采集\n\n[10.IoT_Tutorials/adc_sensor](examples/10.IoT_Tutorials/adc_sensor)\n\n#### OTA 升级 - 云平台主动推送模式\n\n[10.IoT_Tutorials/ota_push](examples/10.IoT_Tutorials/ota_push)\n\n#### OTA 升级 - 设备检查新版本\n\n[10.IoT_Tutorials/ota_check](examples/10.IoT_Tutorials/ota_check)\n\n#### OTA 升级 - 主控 MCU 通过 Air780E 检查新版本并下载固件\n\n[10.IoT_Tutorials/ota_check_uart_mcu](examples/10.IoT_Tutorials/ota_check_uart_mcu)\n\n\n更多示例代码完善中，欢迎你的建议，也欢迎提交贡献。\n\n\n\n## 关于 ThingsCloud\n\nThingsCloud 是物联网设备统一接入平台和低代码应用开发平台。可以帮助任何需要数字化改造的行业客户，在极短的时间内搭建物联网应用，并适应不断变化的发展需求。ThingsCloud 支持智能传感器、执行器、控制器、智能硬件等设备接入，支持 MQTT/HTTP/TCP/Modbus/LoRa/Zigbee/WiFi/BLE 等通信协议，实现数据采集、分析、监控，还可以灵活配置各种规则，生成项目应用 SaaS 和用户应用 App，这一切无需任何云端代码开发。\n\n- 官网：https://www.thingscloud.xyz/\n- 控制台：https://console.thingscloud.xyz/\n- 教程：https://docs.thingscloud.xyz/tutorials/\n- 使用文档：https://docs.thingscloud.xyz\n- 设备接入：https://docs.thingscloud.xyz/guide/connect-device/\n- 博客：https://www.thingscloud.xyz/blog/\n- B站：https://space.bilibili.com/1953347444\n\n\n![articles/2023/20230112114634_afd61232cd029fca77eaebe67e12beaf.png](https://img-1300291923.cos.ap-beijing.myqcloud.com/articles/2023/20230112114634_afd61232cd029fca77eaebe67e12beaf.png)\n\n![](https://img-1300291923.cos.ap-beijing.myqcloud.com/articles/2023/20230303162529_7d47018b2466053ef3af13dcfd23b703.png)\n\n![](https://img-1300291923.cos.ap-beijing.myqcloud.com/articles/2023/20230303194054_fe9320028f7b499a18893b7a0d25b3c7.png)\n\n![](https://img-1300291923.cos.ap-beijing.myqcloud.com/articles/2023/20230303163508_4b2e3b2052e282bcf2e36143fe90d101.png)\n\n![](https://img-1300291923.cos.ap-beijing.myqcloud.com/articles/2023/20230303164617_c0f98e1ae66b5987aba3408faf86ac1d.png)\n\n![](https://img-1300291923.cos.ap-beijing.myqcloud.com/articles/2023/20230303163103_40fe1d013e8d1d665bdd3cd0ae42adc0.png)\n\n### 技术支持\n\n联系 ThingsCloud 技术支持\n\n![](https://img-1300291923.cos.ap-beijing.myqcloud.com/service/support-qrcode-wlww-1208.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiot-thingscloud%2Fluatos-thingscloud-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiot-thingscloud%2Fluatos-thingscloud-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiot-thingscloud%2Fluatos-thingscloud-sdk/lists"}