mirror of
https://github.com/danieldemus/openhab-addons
synced 2026-07-29 12:34:21 +02:00
[airquality] Switch API access from http to https (#19472)
Resolves #19461 Signed-off-by: clinique <gael@lhopital.org>
This commit is contained in:
+3
-3
@@ -36,7 +36,7 @@ import com.google.gson.JsonSyntaxException;
|
||||
@NonNullByDefault
|
||||
public class ApiBridge {
|
||||
private static final Gson GSON = new Gson();
|
||||
private static final String URL = "http://api.waqi.info/feed/%query%/?token=%apiKey%";
|
||||
private static final String URL = "https://api.waqi.info/feed/%query%/?token=%apiKey%";
|
||||
private static final int REQUEST_TIMEOUT_MS = (int) TimeUnit.SECONDS.toMillis(30);
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(ApiBridge.class);
|
||||
@@ -53,8 +53,8 @@ public class ApiBridge {
|
||||
* @throws AirQualityException
|
||||
*/
|
||||
private String buildRequestURL(String key, int stationId, String location) {
|
||||
String geoStr = stationId != 0 ? String.format("@%d", stationId)
|
||||
: String.format("geo:%s",
|
||||
String geoStr = stationId != 0 ? "@%d".formatted(stationId)
|
||||
: "geo:%s".formatted(
|
||||
location.replace(" ", "").replace(",", ";").replace("\"", "").replace("'", "").trim());
|
||||
|
||||
return URL.replace("%apiKey%", key).replace("%query%", geoStr);
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ public class AirQualityDiscoveryService extends AbstractThingHandlerDiscoverySer
|
||||
if (provider != null) {
|
||||
PointType location = provider.getLocation();
|
||||
AirQualityBridgeHandler bridge = this.thingHandler;
|
||||
if (location == null || bridge == null) {
|
||||
if (location == null) {
|
||||
logger.info("openHAB server location is not defined, will not provide any discovery results");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user