added migrated 2.x add-ons
Signed-off-by: Kai Kreuzer <kai@openhab.org>
32
bundles/org.openhab.binding.meteoalerte/.classpath
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
23
bundles/org.openhab.binding.meteoalerte/.project
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.openhab.binding.meteoalerte</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
13
bundles/org.openhab.binding.meteoalerte/NOTICE
Normal file
@@ -0,0 +1,13 @@
|
||||
This content is produced and maintained by the openHAB project.
|
||||
|
||||
* Project home: https://www.openhab.org
|
||||
|
||||
== Declared Project Licenses
|
||||
|
||||
This program and the accompanying materials are made available under the terms
|
||||
of the Eclipse Public License 2.0 which is available at
|
||||
https://www.eclipse.org/legal/epl-2.0/.
|
||||
|
||||
== Source Code
|
||||
|
||||
https://github.com/openhab/openhab-addons
|
||||
92
bundles/org.openhab.binding.meteoalerte/README.md
Normal file
@@ -0,0 +1,92 @@
|
||||
# Meteo Alerte Binding
|
||||
|
||||
The Meteo Alerte binding gives alert level regarding major weather related risk factors.
|
||||
|
||||
## Supported Things
|
||||
|
||||
There is exactly one supported thing type, which represents the weather alerts for a given department.
|
||||
It has the `department` id.
|
||||
Of course, you can add multiple things, e.g. for getting alerts for different locations.
|
||||
|
||||
## Binding Configuration
|
||||
|
||||
The binding has no configuration options, all configuration is done at Thing level.
|
||||
|
||||
## Thing Configuration
|
||||
|
||||
The thing has a few configuration parameters:
|
||||
|
||||
| Parameter | Description |
|
||||
|---------------|----------------------------------------------------------------------------------------|
|
||||
| `department` | Name of the department. |
|
||||
| refresh | Refresh interval in minutes. Optional, the default value is 1440 minutes (once a day). |
|
||||
|
||||
## Channels
|
||||
|
||||
The Météo Alerte information that are retrieved is available as these channels:
|
||||
|
||||
| Channel ID | Item Type | Description |
|
||||
|-----------------------|-----------|-----------------------------------------------|
|
||||
| observation-time | DateTime | Date and time of alert creation |
|
||||
| comment | String | General comments on alerts for the department |
|
||||
| vent | String | Wind alert level (*) |
|
||||
| pluie-inondation | String | Rain alert level (*) |
|
||||
| orage | String | Storm alert level (*) |
|
||||
| inondation | String | Flood alert level (*) |
|
||||
| neige | String | Snow alert level (*) |
|
||||
| canicule | String | Heat alert level (*) |
|
||||
| grand-froid | String | Cold alert level (*) |
|
||||
| avalanches | String | Avalanche alert level (*) |
|
||||
| pluie-inondation-icon | Image | Pictogram of the Rain alert level |
|
||||
| vent-icon | Image | Pictogram of the Wind alert level |
|
||||
| orage-icon | Image | Pictogram of Storm alert level |
|
||||
| inondation-icon | Image | Pictogram of Flood alert level |
|
||||
| neige-icon | Image | Pictogram of Snow alert level |
|
||||
| canicule-icon | Image | Pictogram of Heat alert level |
|
||||
| grand-froid-icon | Image | Pictogram of Cold alert level |
|
||||
| avalanches-icon | Image | Pictogram of Avalanche alert level |
|
||||
|
||||
(*) Each alert level is described by a color :
|
||||
|
||||
| Code | Color | Description |
|
||||
|------|--------|-------------------------------------------|
|
||||
| 0 | Green | No particular vigilance |
|
||||
| 1 | Yellow | Be attentive to the weather situation |
|
||||
| 2 | Orange | Be "very vigilant" in the concerned areas |
|
||||
| 3 | Red | Absolute vigilance required |
|
||||
|
||||
|
||||
## Full Example
|
||||
|
||||
meteoalert.things:
|
||||
|
||||
```
|
||||
Thing meteoalerte:department:yvelines @ "MyCity" [department="YVELINES", refresh=12]
|
||||
```
|
||||
|
||||
meteoalert.items:
|
||||
|
||||
```
|
||||
Group gMeteoAlert "Alertes Météo" <weather>
|
||||
String MA_Dept78 "Département 78 [%s]" <aqi> (gMeteoAlert) {channel="meteoalerte:department:yvelines:comment"}
|
||||
String MA_etat_canicule "Canicule [%s]" <aqi> (gMeteoAlert) {channel="meteoalerte:department:yvelines:canicule"}
|
||||
String MA_etat_grand_froid "Grand Froid [%s]" <aqi> (gMeteoAlert) {channel="meteoalerte:department:yvelines:grand-froid"}
|
||||
String MA_etat_pluie_inondation "Pluie-Inondation [%s]" <aqi> (gMeteoAlert) {channel="meteoalerte:department:yvelines:pluie-inondation"}
|
||||
String MA_etat_neige "Neige [%s]" <aqi> (gMeteoAlert) {channel="meteoalerte:department:yvelines:neige"}
|
||||
String MA_etat_vent "Vent [%s]" <aqi> (gMeteoAlert) {channel="meteoalerte:department:yvelines:vent"}
|
||||
String MA_etat_inondation "Inondation [%s]" <aqi> (gMeteoAlert) {channel="meteoalerte:department:yvelines:inondation"}
|
||||
String MA_etat_orage "Orage [%s]" <aqi> (gMeteoAlert) {channel="meteoalerte:department:yvelines:orage"}
|
||||
String MA_etat_avalanche "Avalanches [%s]" <aqi> (gMeteoAlert) {channel="meteoalerte:department:yvelines:avalanches"}
|
||||
|
||||
Image MA_icon_canicule "Canicule" <aqi> (gMeteoAlert) {channel="meteoalerte:department:yvelines:canicule-icon"}
|
||||
Image MA_icon_grand_froid "Grand Froid" <aqi> (gMeteoAlert) {channel="meteoalerte:department:yvelines:grand-froid-icon"}
|
||||
Image MA_icon_pluie_inondation "Pluie-Inondation" <aqi> (gMeteoAlert) {channel="meteoalerte:department:yvelines:pluie-inondation-icon"}
|
||||
Image MA_icon_neige "Neige" <aqi> (gMeteoAlert) {channel="meteoalerte:department:yvelines:neige-icon"}
|
||||
Image MA_icon_vent "Vent" <aqi> (gMeteoAlert) {channel="meteoalerte:department:yvelines:vent-icon"}
|
||||
Image MA_icon_inondation "Inondation" <aqi> (gMeteoAlert) {channel="meteoalerte:department:yvelines:inondation-icon"}
|
||||
Image MA_icon_orage "Orage" <aqi> (gMeteoAlert) {channel="meteoalerte:department:yvelines:orage-icon"}
|
||||
Image MA_icon_avalanche "Avalanche" <aqi> (gMeteoAlert) {channel="meteoalerte:department:yvelines:avalanches-icon"}
|
||||
|
||||
DateTime MA_ObservationTS "Timestamp [%1$tH:%1$tM]" <time> (gMeteoAlert) {channel="meteoalerte:department:yvelines:observation-time"}
|
||||
|
||||
```
|
||||
17
bundles/org.openhab.binding.meteoalerte/pom.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.openhab.addons.bundles</groupId>
|
||||
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>org.openhab.binding.meteoalerte</artifactId>
|
||||
|
||||
<name>openHAB Add-ons :: Bundles :: Meteo Alerte Binding</name>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<features name="org.openhab.binding.meteoalerte-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
|
||||
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>
|
||||
|
||||
<feature name="openhab-binding-meteoalerte" description="Meteo Alerte Binding" version="${project.version}">
|
||||
<feature>openhab-runtime-base</feature>
|
||||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.meteoalerte/${project.version}</bundle>
|
||||
</feature>
|
||||
</features>
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.meteoalerte.internal;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.ThingTypeUID;
|
||||
|
||||
/**
|
||||
* The {@link MeteoAlerteBindingConstants} class defines common constants, which are
|
||||
* used across the whole binding.
|
||||
*
|
||||
* @author Gaël L'hopital - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class MeteoAlerteBindingConstants {
|
||||
|
||||
public static final String BINDING_ID = "meteoalerte";
|
||||
|
||||
// List of all Thing Type UIDs
|
||||
public static final ThingTypeUID THING_TYPE_METEO_ALERT = new ThingTypeUID(BINDING_ID, "department");
|
||||
|
||||
// List of all Channel id's
|
||||
public static final String AVALANCHE = "avalanches";
|
||||
public static final String HEAT = "canicule";
|
||||
public static final String FREEZE = "grand-froid";
|
||||
public static final String FLOOD = "inondation";
|
||||
public static final String SNOW = "neige";
|
||||
public static final String STORM = "orage";
|
||||
public static final String RAIN = "pluie-inondation";
|
||||
public static final String WIND = "vent";
|
||||
public static final String WIND_ICON = "vent-icon";
|
||||
public static final String RAIN_ICON = "pluie-inondation-icon";
|
||||
public static final String STORM_ICON = "orage-icon";
|
||||
public static final String FLOOD_ICON = "inondation-icon";
|
||||
public static final String SNOW_ICON = "neige-icon";
|
||||
public static final String HEAT_ICON = "canicule-icon";
|
||||
public static final String FREEZE_ICON = "grand-froid-icon";
|
||||
public static final String AVALANCHE_ICON = "avalanches-icon";
|
||||
public static final String OBSERVATION_TIME = "observation-time";
|
||||
public static final String COMMENT = "comment";
|
||||
|
||||
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_METEO_ALERT);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.meteoalerte.internal;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link MeteoAlerteConfiguration} is the class used to match the
|
||||
* thing configuration.
|
||||
*
|
||||
* @author Gaël L'hopital - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class MeteoAlerteConfiguration {
|
||||
public String department = "";
|
||||
public Integer refresh = 1440;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.meteoalerte.internal;
|
||||
|
||||
import static org.openhab.binding.meteoalerte.internal.MeteoAlerteBindingConstants.*;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.meteoalerte.internal.handler.MeteoAlerteHandler;
|
||||
import org.openhab.core.i18n.TimeZoneProvider;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.thing.ThingTypeUID;
|
||||
import org.openhab.core.thing.binding.BaseThingHandlerFactory;
|
||||
import org.openhab.core.thing.binding.ThingHandler;
|
||||
import org.openhab.core.thing.binding.ThingHandlerFactory;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
|
||||
/**
|
||||
* The {@link MeteoAlerteHandlerFactory} is responsible for creating things and thing
|
||||
* handlers.
|
||||
*
|
||||
* @author Gaël L'hopital - Initial contribution
|
||||
*/
|
||||
@Component(service = ThingHandlerFactory.class, configurationPid = "binding.meteoalerte")
|
||||
@NonNullByDefault
|
||||
public class MeteoAlerteHandlerFactory extends BaseThingHandlerFactory {
|
||||
private final Gson gson;
|
||||
// Needed for converting UTC time to local time
|
||||
private final TimeZoneProvider timeZoneProvider;
|
||||
|
||||
@Activate
|
||||
public MeteoAlerteHandlerFactory(@Reference TimeZoneProvider timeZoneProvider) {
|
||||
this.timeZoneProvider = timeZoneProvider;
|
||||
this.gson = new GsonBuilder()
|
||||
.registerTypeAdapter(ZonedDateTime.class, (JsonDeserializer<ZonedDateTime>) (json, type,
|
||||
jsonDeserializationContext) -> ZonedDateTime.parse(json.getAsJsonPrimitive().getAsString()))
|
||||
.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsThingType(ThingTypeUID thingTypeUID) {
|
||||
return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable ThingHandler createHandler(Thing thing) {
|
||||
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
|
||||
|
||||
if (thingTypeUID.equals(THING_TYPE_METEO_ALERT)) {
|
||||
return new MeteoAlerteHandler(thing, timeZoneProvider, gson);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.meteoalerte.internal.handler;
|
||||
|
||||
import static org.openhab.binding.meteoalerte.internal.MeteoAlerteBindingConstants.*;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.meteoalerte.internal.MeteoAlerteConfiguration;
|
||||
import org.openhab.binding.meteoalerte.internal.json.ApiResponse;
|
||||
import org.openhab.core.i18n.TimeZoneProvider;
|
||||
import org.openhab.core.io.net.http.HttpUtil;
|
||||
import org.openhab.core.library.types.DateTimeType;
|
||||
import org.openhab.core.library.types.RawType;
|
||||
import org.openhab.core.library.types.StringType;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.thing.ThingStatus;
|
||||
import org.openhab.core.thing.ThingStatusDetail;
|
||||
import org.openhab.core.thing.binding.BaseThingHandler;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
import org.openhab.core.types.UnDefType;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
/**
|
||||
* The {@link MeteoAlerteHandler} is responsible for updating channels
|
||||
* and querying the API
|
||||
*
|
||||
* @author Gaël L'hopital - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class MeteoAlerteHandler extends BaseThingHandler {
|
||||
private static final String URL = "https://public.opendatasoft.com/api/records/1.0/search/?dataset=risques-meteorologiques-copy&"
|
||||
+ "facet=etat_vent&facet=etat_pluie_inondation&facet=etat_orage&facet=etat_inondation&facet=etat_neige&facet=etat_canicule&"
|
||||
+ "facet=etat_grand_froid&facet=etat_avalanches&refine.nom_dept=";
|
||||
private static final int TIMEOUT_MS = 30000;
|
||||
private static final List<String> ALERT_LEVELS = Arrays.asList("Vert", "Jaune", "Orange", "Rouge");
|
||||
private final Logger logger = LoggerFactory.getLogger(MeteoAlerteHandler.class);
|
||||
|
||||
// Time zone provider representing time zone configured in openHAB configuration
|
||||
private final TimeZoneProvider timeZoneProvider;
|
||||
private final Gson gson;
|
||||
private @Nullable ScheduledFuture<?> refreshJob;
|
||||
private String queryUrl = "";
|
||||
|
||||
public MeteoAlerteHandler(Thing thing, TimeZoneProvider timeZoneProvider, Gson gson) {
|
||||
super(thing);
|
||||
this.timeZoneProvider = timeZoneProvider;
|
||||
this.gson = gson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
logger.debug("Initializing Météo Alerte handler.");
|
||||
|
||||
MeteoAlerteConfiguration config = getConfigAs(MeteoAlerteConfiguration.class);
|
||||
logger.debug("config department = {}", config.department);
|
||||
logger.debug("config refresh = {}", config.refresh);
|
||||
|
||||
updateStatus(ThingStatus.UNKNOWN);
|
||||
queryUrl = URL + config.department;
|
||||
refreshJob = scheduler.scheduleWithFixedDelay(this::updateAndPublish, 0, config.refresh, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
logger.debug("Disposing the Météo Alerte handler.");
|
||||
ScheduledFuture<?> refreshJob = this.refreshJob;
|
||||
if (refreshJob != null) {
|
||||
refreshJob.cancel(true);
|
||||
}
|
||||
this.refreshJob = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
if (command instanceof RefreshType) {
|
||||
updateAndPublish();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateAndPublish() {
|
||||
try {
|
||||
if (queryUrl.isEmpty()) {
|
||||
throw new MalformedURLException("queryUrl not initialized");
|
||||
}
|
||||
String response = HttpUtil.executeUrl("GET", queryUrl, TIMEOUT_MS);
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
ApiResponse apiResponse = gson.fromJson(response, ApiResponse.class);
|
||||
updateChannels(apiResponse);
|
||||
} catch (MalformedURLException e) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
||||
String.format("Querying '%s' raised : %s", queryUrl, e.getMessage()));
|
||||
} catch (IOException e) {
|
||||
logger.warn("Error opening connection to Meteo Alerte webservice : {}", e.getMessage());
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the channel from the last Meteo Alerte data retrieved
|
||||
*
|
||||
* @param channelId the id identifying the channel to be updated
|
||||
*/
|
||||
private void updateChannels(ApiResponse apiResponse) {
|
||||
Arrays.stream(apiResponse.getRecords()).findFirst()
|
||||
.ifPresent((record) -> record.getResponseFieldDTO().ifPresent(fields -> {
|
||||
updateAlertString(WIND, fields.getVent());
|
||||
updateAlertString(RAIN, fields.getPluieInondation());
|
||||
updateAlertString(STORM, fields.getOrage());
|
||||
updateAlertString(FLOOD, fields.getInondation());
|
||||
updateAlertString(SNOW, fields.getNeige());
|
||||
updateAlertString(HEAT, fields.getCanicule());
|
||||
updateAlertString(FREEZE, fields.getGrandFroid());
|
||||
updateAlertString(AVALANCHE, fields.getAvalanches());
|
||||
|
||||
fields.getDateInsert().ifPresent(date -> updateDate(OBSERVATION_TIME, date));
|
||||
updateState(COMMENT, new StringType(fields.getVigilanceComment()));
|
||||
updateIcon(WIND, fields.getVent());
|
||||
updateIcon(RAIN, fields.getPluieInondation());
|
||||
updateIcon(STORM, fields.getOrage());
|
||||
updateIcon(FLOOD, fields.getInondation());
|
||||
updateIcon(SNOW, fields.getNeige());
|
||||
updateIcon(HEAT, fields.getCanicule());
|
||||
updateIcon(FREEZE, fields.getGrandFroid());
|
||||
updateIcon(AVALANCHE, fields.getAvalanches());
|
||||
}));
|
||||
}
|
||||
|
||||
public void updateIcon(String channelId, String value) {
|
||||
String iconChannelId = channelId + "-icon";
|
||||
if (isLinked(iconChannelId)) {
|
||||
String pictoName = channelId + (!value.isEmpty() ? "_" + value.toLowerCase() : "");
|
||||
byte[] image = getImage("picto" + File.separator + pictoName + ".gif");
|
||||
if (image != null) {
|
||||
RawType picto = new RawType(image, "image/gif");
|
||||
updateState(iconChannelId, picto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private byte @Nullable [] getImage(String iconPath) {
|
||||
URL url = FrameworkUtil.getBundle(getClass()).getResource(iconPath);
|
||||
logger.debug("Path to icon image resource is: {}", url);
|
||||
try (InputStream in = new BufferedInputStream(url.openStream())) {
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
int next = in.read();
|
||||
while (next > -1) {
|
||||
bos.write(next);
|
||||
next = in.read();
|
||||
}
|
||||
bos.flush();
|
||||
return bos.toByteArray();
|
||||
} catch (IOException e) {
|
||||
logger.debug("I/O exception occurred getting image data: {}", e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void updateAlertString(String channelId, String value) {
|
||||
if (!value.isEmpty() && isLinked(channelId)) {
|
||||
int level = ALERT_LEVELS.indexOf(value);
|
||||
if (level != -1) {
|
||||
updateState(channelId, new StringType(Integer.toString(level)));
|
||||
} else {
|
||||
updateState(channelId, UnDefType.UNDEF);
|
||||
logger.warn("Value {} is not a valid alert level for channel {}", value, channelId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateDate(String channelId, ZonedDateTime zonedDateTime) {
|
||||
if (isLinked(channelId)) {
|
||||
ZonedDateTime localDateTime = zonedDateTime.withZoneSameInstant(timeZoneProvider.getTimeZone());
|
||||
updateState(channelId, new DateTimeType(localDateTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.meteoalerte.internal.json;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* The {@link ApiResponse} is the Java class used to map the JSON
|
||||
* response to the webservice request.
|
||||
*
|
||||
* @author Gaël L'hopital - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class ApiResponse {
|
||||
@SerializedName("nhits")
|
||||
private int nHits;
|
||||
private @Nullable Parameters parameters;
|
||||
private Record[] records = {};
|
||||
|
||||
public int getNHits() {
|
||||
return nHits;
|
||||
}
|
||||
|
||||
public Optional<Parameters> getParameters() {
|
||||
Parameters parameters = this.parameters;
|
||||
if (parameters != null) {
|
||||
return Optional.of(parameters);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public Record[] getRecords() {
|
||||
return records;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.meteoalerte.internal.json;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* The {@link Parameters} is the Java class used to map the JSON
|
||||
* response to the webservice request.
|
||||
*
|
||||
* @author Gaël L'hopital - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class Parameters {
|
||||
private String dataset = "";
|
||||
@SerializedName("timezone")
|
||||
private String timeZone = "";
|
||||
private int rows;
|
||||
private String format = "";
|
||||
private @Nullable Refine refine;
|
||||
|
||||
public String getDataset() {
|
||||
return dataset;
|
||||
}
|
||||
|
||||
public String getTimezone() {
|
||||
return timeZone;
|
||||
}
|
||||
|
||||
public int getRows() {
|
||||
return rows;
|
||||
}
|
||||
|
||||
public String getFormat() {
|
||||
return format;
|
||||
}
|
||||
|
||||
public Optional<Refine> getRefine() {
|
||||
Refine refine = this.refine;
|
||||
if (refine != null) {
|
||||
return Optional.of(refine);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.meteoalerte.internal.json;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* The {@link Record} is the Java class used to map the JSON
|
||||
* response to the webservice request.
|
||||
*
|
||||
* @author Gaël L'hopital - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class Record {
|
||||
@SerializedName("datasetid")
|
||||
private String datasetId = "";
|
||||
@SerializedName("recordid")
|
||||
private String recordId = "";
|
||||
@SerializedName("record_timestamp")
|
||||
private String recordTimestamp = "";
|
||||
@SerializedName("fields")
|
||||
private @Nullable ResponseFieldDTO responseFieldDTO;
|
||||
|
||||
public String getDatasetId() {
|
||||
return datasetId;
|
||||
}
|
||||
|
||||
public String getRecordId() {
|
||||
return recordId;
|
||||
}
|
||||
|
||||
public String getRecordTimestamp() {
|
||||
return recordTimestamp;
|
||||
}
|
||||
|
||||
public Optional<ResponseFieldDTO> getResponseFieldDTO() {
|
||||
ResponseFieldDTO fields = this.responseFieldDTO;
|
||||
if (fields != null) {
|
||||
return Optional.of(fields);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.meteoalerte.internal.json;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* The {@link Refine} is the Java class used to map the JSON
|
||||
* response to the webservice request.
|
||||
*
|
||||
* @author Gaël L'hopital - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class Refine {
|
||||
@SerializedName("nom_dept")
|
||||
private String nomDept = "";
|
||||
|
||||
public String getNomDept() {
|
||||
return nomDept;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.meteoalerte.internal.json;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* The {@link ResponseFieldDTO} is the Java class used to map the JSON
|
||||
* response to the webservice request.
|
||||
*
|
||||
* @author Gaël L'hopital - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class ResponseFieldDTO {
|
||||
@SerializedName("nom_reg")
|
||||
private String nomReg = "";
|
||||
@SerializedName("typeprev")
|
||||
private String typePrev = "";
|
||||
@SerializedName("etat_canicule")
|
||||
private String canicule = "";
|
||||
@SerializedName("nom_dept")
|
||||
private String nomDept = "";
|
||||
@SerializedName("etat_grand_froid")
|
||||
private String grandFroid = "";
|
||||
@SerializedName("noversion")
|
||||
private String noVersion = "";
|
||||
@SerializedName("etat_pluie_inondation")
|
||||
private String pluieInondation = "";
|
||||
@SerializedName("etat_neige")
|
||||
private String neige = "";
|
||||
@SerializedName("etat_vent")
|
||||
private String vent = "";
|
||||
@SerializedName("etat_inondation")
|
||||
private String inondation = "";
|
||||
@SerializedName("etat_avalanches")
|
||||
private String avalanches = "";
|
||||
@SerializedName("etat_orage")
|
||||
private String orage = "";
|
||||
private int echeance;
|
||||
@SerializedName("etat_vague_submersion")
|
||||
private String vagueSubmersion = "";
|
||||
private String dep = "";
|
||||
@SerializedName("vigilancecommentaire_texte")
|
||||
private String vigilanceComment = "";
|
||||
@SerializedName("dateprevue")
|
||||
private @Nullable ZonedDateTime datePrevue;
|
||||
@SerializedName("dateinsert")
|
||||
private @Nullable ZonedDateTime dateInsert;
|
||||
@SerializedName("daterun")
|
||||
private @Nullable ZonedDateTime dateRun;
|
||||
|
||||
public String getVigilanceComment() {
|
||||
return vigilanceComment;
|
||||
}
|
||||
|
||||
public String getNomReg() {
|
||||
return nomReg;
|
||||
}
|
||||
|
||||
public Optional<ZonedDateTime> getDatePrevue() {
|
||||
ZonedDateTime datePrevue = this.datePrevue;
|
||||
if (datePrevue != null) {
|
||||
return Optional.of(datePrevue);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public String getTypePrev() {
|
||||
return typePrev;
|
||||
}
|
||||
|
||||
public String getCanicule() {
|
||||
return canicule;
|
||||
}
|
||||
|
||||
public String getNomDept() {
|
||||
return nomDept;
|
||||
}
|
||||
|
||||
public String getGrandFroid() {
|
||||
return grandFroid;
|
||||
}
|
||||
|
||||
public String getNoVersion() {
|
||||
return noVersion;
|
||||
}
|
||||
|
||||
public String getPluieInondation() {
|
||||
return pluieInondation;
|
||||
}
|
||||
|
||||
public String getNeige() {
|
||||
return neige;
|
||||
}
|
||||
|
||||
public String getVent() {
|
||||
return vent;
|
||||
}
|
||||
|
||||
public Optional<ZonedDateTime> getDateInsert() {
|
||||
ZonedDateTime dateInsert = this.dateInsert;
|
||||
if (dateInsert != null) {
|
||||
return Optional.of(dateInsert);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public String getInondation() {
|
||||
return inondation;
|
||||
}
|
||||
|
||||
public String getAvalanches() {
|
||||
return avalanches;
|
||||
}
|
||||
|
||||
public String getOrage() {
|
||||
return orage;
|
||||
}
|
||||
|
||||
public int getEcheance() {
|
||||
return echeance;
|
||||
}
|
||||
|
||||
public String getVagueSubmersion() {
|
||||
return vagueSubmersion;
|
||||
}
|
||||
|
||||
public String getDep() {
|
||||
return dep;
|
||||
}
|
||||
|
||||
public Optional<ZonedDateTime> getDateRun() {
|
||||
ZonedDateTime dateRun = this.dateRun;
|
||||
if (dateRun != null) {
|
||||
return Optional.of(dateRun);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<binding:binding id="meteoalerte" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:binding="https://openhab.org/schemas/binding/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/binding/v1.0.0 https://openhab.org/schemas/binding-1.0.0.xsd">
|
||||
|
||||
<name>Meteo Alerte Binding</name>
|
||||
<description>Retrieves Meteo Alert levels in France</description>
|
||||
<author>Gaël L'hopital</author>
|
||||
|
||||
</binding:binding>
|
||||
@@ -0,0 +1,208 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="meteoalerte"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="department">
|
||||
<label>Alertes Département</label>
|
||||
<description>Fournit les niveaux d'alerte météo pour un département.</description>
|
||||
|
||||
<channels>
|
||||
<channel id="vent" typeId="alert-level">
|
||||
<label>Etat Vent</label>
|
||||
</channel>
|
||||
<channel id="pluie-inondation" typeId="alert-level">
|
||||
<label>Etat Pluie Inondation</label>
|
||||
</channel>
|
||||
<channel id="orage" typeId="alert-level">
|
||||
<label>Etat Orage</label>
|
||||
</channel>
|
||||
<channel id="inondation" typeId="alert-level">
|
||||
<label>Etat Inondation</label>
|
||||
</channel>
|
||||
<channel id="neige" typeId="alert-level">
|
||||
<label>Etat Neige</label>
|
||||
</channel>
|
||||
<channel id="canicule" typeId="alert-level">
|
||||
<label>Etat Canicule</label>
|
||||
</channel>
|
||||
<channel id="grand-froid" typeId="alert-level">
|
||||
<label>Etat Grand Froid</label>
|
||||
</channel>
|
||||
<channel id="avalanches" typeId="alert-level">
|
||||
<label>Etat Avalanches</label>
|
||||
</channel>
|
||||
<channel id="vent-icon" typeId="condition-icon">
|
||||
<label>Etat Vent</label>
|
||||
</channel>
|
||||
<channel id="pluie-inondation-icon" typeId="condition-icon">
|
||||
<label>Etat Pluie Inondation</label>
|
||||
</channel>
|
||||
<channel id="orage-icon" typeId="condition-icon">
|
||||
<label>Etat Orage</label>
|
||||
</channel>
|
||||
<channel id="inondation-icon" typeId="condition-icon">
|
||||
<label>Etat Inondation</label>
|
||||
</channel>
|
||||
<channel id="neige-icon" typeId="condition-icon">
|
||||
<label>Etat Neige</label>
|
||||
</channel>
|
||||
<channel id="canicule-icon" typeId="condition-icon">
|
||||
<label>Etat Canicule</label>
|
||||
</channel>
|
||||
<channel id="grand-froid-icon" typeId="condition-icon">
|
||||
<label>Etat Grand Froid</label>
|
||||
</channel>
|
||||
<channel id="avalanches-icon" typeId="condition-icon">
|
||||
<label>Etat Avalanches</label>
|
||||
</channel>
|
||||
<channel id="comment" typeId="comment"/>
|
||||
<channel id="observation-time" typeId="observation-time"/>
|
||||
</channels>
|
||||
|
||||
<config-description>
|
||||
<parameter name="department" type="text" required="true">
|
||||
<label>Département</label>
|
||||
<description>Nom du département</description>
|
||||
<options>
|
||||
<option value="AIN">Ain</option>
|
||||
<option value="AISNE">Aisne</option>
|
||||
<option value="ALLIER">Allier</option>
|
||||
<option value="ALPES-DE-HAUTE-PROVENCE">Alpes de Haute Provence</option>
|
||||
<option value="ALPES-MARITIMES">Alpes Maritimes</option>
|
||||
<option value="ARDECHE">Ardèche</option>
|
||||
<option value="ARDENNES">Ardennes</option>
|
||||
<option value="ARIEGE">Ariège</option>
|
||||
<option value="AUBE">Aube</option>
|
||||
<option value="AUDE">Aude</option>
|
||||
<option value="AVEYRON">Aveyron</option>
|
||||
<option value="BAS-RHIN">Bas-Rhin</option>
|
||||
<option value="BOUCHES-DU-RHONE">Bouches du Rhône</option>
|
||||
<option value="CALVADOS">Calvados</option>
|
||||
<option value="CANTAL">Cantal</option>
|
||||
<option value="CHARENTE">Charente</option>
|
||||
<option value="CHARENTE-MARITIME">Charente Maritime</option>
|
||||
<option value="CHER">Cher</option>
|
||||
<option value="CORREZE">Corrèze</option>
|
||||
<option value="CORSE-DU-SUD">Corse du Sud</option>
|
||||
<option value="COTE-D'OR">Côte D'Or</option>
|
||||
<option value="COTES-D'ARMOR">Côtes D'Armor</option>
|
||||
<option value="CREUSE">Creuse</option>
|
||||
<option value="DEUX-SEVRES">Deux Sèvres</option>
|
||||
<option value="DORDOGNE">Dordogne</option>
|
||||
<option value="DOUBS">Doubs</option>
|
||||
<option value="DROME">Drôme</option>
|
||||
<option value="ESSONNE">Essonne</option>
|
||||
<option value="EURE">Eure</option>
|
||||
<option value="EURE-ET-LOIR">Eure et Loir</option>
|
||||
<option value="FINISTERE">Finistère</option>
|
||||
<option value="GARD">Gard</option>
|
||||
<option value="GERS">Gers</option>
|
||||
<option value="GIRONDE">Gironde</option>
|
||||
<option value="HAUT-RHIN">Haut-Rhin</option>
|
||||
<option value="HAUTE-CORSE">Haute Corse</option>
|
||||
<option value="HAUTE-GARONNE">Haute Garonne</option>
|
||||
<option value="HAUTE-LOIRE">Haute Loire</option>
|
||||
<option value="HAUTE-MARNE">Haute Marne</option>
|
||||
<option value="HAUTE-SAONE">Haute Saône</option>
|
||||
<option value="HAUTE-SAVOIE">Haute Savoie</option>
|
||||
<option value="HAUTE-VIENNE">Haute Vienne</option>
|
||||
<option value="HAUTES-ALPES">Hautes Alpes</option>
|
||||
<option value="HAUTES-PYRENEES">Hautes Pyrénées</option>
|
||||
<option value="HAUTS-DE-SEINE">Hauts de Seine</option>
|
||||
<option value="HERAULT">Hérault</option>
|
||||
<option value="ILLE-ET-VILAINE">Ille et Vilaine</option>
|
||||
<option value="INDRE">Indre</option>
|
||||
<option value="INDRE-ET-LOIRE">Indre et Loire</option>
|
||||
<option value="ISERE">Isère</option>
|
||||
<option value="JURA">Jura</option>
|
||||
<option value="LANDES">Landes</option>
|
||||
<option value="LOIR-ET-CHER">Loir et Cher</option>
|
||||
<option value="LOIRE">Loire</option>
|
||||
<option value="LOIRE-ATLANTIQUE">Loire Atlantique</option>
|
||||
<option value="LOIRET">Loiret</option>
|
||||
<option value="LOT">Lot</option>
|
||||
<option value="LOT-ET-GARONNE">Lot et Garonne</option>
|
||||
<option value="LOZERE">Lozère</option>
|
||||
<option value="MAINE-ET-LOIRE">Maine et Loire</option>
|
||||
<option value="MANCHE">Manche</option>
|
||||
<option value="MARNE">Marne</option>
|
||||
<option value="MAYENNE">Mayenne</option>
|
||||
<option value="MEURTHE-ET-MOSELLE">Meurthe et Moselle</option>
|
||||
<option value="MEUSE">Meuse</option>
|
||||
<option value="MORBIHAN">Morbihan</option>
|
||||
<option value="MOSELLE">Moselle</option>
|
||||
<option value="NIEVRE">Nièvre</option>
|
||||
<option value="NORD">Nord</option>
|
||||
<option value="OISE">Oise</option>
|
||||
<option value="ORNE">Orne</option>
|
||||
<option value="PARIS">Paris</option>
|
||||
<option value="PAS-DE-CALAIS">Pas de Calais</option>
|
||||
<option value="PUY-DE-DOME">Puy de Dôme</option>
|
||||
<option value="PYRENEES-ATLANTIQUES">Pyrénées Atlantiques</option>
|
||||
<option value="PYRENEES-ORIENTALES">Pyrénées Orientales</option>
|
||||
<option value="RHONE">Rhône</option>
|
||||
<option value="SAONE-ET-LOIRE">Saône et Loire</option>
|
||||
<option value="SARTHE">Sarthe</option>
|
||||
<option value="SAVOIE">Savoie</option>
|
||||
<option value="SEINE-ET-MARNE">Seine et Marne</option>
|
||||
<option value="SEINE-MARITIME">Seine Maritime</option>
|
||||
<option value="SEINE-SAINT-DENIS">Seine Saint Denis</option>
|
||||
<option value="SOMME">Somme</option>
|
||||
<option value="TARN">Tarn</option>
|
||||
<option value="TARN-ET-GARONNE">Tarn et Garonne</option>
|
||||
<option value="TERRITOIRE DE BELFORT">Territoire de Belfort</option>
|
||||
<option value="VAL-D'OISE">Val D'Oise</option>
|
||||
<option value="VAL-DE-MARNE">Val de Marne</option>
|
||||
<option value="VAR">Var</option>
|
||||
<option value="VAUCLUSE">Vaucluse</option>
|
||||
<option value="VENDEE">Vendée</option>
|
||||
<option value="VIENNE">Vienne</option>
|
||||
<option value="VOSGES">Vosges</option>
|
||||
<option value="YONNE">Yonne</option>
|
||||
<option value="YVELINES">Yvelines</option>
|
||||
</options>
|
||||
<limitToOptions>true</limitToOptions>
|
||||
</parameter>
|
||||
<parameter name="refresh" type="integer" min="1" required="true" unit="min">
|
||||
<label>Fréquence de rafraichissement</label>
|
||||
<description>Période d'actualisation des données en minutes.</description>
|
||||
<default>1440</default>
|
||||
</parameter>
|
||||
</config-description>
|
||||
</thing-type>
|
||||
|
||||
<channel-type id="alert-level">
|
||||
<item-type>String</item-type>
|
||||
<label>Alerte</label>
|
||||
<state readOnly="true">
|
||||
<options>
|
||||
<option value="0">Vert</option>
|
||||
<option value="1">Jaune</option>
|
||||
<option value="2">Orange</option>
|
||||
<option value="3">Rouge</option>
|
||||
</options>
|
||||
</state>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="comment">
|
||||
<item-type>String</item-type>
|
||||
<label>Commentaire</label>
|
||||
<state readOnly="true" pattern="%s"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="observation-time" advanced="true">
|
||||
<item-type>DateTime</item-type>
|
||||
<label>Heure d'observation</label>
|
||||
<description>Date et heure d'observation.</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="condition-icon">
|
||||
<item-type>Image</item-type>
|
||||
<label>Pictogramme</label>
|
||||
<description>Pictogramme associé au niveau d'alerte.</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
</thing:thing-descriptions>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 297 B |
|
After Width: | Height: | Size: 285 B |
|
After Width: | Height: | Size: 274 B |
|
After Width: | Height: | Size: 251 B |
|
After Width: | Height: | Size: 949 B |
|
After Width: | Height: | Size: 211 B |
|
After Width: | Height: | Size: 203 B |
|
After Width: | Height: | Size: 184 B |
|
After Width: | Height: | Size: 263 B |
|
After Width: | Height: | Size: 962 B |
|
After Width: | Height: | Size: 204 B |
|
After Width: | Height: | Size: 197 B |
|
After Width: | Height: | Size: 936 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1009 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 367 B |
|
After Width: | Height: | Size: 341 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 423 B |
|
After Width: | Height: | Size: 1023 B |
|
After Width: | Height: | Size: 232 B |
|
After Width: | Height: | Size: 233 B |
|
After Width: | Height: | Size: 979 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 751 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 751 B |
|
After Width: | Height: | Size: 751 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 769 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 294 B |
|
After Width: | Height: | Size: 287 B |
|
After Width: | Height: | Size: 1.1 KiB |