forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[netatmo] Bring back auto refresh for Weather Station and HomeCoach (o…
…penhab#16546) * Corrects and completes PR openhab#16492 --------- Signed-off-by: gael@lhopital.org <gael@lhopital.org>
- Loading branch information
Showing
4 changed files
with
54 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...g.netatmo/src/test/java/org/openhab/binding/netatmo/internal/api/data/ModuleTypeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Copyright (c) 2010-2024 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.netatmo.internal.api.data; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.openhab.binding.netatmo.internal.NetatmoBindingConstants.BINDING_ID; | ||
|
||
import java.net.URI; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* @author Gaël L'hopital - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class ModuleTypeTest { | ||
public URI getConfigDescription(ModuleType mt) { | ||
if (mt == ModuleType.WELCOME || mt == ModuleType.PRESENCE || mt == ModuleType.DOORBELL) { | ||
// This did not exist prior to PR #16492 | ||
return URI.create(BINDING_ID + ":camera"); | ||
} | ||
// This was previous method for calculating configuration URI | ||
return URI.create(BINDING_ID + ":" | ||
+ (mt == ModuleType.ACCOUNT ? "api_bridge" | ||
: mt == ModuleType.HOME ? "home" | ||
: (mt.isLogical() ? "virtual" | ||
: ModuleType.UNKNOWN == mt.getBridge() ? "configurable" : "device"))); | ||
} | ||
|
||
@Test | ||
public void checkConfigDescription() { | ||
ModuleType.AS_SET.stream().forEach(mt -> { | ||
if (mt != ModuleType.WELCOME) { | ||
URI confDesc = mt.configDescription; | ||
assertEquals(getConfigDescription(mt), confDesc); | ||
} | ||
}); | ||
} | ||
} |