├── tuya-spring-boot-starter-sample
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── application.properties
│ │ └── java
│ │ │ └── com
│ │ │ └── tuya
│ │ │ └── open
│ │ │ └── spring
│ │ │ └── boot
│ │ │ └── sample
│ │ │ ├── ability
│ │ │ ├── model
│ │ │ │ ├── IssueParam.java
│ │ │ │ ├── Firmware.java
│ │ │ │ ├── DeviceSpecification.java
│ │ │ │ ├── Device.java
│ │ │ │ ├── DeviceProperties.java
│ │ │ │ └── DeviceDetail.java
│ │ │ ├── api
│ │ │ │ ├── DeviceConnector.java
│ │ │ │ └── ThingConnector.java
│ │ │ └── messaging
│ │ │ │ ├── msg
│ │ │ │ ├── DeviceOnlineMessage.java
│ │ │ │ ├── DeviceOfflineMessage.java
│ │ │ │ ├── DeviceNameUpdate.java
│ │ │ │ └── DevicePropertyMessage.java
│ │ │ │ └── TuyaMessageListener.java
│ │ │ ├── TuyaSpringBootStarterSampleApplication.java
│ │ │ ├── service
│ │ │ ├── DeviceService.java
│ │ │ └── SIService.java
│ │ │ ├── web
│ │ │ ├── DeviceController.java
│ │ │ └── SIController.java
│ │ │ └── config
│ │ │ └── CustomOkHttpClient.java
│ └── test
│ │ └── java
│ │ └── com
│ │ └── tuya
│ │ └── open
│ │ └── spring
│ │ └── boot
│ │ └── sample
│ │ ├── service
│ │ └── SIServiceTest.java
│ │ └── TuyaSpringBootStarterSampleApplicationTests.java
├── .gitignore
└── pom.xml
├── tuya-spring-boot-starter
├── src
│ └── main
│ │ ├── resources
│ │ ├── META-INF
│ │ │ ├── spring
│ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports
│ │ │ └── spring.factories
│ │ └── _tuya-default.properties
│ │ └── java
│ │ └── com
│ │ └── tuya
│ │ └── connector
│ │ └── open
│ │ └── spring
│ │ └── boot
│ │ └── TuyaAutoConfiguration.java
└── pom.xml
├── tuya-api
├── src
│ ├── test
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── tuya
│ │ │ │ └── connector
│ │ │ │ └── open
│ │ │ │ └── api
│ │ │ │ ├── SecurityInfo.java
│ │ │ │ ├── abilities
│ │ │ │ └── DeviceAbility.java
│ │ │ │ ├── connectors
│ │ │ │ └── device
│ │ │ │ │ ├── IndustryDeviceConnector.java
│ │ │ │ │ ├── DeviceConnector.java
│ │ │ │ │ └── ConnectorTest.java
│ │ │ │ ├── model
│ │ │ │ └── Device.java
│ │ │ │ ├── token
│ │ │ │ └── TuyaTokenTest.java
│ │ │ │ └── errorprocessor
│ │ │ │ └── TokenValidErrorProcessorTest.java
│ │ └── resources
│ │ │ └── logback-test.xml
│ └── main
│ │ └── java
│ │ └── com
│ │ └── tuya
│ │ └── connector
│ │ └── open
│ │ └── api
│ │ ├── token
│ │ ├── TokenConnector.java
│ │ ├── TuyaToken.java
│ │ └── TuyaTokenManager.java
│ │ ├── model
│ │ ├── PageResultWithTotal.java
│ │ └── PageResult.java
│ │ ├── context
│ │ ├── TuyaContext.java
│ │ └── TuyaContextManager.java
│ │ ├── errorprocessor
│ │ └── TokenInvalidErrorProcessor.java
│ │ ├── config
│ │ └── TuyaRegionConfig.java
│ │ └── header
│ │ └── TuyaHeaderProcessor.java
└── pom.xml
├── tuya-messaging
├── src
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── tuya
│ │ │ └── connector
│ │ │ └── open
│ │ │ └── messaging
│ │ │ ├── SecurityInfo.java
│ │ │ └── MessageTest.java
│ └── main
│ │ └── java
│ │ └── com
│ │ └── tuya
│ │ └── connector
│ │ └── open
│ │ └── messaging
│ │ ├── autoconfig
│ │ ├── EnableDynamicMessaging.java
│ │ ├── EnableMessaging.java
│ │ ├── MessageScanRegister.java
│ │ ├── MessageProperties.java
│ │ ├── TuyaMessageDataSource.java
│ │ ├── MessageAutoConfiguration.java
│ │ └── DynamicMessageManager.java
│ │ ├── event
│ │ ├── UnknownMessage.java
│ │ ├── OnlineMessage.java
│ │ ├── OfflineMessage.java
│ │ ├── RoomDeleteMessage.java
│ │ ├── DeleteMessage.java
│ │ ├── NameUpdateMessage.java
│ │ ├── UserDeleteMessage.java
│ │ ├── UserUpdateMessage.java
│ │ ├── UserRegisterMessage.java
│ │ ├── DpNameUpdateMessage.java
│ │ ├── RoomSortMessage.java
│ │ ├── HomeCreateMessage.java
│ │ ├── RoomCreateMessage.java
│ │ ├── RoomNameUodateMessage.java
│ │ ├── BindUserMessage.java
│ │ ├── UpgradeStatusMessage.java
│ │ ├── ShareMessage.java
│ │ ├── HomeUpdateMessage.java
│ │ ├── HomeDeleteMessage.java
│ │ ├── AutomationExternalActionMessage.java
│ │ ├── DeviceDpCommandMessage.java
│ │ ├── DeviceSignalMessage.java
│ │ ├── StatusReportMessage.java
│ │ ├── SceneExecuteMessage.java
│ │ └── BaseTuyaMessage.java
│ │ ├── SourceMessage.java
│ │ ├── MessageFactory.java
│ │ ├── AESBase64Utils.java
│ │ ├── MessageRegister.java
│ │ └── TuyaMessageDispatcher.java
└── pom.xml
├── tuya-common
├── src
│ └── main
│ │ └── java
│ │ └── com
│ │ └── tuya
│ │ └── connector
│ │ └── open
│ │ └── common
│ │ ├── constant
│ │ ├── EnvConstant.java
│ │ └── TuyaRegion.java
│ │ └── util
│ │ └── Sha256Util.java
└── pom.xml
├── .gitignore
├── .github
└── workflows
│ └── maven-deploy.yml
├── README_zh.md
├── README.md
├── pom.xml
└── LICENSE
/tuya-spring-boot-starter-sample/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | connector.ak=
2 | connector.sk=
--------------------------------------------------------------------------------
/tuya-spring-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.tuya.connector.open.spring.boot.TuyaAutoConfiguration
--------------------------------------------------------------------------------
/tuya-spring-boot-starter/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
2 | com.tuya.connector.open.spring.boot.TuyaAutoConfiguration
--------------------------------------------------------------------------------
/tuya-api/src/test/java/com/tuya/connector/open/api/SecurityInfo.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.api;
2 |
3 | /**
4 | * @author 丘枫(余秋风 qiufeng.yu@tuya.com)
5 | * @since 2021/3/26 11:19 上午
6 | */
7 | public class SecurityInfo {
8 | public static final String AK = "*********";
9 | public static final String SK = "*********";
10 | }
11 |
--------------------------------------------------------------------------------
/tuya-messaging/src/test/java/com/tuya/connector/open/messaging/SecurityInfo.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.messaging;
2 |
3 | /**
4 | *
TODO
5 | *
6 | * @author 丘枫(余秋风 qiufeng.yu@tuya.com)
7 | * @since 2021/3/26 11:21 上午
8 | */
9 | public class SecurityInfo {
10 | public static final String AK = "*****";
11 | public static final String SK = "*****";
12 | }
13 |
--------------------------------------------------------------------------------
/tuya-spring-boot-starter/src/main/resources/_tuya-default.properties:
--------------------------------------------------------------------------------
1 | connector.api.auto-refresh-token=true
2 | connector.api.auto-set-header=true
3 | connector.api.context-manager=com.tuya.connector.open.api.context.TuyaContextManager
4 | connector.api.token-manager=com.tuya.connector.open.api.token.TuyaTokenManager
5 | connector.api.header-processor=com.tuya.connector.open.api.header.TuyaHeaderProcessor
--------------------------------------------------------------------------------
/tuya-spring-boot-starter-sample/src/main/java/com/tuya/open/spring/boot/sample/ability/model/IssueParam.java:
--------------------------------------------------------------------------------
1 | package com.tuya.open.spring.boot.sample.ability.model;
2 |
3 | import lombok.Data;
4 |
5 | import java.io.Serial;
6 | import java.io.Serializable;
7 | import java.util.Map;
8 |
9 | @Data
10 | public class IssueParam implements Serializable {
11 | @Serial
12 | private static final long serialVersionUID = -514297250121261947L;
13 |
14 | private Map properties;
15 | }
16 |
--------------------------------------------------------------------------------
/tuya-common/src/main/java/com/tuya/connector/open/common/constant/EnvConstant.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.common.constant;
2 |
3 | /**
4 | * @Classname EnvConstant
5 | * @Description TODO
6 | * @Date 2021/4/2
7 | * @Author 哲也(张梓濠 zheye.zhang@tuya.com)
8 | */
9 | public class EnvConstant {
10 |
11 | public static final String ENV_AK = "connector.ak";
12 |
13 | public static final String ENV_SK = "connector.sk";
14 |
15 | public static final String ENV_REGION = "connector.region";
16 |
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/tuya-api/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | %d{HH:mm:ss.SSS} %-5level [%thread] ${PID:- } %logger{39}.%method %line : %msg%n
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/tuya-common/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | com.tuya
8 | tuya-connector
9 | 1.5.4
10 |
11 |
12 | tuya-common
13 |
--------------------------------------------------------------------------------
/tuya-api/src/test/java/com/tuya/connector/open/api/abilities/DeviceAbility.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.api.abilities;
2 |
3 | import com.tuya.connector.open.api.model.Device;
4 |
5 | import java.util.Map;
6 |
7 | /**
8 | * TODO
9 | *
10 | * @author 丘枫(余秋风 qiufeng.yu@tuya.com)
11 | * @since 2021/2/18 10:52 上午
12 | */
13 | public interface DeviceAbility {
14 |
15 | Device getById(String deviceId);
16 |
17 | Boolean commands(String deviceId, Map commands);
18 |
19 | Object specification(String deviceId);
20 | }
21 |
--------------------------------------------------------------------------------
/tuya-messaging/src/main/java/com/tuya/connector/open/messaging/autoconfig/EnableDynamicMessaging.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.messaging.autoconfig;
2 |
3 | import org.springframework.context.annotation.Import;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | @Retention(RetentionPolicy.RUNTIME)
11 | @Target(ElementType.TYPE)
12 | @Import(DynamicMessageManager.class)
13 | public @interface EnableDynamicMessaging {
14 | }
15 |
--------------------------------------------------------------------------------
/tuya-spring-boot-starter-sample/src/main/java/com/tuya/open/spring/boot/sample/ability/model/Firmware.java:
--------------------------------------------------------------------------------
1 | package com.tuya.open.spring.boot.sample.ability.model;
2 |
3 | import lombok.Data;
4 |
5 | import java.io.Serial;
6 | import java.io.Serializable;
7 |
8 | @Data
9 | public class Firmware implements Serializable {
10 | @Serial
11 | private static final long serialVersionUID = 6845359510017172104L;
12 |
13 | private Integer type;
14 | private String typeDesc;
15 | private String currentVersion;
16 | private Long lastUpgradeTime;
17 | }
18 |
--------------------------------------------------------------------------------
/tuya-spring-boot-starter-sample/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ompiled class file
2 | *.class
3 |
4 | # Log file
5 | *.log
6 |
7 | # BlueJ files
8 | *.ctxt
9 |
10 | # Mobile Tools for Java (J2ME)
11 | .mtj.tmp/
12 |
13 | # Package Files #
14 | *.jar
15 | *.war
16 | *.nar
17 | *.ear
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23 | hs_err_pid*
24 |
25 | .idea/
26 |
27 | *.iml
28 |
29 | target/
30 |
31 | .mvn/
32 | mvn*
33 | *.flattened-pom.xml
34 |
35 | # 忽略 sample 模块的 application.properties
36 | /tuya-spring-boot-starter-sample/src/main/resources/application.properties
--------------------------------------------------------------------------------
/tuya-messaging/src/main/java/com/tuya/connector/open/messaging/autoconfig/EnableMessaging.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.messaging.autoconfig;
2 |
3 | import org.springframework.context.annotation.Import;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | @Retention(RetentionPolicy.RUNTIME)
11 | @Target(ElementType.TYPE)
12 | @Import({MessageScanRegister.class, MessageAutoConfiguration.class})
13 | public @interface EnableMessaging {
14 | String[] msgPaths() default {};
15 | }
16 |
--------------------------------------------------------------------------------
/tuya-api/src/main/java/com/tuya/connector/open/api/token/TokenConnector.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.api.token;
2 |
3 | import com.tuya.connector.api.annotations.GET;
4 | import com.tuya.connector.api.annotations.Path;
5 | import com.tuya.connector.api.annotations.Query;
6 |
7 | /**
8 | *
9 | * @author 丘枫(余秋风 qiufeng.yu@tuya.com)
10 | * @since 2021/2/4 5:53 下午
11 | */
12 | public interface TokenConnector {
13 |
14 | @GET("/v1.0/token")
15 | TuyaToken getToken(@Query("grant_type") int grantType);
16 |
17 | @GET("/v1.0/token/{refresh_token}")
18 | TuyaToken refreshToken(@Path("refresh_token") String refreshToken);
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/tuya-api/src/main/java/com/tuya/connector/open/api/model/PageResultWithTotal.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.api.model;
2 |
3 | import lombok.Data;
4 |
5 | import java.io.Serializable;
6 | import java.util.List;
7 |
8 | /**
9 | * Description the page result with total records
10 | *
11 | * @author Medivh.chen@tuya.com
12 | * @date 2021/4/20
13 | */
14 | @Data
15 | public class PageResultWithTotal implements Serializable {
16 |
17 |
18 | /**
19 | * returned data
20 | */
21 | private List list;
22 |
23 | /**
24 | * whether has next page
25 | */
26 | private Boolean hasMore;
27 |
28 | /**
29 | * the total number of records
30 | */
31 | private int total;
32 | }
33 |
--------------------------------------------------------------------------------
/.github/workflows/maven-deploy.yml:
--------------------------------------------------------------------------------
1 | name: Maven Deploy
2 | on:
3 | push:
4 | branches:
5 | - dev
6 | - release
7 | jobs:
8 | build:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@v2
12 | - name: Set up Java Environment
13 | uses: actions/setup-java@v2
14 | with:
15 | distribution: 'adopt'
16 | java-version: '8'
17 | server-id: maven
18 | server-username: MAVEN_USERNAME
19 | server-password: MAVEN_CENTRAL_TOKEN
20 | - name: Maven Repository Publish
21 | run: mvn -e clean deploy -Dmaven.test.skip=true
22 | env:
23 | MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
24 | MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_PASSWORD }}
--------------------------------------------------------------------------------
/tuya-messaging/src/main/java/com/tuya/connector/open/messaging/event/UnknownMessage.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.messaging.event;
2 |
3 | import com.alibaba.fastjson.JSONObject;
4 | import com.tuya.connector.open.messaging.SourceMessage;
5 |
6 | /**
7 | * Description: TODO
8 | *
9 | * @author Chyern
10 | * @since 2021/9/17
11 | */
12 | public class UnknownMessage extends BaseTuyaMessage {
13 |
14 | private JSONObject messageBody;
15 |
16 | @Override
17 | public void defaultBuild(SourceMessage sourceMessage, JSONObject messageBody) {
18 | super.defaultBuild(sourceMessage, messageBody);
19 | this.messageBody = messageBody;
20 | }
21 |
22 | @Override
23 | public String type() {
24 | return "unknown";
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tuya-api/src/test/java/com/tuya/connector/open/api/connectors/device/IndustryDeviceConnector.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.api.connectors.device;
2 |
3 | import com.tuya.connector.api.annotations.Body;
4 | import com.tuya.connector.api.annotations.GET;
5 | import com.tuya.connector.api.annotations.POST;
6 | import com.tuya.connector.api.annotations.Path;
7 | import com.tuya.connector.open.api.abilities.DeviceAbility;
8 | import com.tuya.connector.open.api.model.Device;
9 |
10 | import java.util.List;
11 | import java.util.Map;
12 |
13 | public interface IndustryDeviceConnector {
14 | /**
15 | * 设备指令下发
16 | */
17 | @POST("/v1.0/iot-03/devices/{deviceId}/commands")
18 | Boolean sendCommands(@Path("deviceId") String deviceId, @Body Object commands);
19 | }
20 |
--------------------------------------------------------------------------------
/tuya-spring-boot-starter-sample/src/main/java/com/tuya/open/spring/boot/sample/TuyaSpringBootStarterSampleApplication.java:
--------------------------------------------------------------------------------
1 | package com.tuya.open.spring.boot.sample;
2 |
3 | import com.tuya.connector.spring.annotations.ConnectorScan;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 |
7 | @ConnectorScan(basePackages = "com.tuya.open.spring.boot.sample.ability.api")
8 | //@EnableMessaging(msgPaths = {"com.tuya.open.spring.boot.sample.ability.messaging.msg"})
9 | @SpringBootApplication
10 | public class TuyaSpringBootStarterSampleApplication {
11 |
12 | public static void main(String[] args) {
13 | SpringApplication.run(TuyaSpringBootStarterSampleApplication.class, args);
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/tuya-spring-boot-starter-sample/src/main/java/com/tuya/open/spring/boot/sample/ability/api/DeviceConnector.java:
--------------------------------------------------------------------------------
1 | package com.tuya.open.spring.boot.sample.ability.api;
2 |
3 | import com.tuya.connector.api.annotations.Body;
4 | import com.tuya.connector.api.annotations.GET;
5 | import com.tuya.connector.api.annotations.POST;
6 | import com.tuya.connector.api.annotations.Path;
7 | import com.tuya.open.spring.boot.sample.ability.model.Device;
8 |
9 | import java.util.Map;
10 |
11 | public interface DeviceConnector {
12 |
13 | @GET("/v1.1/iot-03/devices/{device_id}")
14 | Device getById(@Path("device_id") String deviceId);
15 |
16 | @POST("/v1.0/iot-03/devices/{device_id}/commands")
17 | Boolean command(@Path("device_id") String deviceId, @Body Map commands);
18 | }
19 |
--------------------------------------------------------------------------------
/tuya-messaging/src/main/java/com/tuya/connector/open/messaging/event/OnlineMessage.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.messaging.event;
2 |
3 | import com.alibaba.fastjson.JSONObject;
4 | import com.tuya.connector.open.messaging.SourceMessage;
5 |
6 | /**
7 | * TODO
8 | *
9 | * @author 丘枫(余秋风 qiufeng.yu@tuya.com)
10 | * @since 2021/3/24 3:34 下午
11 | */
12 | public class OnlineMessage extends BaseTuyaMessage {
13 |
14 | public static final String UID = "uid";
15 | public static final String TIME = "time";
16 |
17 | @Override
18 | public void defaultBuild(SourceMessage sourceMessage, JSONObject messageBody) {
19 | super.defaultBuild(sourceMessage, messageBody);
20 | }
21 |
22 | @Override
23 | public String type() {
24 | return "online";
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tuya-messaging/src/main/java/com/tuya/connector/open/messaging/event/OfflineMessage.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.messaging.event;
2 |
3 | import com.alibaba.fastjson.JSONObject;
4 | import com.tuya.connector.open.messaging.SourceMessage;
5 |
6 | /**
7 | *
TODO
8 | *
9 | * @author 丘枫(余秋风 qiufeng.yu@tuya.com)
10 | * @since 2021/3/24 3:34 下午
11 | */
12 | public class OfflineMessage extends BaseTuyaMessage {
13 |
14 | public static final String UID = "uid";
15 | public static final String TIME = "time";
16 |
17 | @Override
18 | public void defaultBuild(SourceMessage sourceMessage, JSONObject messageBody) {
19 | super.defaultBuild(sourceMessage, messageBody);
20 | }
21 |
22 | @Override
23 | public String type() {
24 | return "offline";
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tuya-messaging/src/main/java/com/tuya/connector/open/messaging/event/RoomDeleteMessage.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.messaging.event;
2 |
3 | import com.alibaba.fastjson.JSONObject;
4 | import com.tuya.connector.open.messaging.SourceMessage;
5 |
6 | /**
7 | * @description: 房间删除
8 | * @author: jinyun.zhou@tuya.com
9 | * @create: 2021-03-24 23:01
10 | **/
11 | public class RoomDeleteMessage extends BaseTuyaMessage {
12 |
13 | public static final String HOME_ID = "homeId";
14 | public static final String TIME = "time";
15 |
16 | @Override
17 | public void defaultBuild(SourceMessage sourceMessage, JSONObject messageBody) {
18 | super.defaultBuild(sourceMessage, messageBody);
19 | }
20 |
21 | @Override
22 | public String type() {
23 | return "roomDelete";
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/tuya-api/src/main/java/com/tuya/connector/open/api/model/PageResult.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.api.model;
2 |
3 | import lombok.Data;
4 |
5 | import java.io.Serializable;
6 | import java.util.List;
7 |
8 | /**
9 | * Description TODO
10 | *
11 | * @author Chyern
12 | * @date 2021/3/26
13 | */
14 | @Data
15 | public class PageResult implements Serializable {
16 |
17 | private static final long serialVersionUID = -1379646557144992944L;
18 |
19 | /**
20 | * returned data
21 | */
22 | private List list;
23 |
24 | /**
25 | * the next page is exist or not
26 | */
27 | private Boolean hasNext;
28 |
29 | /**
30 | * the last asset id where in this page
31 | */
32 | private String lastRowKey;
33 |
34 | /**
35 | * the size of page
36 | */
37 | private String pageSize;
38 | }
39 |
--------------------------------------------------------------------------------
/tuya-messaging/src/main/java/com/tuya/connector/open/messaging/event/DeleteMessage.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.messaging.event;
2 |
3 | import com.alibaba.fastjson.JSONObject;
4 | import com.tuya.connector.open.messaging.SourceMessage;
5 |
6 | /**
7 | * @description: 设备解绑(设备删除)
8 | * @author: jinyun.zhou@tuya.com
9 | * @create: 2021-03-24 21:59
10 | **/
11 | public class DeleteMessage extends BaseTuyaMessage {
12 | public static final String DEV_ID = "devId";
13 | public static final String UID = "uid";
14 | public static final String OWNER_ID = "ownerId";
15 |
16 | @Override
17 | public void defaultBuild(SourceMessage sourceMessage, JSONObject messageBody) {
18 | super.defaultBuild(sourceMessage, messageBody);
19 | }
20 |
21 | @Override
22 | public String type() {
23 | return "delete";
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/tuya-messaging/src/main/java/com/tuya/connector/open/messaging/event/NameUpdateMessage.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.messaging.event;
2 |
3 | import com.alibaba.fastjson.JSONObject;
4 | import com.tuya.connector.open.messaging.SourceMessage;
5 |
6 | /**
7 | * @description: 设备改名称
8 | * @author: jinyun.zhou@tuya.com
9 | * @create: 2021-03-24 21:46
10 | **/
11 | public class NameUpdateMessage extends BaseTuyaMessage {
12 |
13 | public static final String DEV_ID = "devId";
14 | public static final String UID = "uid";
15 | public static final String NAME = "name";
16 |
17 | @Override
18 | public void defaultBuild(SourceMessage sourceMessage, JSONObject messageBody) {
19 | super.defaultBuild(sourceMessage, messageBody);
20 | }
21 |
22 | @Override
23 | public String type() {
24 | return "nameUpdate";
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tuya-messaging/src/main/java/com/tuya/connector/open/messaging/event/UserDeleteMessage.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.messaging.event;
2 |
3 | import com.alibaba.fastjson.JSONObject;
4 | import com.tuya.connector.open.messaging.SourceMessage;
5 |
6 | /**
7 | * @description: 用户注销
8 | * @author: jinyun.zhou@tuya.com
9 | * @create: 2021-03-24 22:31
10 | **/
11 | public class UserDeleteMessage extends BaseTuyaMessage {
12 |
13 | public static final String UID = "uid";
14 | public static final String SCHEMA = "schema";
15 | public static final String TIME = "time";
16 |
17 | @Override
18 | public void defaultBuild(SourceMessage sourceMessage, JSONObject messageBody) {
19 | super.defaultBuild(sourceMessage, messageBody);
20 | }
21 |
22 | @Override
23 | public String type() {
24 | return "userDelete";
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tuya-messaging/src/main/java/com/tuya/connector/open/messaging/event/UserUpdateMessage.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.messaging.event;
2 |
3 | import com.alibaba.fastjson.JSONObject;
4 | import com.tuya.connector.open.messaging.SourceMessage;
5 |
6 | /**
7 | * @description: 用户更新
8 | * @author: jinyun.zhou@tuya.com
9 | * @create: 2021-03-24 22:31
10 | **/
11 | public class UserUpdateMessage extends BaseTuyaMessage {
12 |
13 | public static final String UID = "uid";
14 | public static final String SCHEMA = "schema";
15 | public static final String TIME = "time";
16 |
17 | @Override
18 | public void defaultBuild(SourceMessage sourceMessage, JSONObject messageBody) {
19 | super.defaultBuild(sourceMessage, messageBody);
20 | }
21 |
22 | @Override
23 | public String type() {
24 | return "userUpdate";
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tuya-messaging/src/main/java/com/tuya/connector/open/messaging/event/UserRegisterMessage.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.messaging.event;
2 |
3 | import com.alibaba.fastjson.JSONObject;
4 | import com.tuya.connector.open.messaging.SourceMessage;
5 |
6 | /**
7 | * @description: 用户注册
8 | * @author: jinyun.zhou@tuya.com
9 | * @create: 2021-03-24 22:30
10 | **/
11 | public class UserRegisterMessage extends BaseTuyaMessage {
12 |
13 | public static final String UID = "uid";
14 | public static final String SCHEMA = "schema";
15 | public static final String TIME = "time";
16 |
17 | @Override
18 | public void defaultBuild(SourceMessage sourceMessage, JSONObject messageBody) {
19 | super.defaultBuild(sourceMessage, messageBody);
20 | }
21 |
22 | @Override
23 | public String type() {
24 | return "userRegister";
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tuya-messaging/src/main/java/com/tuya/connector/open/messaging/event/DpNameUpdateMessage.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.messaging.event;
2 |
3 | import com.alibaba.fastjson.JSONObject;
4 | import com.tuya.connector.open.messaging.SourceMessage;
5 |
6 | /**
7 | * @description: 修改设备功能点名称
8 | * @author: jinyun.zhou@tuya.com
9 | * @create: 2021-03-24 21:46
10 | **/
11 | public class DpNameUpdateMessage extends BaseTuyaMessage {
12 |
13 | public static final String DEV_ID = "devId";
14 | public static final String DP_ID = "dpId";
15 | public static final String NAME = "name";
16 |
17 | @Override
18 | public void defaultBuild(SourceMessage sourceMessage, JSONObject messageBody) {
19 | super.defaultBuild(sourceMessage, messageBody);
20 | }
21 |
22 | @Override
23 | public String type() {
24 | return "dpNameUpdate";
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tuya-api/src/test/java/com/tuya/connector/open/api/model/Device.java:
--------------------------------------------------------------------------------
1 | package com.tuya.connector.open.api.model;
2 |
3 | import lombok.*;
4 | import lombok.experimental.FieldDefaults;
5 |
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 | @Data
10 | @Builder
11 | @AllArgsConstructor
12 | @NoArgsConstructor
13 | @FieldDefaults(level = AccessLevel.PRIVATE)
14 | public class Device {
15 | Long active_time;
16 | int biz_type;
17 | String category;
18 | Long create_time;
19 | String icon;
20 | String id;
21 | String ip;
22 | String local_key;
23 | String model;
24 | String name;
25 | Boolean online;
26 | String owner_id;
27 | String product_id;
28 | String product_name;
29 | List