Skip to content

Commit

Permalink
Resolving conflicts and some code cleansing.
Browse files Browse the repository at this point in the history
Signed-off-by: Gaël L'hopital <[email protected]>
  • Loading branch information
clinique committed May 25, 2021
1 parent eb12695 commit 3296833
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 1,380 deletions.
103 changes: 2 additions & 101 deletions bundles/org.openhab.binding.netatmo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,113 +13,14 @@
<artifactId>org.openhab.binding.netatmo</artifactId>

<name>openHAB Add-ons :: Bundles :: Netatmo Binding</name>

<<<<<<< Upstream, based on origin/main
<properties>
<bnd.exportpackage>org.openhab.binding.netatmo.*</bnd.exportpackage>
</properties>
<<<<<<< Upstream, based on origin/main


<dependencies>
<dependency>
<groupId>org.openhab.osgiify</groupId>
<artifactId>org.json.json</artifactId>
<version>20131018</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>okhttp</artifactId>
<version>2.7.5</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>com.google.android</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>logging-interceptor</artifactId>
<version>2.7.5</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>com.google.android</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
<version>1.6.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.gsonfire</groupId>
<artifactId>gson-fire</artifactId>
<version>1.8.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.client</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.common</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.8</version>
<scope>compile</scope>
</dependency>
<dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.21</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>https://raw.githubusercontent.com/cbornet/netatmo-swagger-decl/35e27745fb0d432bc6c8b5ec7a83ed2a09944cea/spec/swagger.yaml</inputSpec>
<language>java</language>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<configOptions>
<sourceFolder>src/main/java</sourceFolder>
<java8>true</java8>
<dateLibrary>java8-localdatetime</dateLibrary>
<useRuntimeException>true</useRuntimeException>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

=======
>>>>>>> 54453ef Rebase and spotless apply
=======
>>>>>>> 4201a80 Code cleansing
</project>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,6 @@ public enum MeasureClass {
public static final String NETATMO_BASE_URL = "https://api.netatmo.com/";
public static final String NETATMO_APP_URL = "https://app.netatmo.net/";

// Units of measurement of the data delivered by the API
// public static final Unit<Temperature> TEMPERATURE_UNIT = SIUnits.CELSIUS;
// public static final Unit<Dimensionless> HUMIDITY_UNIT = Units.PERCENT;
// public static final Unit<Pressure> PRESSURE_UNIT = HECTO(SIUnits.PASCAL);
// public static final Unit<Speed> WIND_SPEED_UNIT = SIUnits.KILOMETRE_PER_HOUR;
// public static final Unit<Angle> WIND_DIRECTION_UNIT = Units.DEGREE_ANGLE;
// public static final Unit<Length> RAIN_UNIT = MILLI(SIUnits.METRE);
// public static final Unit<Dimensionless> CO2_UNIT = Units.PARTS_PER_MILLION;
// public static final Unit<Dimensionless> NOISE_UNIT = Units.DECIBEL;

public enum MeasureType {
SUM_RAIN,
@SerializedName("Temperature")
Expand Down Expand Up @@ -144,9 +134,6 @@ public String getDescriptor() {
}

// Default unit associated with each kind of measurement
// public static final Map<MeasureType, Unit<?>> MEASUREUNITS = Map.of(MeasureType.SUM_RAIN, RAIN_UNIT,
// MeasureType.TEMP, TEMPERATURE_UNIT, MeasureType.HUM, HUMIDITY_UNIT, MeasureType.CO2, CO2_UNIT,
// MeasureType.NOISE, NOISE_UNIT, MeasureType.PRESSURE, PRESSURE_UNIT, MeasureType.WIND, WIND_SPEED_UNIT);
public static final Map<MeasureType, MeasureClass> MEASUREUNITS = Map.of(MeasureType.SUM_RAIN,
MeasureClass.RAIN_QTTY, MeasureType.TEMP, MeasureClass.EXTERIOR_TEMPERATURE, MeasureType.HUM,
MeasureClass.HUMIDITY, MeasureType.CO2, MeasureClass.CO2, MeasureType.NOISE, MeasureClass.NOISE,
Expand Down Expand Up @@ -199,7 +186,7 @@ public static enum Scope {

// Radio signal quality thresholds
private static final int[] EMPTY_INT_ARRAY = new int[0];
public static final int[] WIFI_SIGNAL_LEVELS = new int[] { 86, 71, 56 }; // Resp : bad, average, good
public static final int[] WIFI_SIGNAL_LEVELS = new int[] { 99, 84, 69, 54 }; // Resp : bad, average, good, full
public static final int[] RADIO_SIGNAL_LEVELS = new int[] { 90, 80, 70, 60 }; // Resp : low, medium, high, full
public static final int[] NO_RADIO = EMPTY_INT_ARRAY;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ public double getMeasurements(String deviceId, @Nullable String moduleId, Measur
MeasureLimit limit) throws NetatmoException {
List<NAMeasureBodyElem> result = getmeasure(deviceId, moduleId, scale,
new String[] { (limit.toString() + "_" + type.toString()).toLowerCase() }, 0, 0, 0, false, false);
return result.size() > 0 ? result.get(0).getSingleValue() : Double.NaN;
return !result.isEmpty() ? result.get(0).getSingleValue() : Double.NaN;
}

public double getMeasurements(String deviceId, @Nullable String moduleId, MeasureScale scale, MeasureType type)
throws NetatmoException {
List<NAMeasureBodyElem> result = getmeasure(deviceId, moduleId, scale,
new String[] { type.toString().toLowerCase() }, 0, 0, 0, false, false);
return result.size() > 0 ? result.get(0).getSingleValue() : Double.NaN;
return !result.isEmpty() ? result.get(0).getSingleValue() : Double.NaN;
}

public List<NAMeasureBodyElem> getmeasure(String deviceId, @Nullable String moduleId, MeasureScale scale,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public List<List<Double>> getValue() {
}

public Double getSingleValue() {
if (value.size() > 0) {
if (!value.isEmpty()) {
List<Double> first = value.get(0);
if (first.size() > 0) {
if (!first.isEmpty()) {
return first.get(0);
}
}
Expand Down
Loading

0 comments on commit 3296833

Please sign in to comment.