mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[netatmo] Bring back auto refresh for Weather Station and HomeCoach (#16546)
* Corrects and completes PR #16492 --------- Signed-off-by: gael@lhopital.org <gael@lhopital.org>
This commit is contained in:
parent
4f65c44872
commit
d68adfab21
@ -83,12 +83,12 @@ Once authentication process has been done, current refreshToken is stored in `/O
|
||||
| presence | Thing | NOC | The Netatmo Smart Outdoor Camera (Presence) camera with or without siren. | id, ipAddress |
|
||||
| siren | Thing | NIS | The Netatmo Smart Indoor Siren. | id |
|
||||
| doorbell | Thing | NDB | The Netatmo Smart Video Doorbell device. | id, ipAddress |
|
||||
| weather-station | Bridge | NAMain | Main indoor module reporting temperature, humidity, pressure, air quality and sound level. | id, refreshInterval |
|
||||
| weather-station | Bridge | NAMain | Main indoor module reporting temperature, humidity, pressure, air quality and sound level. | id |
|
||||
| outdoor | Thing | NAModule1 | Outdoor module reporting temperature and humidity. | id |
|
||||
| wind | Thing | NAModule2 | Wind sensor reporting wind angle and strength. | id |
|
||||
| rain | Thing | NAModule3 | Rain Gauge measuring precipitation. | id |
|
||||
| indoor | Thing | NAModule4 | Additional indoor module reporting temperature, humidity and CO2 level. | id |
|
||||
| home-coach | Thing | NHC | Healthy home coach reporting health-index, temperature, humidity, pressure, air quality, sound level. | id, refreshInterval |
|
||||
| home-coach | Thing | NHC | Healthy home coach reporting health-index, temperature, humidity, pressure, air quality, sound level. | id |
|
||||
| plug | Thing | NAPlug | The relay connected to the boiler controlling a Thermostat and zero or more valves. | id |
|
||||
| thermostat | Thing | NATherm1 | The Thermostat device placed in a given room. | id |
|
||||
| room | Thing | NARoom | A room in your house. | id |
|
||||
|
@ -102,7 +102,7 @@ public enum ModuleType {
|
||||
GROUP_DOORBELL_LIVE),
|
||||
new ChannelGroup(EventCameraChannelHelper.class, GROUP_DOORBELL_LAST_EVENT, GROUP_DOORBELL_SUB_EVENT)),
|
||||
|
||||
WEATHER_STATION(FeatureArea.WEATHER, "NAMain", 1, "configurable", ACCOUNT,
|
||||
WEATHER_STATION(FeatureArea.WEATHER, "NAMain", 1, "device", ACCOUNT,
|
||||
Set.of(DeviceCapability.class, WeatherCapability.class, MeasureCapability.class,
|
||||
ChannelHelperCapability.class),
|
||||
ChannelGroup.SIGNAL, ChannelGroup.HUMIDITY, ChannelGroup.TSTAMP_EXT, ChannelGroup.MEASURE,
|
||||
@ -127,7 +127,7 @@ public enum ModuleType {
|
||||
ChannelGroup.TSTAMP_EXT, ChannelGroup.MEASURE, ChannelGroup.BATTERY, ChannelGroup.HUMIDITY,
|
||||
ChannelGroup.TEMP_INSIDE_EXT, ChannelGroup.AIR_QUALITY),
|
||||
|
||||
HOME_COACH(FeatureArea.AIR_CARE, "NHC", 1, "configurable", ACCOUNT,
|
||||
HOME_COACH(FeatureArea.AIR_CARE, "NHC", 1, "device", ACCOUNT,
|
||||
Set.of(DeviceCapability.class, AirCareCapability.class, MeasureCapability.class,
|
||||
ChannelHelperCapability.class),
|
||||
ChannelGroup.LOCATION, ChannelGroup.SIGNAL, ChannelGroup.NOISE, ChannelGroup.HUMIDITY,
|
||||
|
@ -147,17 +147,4 @@
|
||||
</parameter>
|
||||
</config-description>
|
||||
|
||||
<config-description uri="netatmo:configurable">
|
||||
<parameter name="id" type="text" pattern="([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})" required="true">
|
||||
<label>@text/config.equipmentId.label</label>
|
||||
<description>@text/config.equipmentId.description</description>
|
||||
</parameter>
|
||||
|
||||
<parameter name="refreshInterval" type="integer" min="20" unit="s">
|
||||
<label>@text/config.refreshInterval.label</label>
|
||||
<description>@text/config.refreshInterval.description</description>
|
||||
<default>180</default>
|
||||
</parameter>
|
||||
</config-description>
|
||||
|
||||
</config-description:config-descriptions>
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user