Skip to content

Commit 9bf1e4e

Browse files
authored
feat: add support for roller curtains (#126)
1 parent eba5854 commit 9bf1e4e

4 files changed

Lines changed: 26 additions & 3 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.bigboxer23</groupId>
66
<artifactId>switchbotapi-java</artifactId>
7-
<version>1.2.3</version>
7+
<version>1.2.4</version>
88

99
<name>switchbotapi-java</name>
1010
<url>https://github.com/bigboxer23/switchbotapi-java</url>

src/main/java/com/bigboxer23/switch_bot/IDeviceTypes.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ public interface IDeviceTypes {
1313
String WATER_DETECTOR = "Water Detector";
1414

1515
String METER_PRO_CO2 = "MeterPro(CO2)";
16+
17+
String ROLLER_SHADE = "Roller Shade";
1618
}

src/main/java/com/bigboxer23/switch_bot/data/Device.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import com.squareup.moshi.Json;
44
import lombok.Data;
55

6+
import java.util.List;
7+
68
/** */
79
@Data
810
public class Device {
@@ -24,12 +26,20 @@ public class Device {
2426

2527
private boolean group;
2628

29+
private boolean master;
30+
31+
private String groupName;
32+
33+
private List<String> groupingDevicesIds;
34+
35+
private List<String> curtainDevicesIds;
36+
37+
private String openDirection;
38+
2739
private boolean moving;
2840

2941
private int slidePosition;
3042

31-
private boolean master;
32-
3343
private String power;
3444

3545
private float voltage;
@@ -46,6 +56,12 @@ public class Device {
4656
@Json(name = "CO2")
4757
private int co2;
4858

59+
private boolean calibrate;
60+
61+
private String hubDeviceId;
62+
63+
private boolean enableCloudService;
64+
4965
public boolean isDry() {
5066
return waterDetectorStatus == 0;
5167
}

src/test/java/com/bigboxer23/switch_bot/integration/SwitchBotApiIntegrationTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ public void testDeviceStatus() throws IOException {
6767
}
6868
case IDeviceTypes.WATER_DETECTOR -> assertTrue(status.isWet() || status.isDry());
6969
case IDeviceTypes.METER_PRO_CO2 -> assertTrue(status.getCo2() > 0);
70+
case IDeviceTypes.ROLLER_SHADE -> {
71+
assertTrue(status.isCalibrate());
72+
assertNotNull(device.getGroupingDevicesIds());
73+
assertNotNull(device.getGroupName());
74+
}
7075
}
7176
}
7277
}

0 commit comments

Comments
 (0)