-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7f1326b
Showing
365 changed files
with
19,160 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Tuya | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Tuya_Wechat_Devtools | ||
This project is developed using Tuya SDK, which enables you to quickly develop branded apps connecting and controlling smart scenarios of many devices.For more information, please check Tuya Developer Website. | ||
|
||
![智能插座open.png](https://github.com/1115332213/tuya_project/raw/main/image/open.png) | ||
![智能插座close.png](https://github.com/1115332213/tuya_project/raw/main/image/close.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
|
||
## 注意:当前仓库继承自即将被废弃的涂鸦Github仓库:xxxxxx,请使用当前 Github 仓库进行涂鸦 SDK相关开发。更换远程Github仓库URL的教程,可以参考:https://github.com/TuyaInc/tuya-weapp-demo | ||
|
||
## 概述 | ||
|
||
这个一个简易版快速接入[涂鸦的小程序 SDK](https://developer.tuya.com/cn/docs/iot/app-development/mini-programs/overview/applet-ecology?id=K9ptacgp94o5d),[配网插件](https://developer.tuya.com/cn/docs/iot/app-development/mini-programs/tuya-applet-with-web-plugin/distribution-network-plugin?id=K9lq218xn0wn8) 和 MQTT 的连接的Demo,目前趋于稳定。后续还会有新功能的更新。 | ||
|
||
## 体验 | ||
|
||
如果需要在自己的小程序中嵌入小程序配网的功能,可以通过接入小程序 SDK,获取自己的票据信息,然后调用小程序插件,完成配网,配网成功后重新调用获取设备信息的接口即可。 | ||
|
||
如果需要在自己的小程序中开发设备控制,场景联动、自动化等功能,可以通过小程序 SDK 调用相应的接口即可。 | ||
|
||
如果需要涂鸦公版小程序来支持您的设备,可以联系我们。公版小程序的您可以扫码下面的二维码体验: | ||
|
||
<p align="center"> | ||
<img width=200 src="https://images.tuyacn.com/rms-static/9cbc9210-cb1f-11ea-9723-5fcc4b1eeb4e-1595314722225.jpg?tyName=gh_42ad2888c42d_258.jpg" > | ||
</p> | ||
|
||
如果在设备列表中显示没有设备,可以点击 “添加设备”,选择“扫码配网”,扫描下面的二维码,即可体验设备。 | ||
<p align="center" > | ||
<img width=200 src="https://airtake-public-data-1254153901.cos.ap-shanghai.myqcloud.com/goat/20200703/9123115b69c049899d14a84b239c13ed.png" > | ||
<p align="center">香薰机</p> | ||
</p> | ||
|
||
<p align="center" > | ||
<img width=200 src="https://images.tuyacn.com/rms-static/8f9a30a0-c805-11ea-a0c6-dbbe4bc4c496-1594973679786.png?tyName=kj.png" > | ||
<p align="center">空气净化器</p> | ||
</p> | ||
|
||
<p align="center" > | ||
<img width=200 src="https://images.tuyacn.com/rms-static/8f9e9d70-c805-11ea-a9da-3362f25bc183-1594973679815.png?tyName=kt.png" > | ||
<p align="center">空调</p> | ||
</p> | ||
|
||
<p align="center" > | ||
<img width=200 src="https://images.tuyacn.com/rms-static/8f9a0990-c805-11ea-a0c6-dbbe4bc4c496-1594973679785.png?tyName=cl.png" > | ||
<p align="center">窗帘电机</p> | ||
</p> | ||
|
||
<p align="center" > | ||
<img width=200 src="https://images.tuyacn.com/rms-static/c1cc0660-c81a-11ea-a0c6-dbbe4bc4c496-1594982783430.png?tyName=dj.png" > | ||
<p align="center">智能灯</p> | ||
</p> | ||
|
||
## Demo 目录 | ||
|
||
``` | ||
├── cloudfunctions // 云函数目录 | ||
│ ├── ty-service // SDK | ||
├── miniprogram // 小程序主目录 | ||
│ ├── image // 图片库 | ||
│ ├── libs // 第三方库 | ||
│ ├── pages // 具体页面的目录 | ||
│ ├── app.js // 小程序入口 | ||
│ ├── app.json // 配置文件 | ||
├── project.config.json // 项目配置文件 | ||
└── README.md // 说明文件 | ||
``` | ||
|
||
## Demo 说明 | ||
|
||
- 设备配网: | ||
|
||
直接点击按钮进行配网:目前支持 AP 配网、扫码配网、蓝牙配网、zigbee 配网 | ||
|
||
- 体验设备功能: | ||
|
||
添加设备完成后,可以点击设备开启开关进行设备 MQTT 消息推送调试,建议先使用 api.js 文件中的 getDeviceSpecifications 函数获取指令集,防止出现 dp 点字段名称可能不一致的情况。正常下发指令后页面上会显示出推送消息的内容 | ||
|
||
- 完整版Demo | ||
目前支持设备控制,消息推送,添加设备(配网), 家庭模块 | ||
|
||
## 技术支持 | ||
|
||
<p align="center" > | ||
<img src="https://airtake-public-data-1254153901.cos.ap-shanghai.myqcloud.com/goat/20200811/52a6139793854a2ea7d3ce15dd59d40c.png" alt="drawing" width="200"/> | ||
</p> | ||
|
||
文档看了这么多,还是有很多疑问?需要有技术支持?对我们的小程序有建议?有吐槽?有需求?可以添加上面的微信为好友,随时答疑解惑(验证消息中写明:技术交流,不然没法通过)。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//app.js | ||
import wxMqtt from './utils/mqtt/wxMqtt' | ||
import { Provider } from './libs/wechat-weapp-redux.min'; | ||
import { configStore } from './utils/store/store'; | ||
|
||
const store = configStore(); | ||
|
||
App(Provider(store)({ | ||
onLaunch: async function() { | ||
// wx.cloud.init() | ||
// wxMqtt.connectMqtt() | ||
|
||
wxMqtt.on('close', (errorMsg) => { | ||
wxMqtt.connectMqtt() | ||
console.log('errorMsg: mqttClose', errorMsg); | ||
}) | ||
|
||
wxMqtt.on('error', (errorMsg) => { | ||
wxMqtt.connectMqtt() | ||
console.log('errorMsg: mqttError', errorMsg); | ||
}) | ||
} | ||
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"pages": [ | ||
"pages/guide/index", | ||
"pages/home_center/device_list/index", | ||
"pages/home_center/common_panel/index", | ||
"pages/home_center/device_manage/index", | ||
"pages/cloud_check/index", | ||
"pages/function_center/device_connect/index", | ||
"pages/web_view/index", | ||
"pages/base_function/index" | ||
], | ||
"window": { | ||
"backgroundTextStyle": "light", | ||
"navigationBarBackgroundColor": "#fff", | ||
"navigationBarTitleText": "WeChat", | ||
"navigationBarTextStyle": "black" | ||
}, | ||
"plugins": { | ||
"tuya-ap-plugin": { | ||
"version": "3.3.9", | ||
"provider": "wxd2aa51ffacc3ff86" | ||
} | ||
}, | ||
"sitemapLocation": "sitemap.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/**app.wxss**/ | ||
page { | ||
background-color: #f6f6f6; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: flex-start; | ||
overflow: scroll; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// components/t_navbar/index.js | ||
Component({ | ||
/** | ||
* 组件的属性列表 | ||
*/ | ||
properties: { | ||
device_name: String, | ||
device_id: String | ||
}, | ||
|
||
/** | ||
* 组件的初始数据 | ||
*/ | ||
data: { | ||
device_name: '未获取到名称', | ||
marginTop: '20px', | ||
height: 'auto', | ||
}, | ||
|
||
lifetimes: { | ||
attached: function () { | ||
const { statusBarHeight, system } = wx.getSystemInfoSync(); | ||
const height = system.indexOf('iOS') > -1 ? '44px' : '48px' | ||
this.setData({ height, marginTop: `${statusBarHeight}px` }) | ||
} | ||
}, | ||
|
||
/** | ||
* 组件的方法列表 | ||
*/ | ||
methods: { | ||
backPage: function () { | ||
wx.navigateBack({ | ||
delta: 1, | ||
}) | ||
}, | ||
jumpEditPage: function() { | ||
this.triggerEvent('jumpTodeviceEditPage',{}) | ||
} | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"component": true, | ||
"usingComponents": { | ||
"van-icon": "@vant/weapp/icon/index" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!--components/t_navbar/index.wxml--> | ||
<view style="height: {{height}}; margin-top: {{marginTop}}" class="custom-header"> | ||
<van-icon class="custom-header-back" name="arrow-left" size="20px" color="#fff" bind:click="backPage" /> | ||
<view class="custom-header-block" bindtap="jumpEditPage"> | ||
<view class="custom-header-name">{{device_name}}</view> | ||
<van-icon name='edit' size="20px" color="#fff" /> | ||
</view> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* components/t_navbar/index.wxss */ | ||
.custom-header { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 100%; | ||
} | ||
|
||
.custom-header-block { | ||
display: flex; | ||
} | ||
|
||
.custom-header-back { | ||
position: absolute; | ||
left: 16px; | ||
} | ||
|
||
.custom-header-name { | ||
z-index: 1; | ||
width: 80px; | ||
height: 25px; | ||
font-family: PingFangSC-Medium; | ||
font-size: 17px; | ||
text-align: center; | ||
line-height: 24px; | ||
color: #fff; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.