Skip to content

Commit ce1b8de

Browse files
authored
Merge pull request #18 from SmokingDevices/master
Update to Firmware 7.25
2 parents 6bdd3cb + 2020151 commit ce1b8de

10 files changed

Lines changed: 642 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [1.4.0] - unreleased
88

99
### Added
10-
10+
* [#18] Added new fields to be compatible with Fritz!OS 7.25
11+
* Device (Fritz!Dect440) serves now relative humidity
12+
* ColorControl (Fritz!Dect500) got some more fields
13+
* Added some getter for fields that did miss them
1114
* [#19](https://github.com/kaklakariada/fritzbox-java-api/pull/19) Support for device groups
1215

1316
## [1.3.1] - 2021-02-26

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repositories {
1313
}
1414

1515
group 'com.github.kaklakariada'
16-
version = '1.3.1'
16+
version = '1.4.0'
1717

1818
java {
1919
toolchain {

src/main/java/com/github/kaklakariada/fritzbox/model/SessionInfo.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public class SessionInfo {
3838
@ElementList(name = "Rights", inline = false, required = false)
3939
private List<UserRight> rights;
4040

41+
@ElementList(name = "Users", inline = false, required = false)
42+
private List<User> users;
43+
4144
public String getSid() {
4245
return sid;
4346
}
@@ -54,6 +57,10 @@ public List<UserRight> getRights() {
5457
return rights;
5558
}
5659

60+
public List<User> getUsers() {
61+
return users;
62+
}
63+
5764
@Override
5865
public String toString() {
5966
return "SessionInfo [sid=" + sid + ", challenge=" + challenge + ", blockTime=" + blockTime + ", rights="
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* A Java API for managing FritzBox HomeAutomation
3+
* Copyright (C) 2017 Christoph Pirkl <christoph at users.sourceforge.net>
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
package com.github.kaklakariada.fritzbox.model;
19+
20+
import org.simpleframework.xml.Attribute;
21+
import org.simpleframework.xml.Text;
22+
23+
public class User {
24+
25+
@Attribute(name = "last", required = false)
26+
private int last;
27+
28+
@Text
29+
private String name;
30+
31+
public boolean isLast() {
32+
return (last == 1);
33+
}
34+
35+
public String getName() {
36+
return name;
37+
}
38+
}

src/main/java/com/github/kaklakariada/fritzbox/model/homeautomation/ColorControl.java

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,19 @@ public class ColorControl {
3636
private String supportedModes;
3737

3838
@Attribute(name = "current_mode", required = false)
39-
private String current_mode;
39+
private String currentMode;
40+
41+
@Attribute(name = "fullcolorsupport", required = false)
42+
private String fullColorSupport;
43+
44+
@Attribute(name = "mapped", required = false)
45+
private String mapped;
46+
47+
@Element(name = "unmapped_hue", required = false)
48+
private String unmappedHue;
49+
50+
@Element(name = "unmapped_saturation", required = false)
51+
private String unmappedSaturation;
4052

4153
public String getHue() {
4254
return hue;
@@ -54,7 +66,23 @@ public String getSupportedModes() {
5466
return supportedModes;
5567
}
5668

57-
public String getCurrent_mode() {
58-
return current_mode;
69+
public String getCurrentMode() {
70+
return currentMode;
71+
}
72+
73+
public String getFullColorSupport() {
74+
return fullColorSupport;
75+
}
76+
77+
public String getMapped() {
78+
return mapped;
79+
}
80+
81+
public String getUnmappedHue() {
82+
return unmappedHue;
83+
}
84+
85+
public String getUnmappedSaturation() {
86+
return unmappedSaturation;
5987
}
6088
}

src/main/java/com/github/kaklakariada/fritzbox/model/homeautomation/Device.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ public class Device {
6868
private EtsiUnitInfo etsiUnitInfo;
6969
@ElementList(name = "buttons", required = false, inline = true)
7070
private List<Button> buttons;
71+
@Element(name = "humidity", required = false)
72+
private Humidity humidity;
7173

7274
public String getIdentifier() {
7375
return identifier;
@@ -149,6 +151,22 @@ public List<Button> getButtons() {
149151
return buttons;
150152
}
151153

154+
public String getPresent() {
155+
return present;
156+
}
157+
158+
public String getTxbusy() {
159+
return txbusy;
160+
}
161+
162+
public Integer getBatterylow() {
163+
return batterylow;
164+
}
165+
166+
public Humidity getHumidity() {
167+
return humidity;
168+
}
169+
152170
@Override
153171
public String toString() {
154172
return "Device [identifier=" + identifier + ", id=" + id + ", functionBitmask=" + functionBitmask
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* A Java API for managing FritzBox HomeAutomation
3+
* Copyright (C) 2017 Christoph Pirkl <christoph at users.sourceforge.net>
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
package com.github.kaklakariada.fritzbox.model.homeautomation;
19+
20+
import org.simpleframework.xml.Element;
21+
import org.simpleframework.xml.Root;
22+
23+
@Root(name = "humidity")
24+
public class Humidity {
25+
26+
@Element(name = "rel_humidity", required = false)
27+
private int relHumidity;
28+
29+
public int getRelHumidity() {
30+
return relHumidity;
31+
}
32+
}

src/test/java/com/github/kaklakariada/fritzbox/mapping/DeserializerTest.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424
import java.nio.file.Files;
2525
import java.nio.file.Paths;
2626

27+
import junit.framework.TestCase;
2728
import org.junit.BeforeClass;
2829
import org.junit.Test;
2930

31+
import com.github.kaklakariada.fritzbox.model.SessionInfo;
3032
import com.github.kaklakariada.fritzbox.model.homeautomation.DeviceList;
3133
import com.github.kaklakariada.fritzbox.model.homeautomation.Group;
3234
import com.github.kaklakariada.fritzbox.model.homeautomation.GroupInfo;
@@ -94,6 +96,26 @@ public void parseDeviceListAllTogether() throws IOException {
9496
}
9597

9698
@Test
99+
public void parseDeviceList() throws IOException {
100+
final String fileContent = Files.readAllLines(Paths.get("src/test/resources/deviceList.xml")).stream()
101+
.collect(joining("\n"));
102+
new Deserializer().parse(fileContent, DeviceList.class);
103+
}
104+
105+
@Test
106+
public void parseSessionInfo() throws IOException {
107+
final String fileContent = Files.readAllLines(Paths.get("src/test/resources/sessionInfo.xml")).stream()
108+
.collect(joining("\n"));
109+
SessionInfo sessionInfo = new Deserializer().parse(fileContent, SessionInfo.class);
110+
TestCase.assertNotNull(sessionInfo.getUsers());
111+
TestCase.assertEquals(3, sessionInfo.getUsers().size());
112+
TestCase.assertEquals("UserA", sessionInfo.getUsers().get(0).getName());
113+
TestCase.assertFalse(sessionInfo.getUsers().get(0).isLast());
114+
TestCase.assertEquals("UserB", sessionInfo.getUsers().get(1).getName());
115+
TestCase.assertFalse(sessionInfo.getUsers().get(1).isLast());
116+
TestCase.assertEquals("UserC", sessionInfo.getUsers().get(2).getName());
117+
TestCase.assertTrue(sessionInfo.getUsers().get(2).isLast());
118+
}
97119
public void parseDeviceGroup() {
98120
//given
99121
Group group = deviceList6840.getGroupById("900");

0 commit comments

Comments
 (0)