Skip to content

Commit f89f0b3

Browse files
octa22jlaur
authored andcommitted
[jablotron] Migrate to v2.2 API (openhab#16743)
Signed-off-by: Ondrej Pecta <[email protected]>
1 parent 7db6405 commit f89f0b3

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

bundles/org.openhab.binding.jablotron/src/main/java/org/openhab/binding/jablotron/JablotronBindingConstants.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ public class JablotronBindingConstants {
5454
public static final String CHANNEL_STATUS_PGY = "statusPGY";
5555

5656
// Constants
57-
public static final String JABLOTRON_API_URL = "https://api.jablonet.net/api/1.6/";
58-
public static final String AGENT = "Swagger-Codegen/1.0.0/android";
57+
public static final String JABLOTRON_API_URL = "https://api.jablonet.net/api/2.2/";
58+
public static final String AGENT = "net.jablonet/8.3.5.3331 (iPhone 14 Pro Max; iOS 17.4; )";
5959
public static final int TIMEOUT_SEC = 10;
6060
public static final String SYSTEM = "openHAB";
6161
public static final String VENDOR = "JABLOTRON:Jablotron";
62+
public static final String CLIENT_VERSION = "MYJ-PUB-IOS-8.3.5.3331";
63+
public static final String CLIENT_DEVICE = "Apple|iPhone 14 Pro Max|17.4";
6264
public static final String APPLICATION_JSON = "application/json";
6365
public static final String WWW_FORM_URLENCODED = "application/x-www-form-urlencoded; charset=UTF-8";
6466
public static final String AUTHENTICATION_CHALLENGE = "Authentication challenge without WWW-Authenticate header";

bundles/org.openhab.binding.jablotron/src/main/java/org/openhab/binding/jablotron/internal/handler/JablotronBridgeHandler.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ private String getCommonUrlParameters(String serviceId) {
399399
private Request createRequest(String url) {
400400
return httpClient.newRequest(url).method(HttpMethod.POST).header(HttpHeader.ACCEPT, APPLICATION_JSON)
401401
.header(HttpHeader.ACCEPT_LANGUAGE, bridgeConfig.getLang()).header(HttpHeader.ACCEPT_ENCODING, "*")
402-
.header("x-vendor-id", VENDOR).agent(AGENT).timeout(TIMEOUT_SEC, TimeUnit.SECONDS);
402+
.header("x-vendor-id", VENDOR).header("x-client-version", CLIENT_VERSION)
403+
.header("x-client-device", CLIENT_DEVICE).agent(AGENT).timeout(TIMEOUT_SEC, TimeUnit.SECONDS);
403404
}
404405

405406
private void relogin() {

0 commit comments

Comments
 (0)