use of org.openhab.binding.hyperion.internal.protocol.ng.NgResponse in project openhab-addons by openhab.
the class HyperionNgHandler method sendCommand.
public NgResponse sendCommand(HyperionCommand command) throws IOException, CommandUnsuccessfulException {
String commandJson = gson.toJson(command);
String jsonResponse = connection.send(commandJson);
NgResponse response = gson.fromJson(jsonResponse, NgResponse.class);
if (!response.isSuccess()) {
throw new CommandUnsuccessfulException(gson.toJson(command) + " - Reason: " + response.getError());
}
return response;
}
Aggregations