Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new command "getdeviceinfo" #39

Merged
merged 4 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* This class implements allows logging in to a fritzbox and execute authenticated requests.
*/
class FritzBoxSession {
public class FritzBoxSession {
private static final Logger LOG = LoggerFactory.getLogger(FritzBoxSession.class);

private static final String LOGIN_PATH = "/login_sid.lua";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import com.github.kaklakariada.fritzbox.http.QueryParameters;
import com.github.kaklakariada.fritzbox.http.QueryParameters.Builder;
import com.github.kaklakariada.fritzbox.model.homeautomation.Device;
import com.github.kaklakariada.fritzbox.model.homeautomation.DeviceList;
import com.github.kaklakariada.fritzbox.model.homeautomation.DeviceStats;

Expand All @@ -51,6 +52,10 @@ public DeviceList getDeviceListInfos() {
deviceList.getApiVersion());
return deviceList;
}

public Device getDeviceInfos(String deviceAin) {
return executeDeviceCommand(deviceAin, "getdeviceinfos", null, Device.class);
}

private <T> T executeCommand(String command, Class<T> resultType) {
final QueryParameters parameters = QueryParameters.builder().add("switchcmd", command).build();
Expand Down