Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[netatmo] Bring back auto refresh for Weather Station and HomeCoach #16546

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bundles/org.openhab.binding.netatmo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ ChannelGroup.BATTERY, ChannelGroup.TIMESTAMP, new ChannelGroup(SirenChannelHelpe
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,
Expand All @@ -127,7 +127,7 @@ ChannelGroup.BATTERY, ChannelGroup.TIMESTAMP, new ChannelGroup(SirenChannelHelpe
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
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) {
lolodomo marked this conversation as resolved.
Show resolved Hide resolved
URI confDesc = mt.configDescription;
assertEquals(getConfigDescription(mt), confDesc);
}
});
}
}