From 3ecb06c0ec28f582462769c832a6d0cc94356402 Mon Sep 17 00:00:00 2001 From: Matt Jones Date: Thu, 7 Nov 2024 09:46:32 -0600 Subject: [PATCH] feat: return status from command calls --- pom.xml | 2 +- .../java/com/bigboxer23/switch_bot/SwitchBotDeviceApi.java | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 3ccd667..6afdfc7 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.bigboxer23 switchbotapi-java - 1.1.7 + 1.1.8 switchbotapi-java https://github.com/bigboxer23/switchbotapi-java diff --git a/src/main/java/com/bigboxer23/switch_bot/SwitchBotDeviceApi.java b/src/main/java/com/bigboxer23/switch_bot/SwitchBotDeviceApi.java index 3290f42..971e506 100644 --- a/src/main/java/com/bigboxer23/switch_bot/SwitchBotDeviceApi.java +++ b/src/main/java/com/bigboxer23/switch_bot/SwitchBotDeviceApi.java @@ -86,15 +86,14 @@ public Device getDeviceStatus(String deviceId) throws IOException { * href="https://github.com/OpenWonderLabs/SwitchBotAPI#send-device-control-commands">send * device control commands */ - public void sendDeviceControlCommands(String deviceId, DeviceCommand command) throws IOException { - + public IApiResponse sendDeviceControlCommands(String deviceId, DeviceCommand command) throws IOException { String stringCommand = provider.getMoshi().adapter(DeviceCommand.class).toJson(command); try (Response response = OkHttpUtil.postSynchronous( SwitchBotApi.baseUrl + "v1.1/devices/" + deviceId + "/commands", RequestBody.create(URLDecoder.decode(stringCommand, StandardCharsets.UTF_8.displayName()) .getBytes(StandardCharsets.UTF_8)), provider.addAuth())) { - parseResponse(response, DeviceApiResponse.class); + return parseResponse(response, DeviceApiResponse.class); } }