[OpenUV] Marked the SafeExposure channel as extensible so user can add it via UI. (#9967)

Signed-off-by: clinique <gael@lhopital.org>
This commit is contained in:
Gaël L'hopital
2021-01-27 18:08:29 +01:00
committed by GitHub
parent e4ac982119
commit 6473935482
4 changed files with 25 additions and 37 deletions

View File

@@ -12,9 +12,6 @@
*/
package org.openhab.binding.openuv.internal;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNullByDefault;
@@ -50,7 +47,6 @@ public class OpenUVBindingConstants {
public static final String SAFE_EXPOSURE = "SafeExposure";
public static final String ELEVATION = "elevation";
public static final Set<ThingTypeUID> BRIDGE_THING_TYPES_UIDS = Collections.singleton(APIBRIDGE_THING_TYPE);
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = new HashSet<>(
Arrays.asList(LOCATION_REPORT_THING_TYPE));
public static final Set<ThingTypeUID> BRIDGE_THING_TYPES_UIDS = Set.of(APIBRIDGE_THING_TYPE);
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(LOCATION_REPORT_THING_TYPE);
}

View File

@@ -56,11 +56,11 @@ import org.slf4j.LoggerFactory;
*/
@NonNullByDefault
public class OpenUVReportHandler extends BaseThingHandler {
private static final DecimalType ALERT_GREEN = DecimalType.ZERO;
private static final DecimalType ALERT_YELLOW = new DecimalType(1);
private static final DecimalType ALERT_ORANGE = new DecimalType(2);
private static final DecimalType ALERT_RED = new DecimalType(3);
private static final DecimalType ALERT_PURPLE = new DecimalType(4);
private static final State ALERT_GREEN = DecimalType.ZERO;
private static final State ALERT_YELLOW = new DecimalType(1);
private static final State ALERT_ORANGE = new DecimalType(2);
private static final State ALERT_RED = new DecimalType(3);
private static final State ALERT_PURPLE = new DecimalType(4);
private static final State ALERT_UNDEF = HSBType.fromRGB(179, 179, 179);
private static final Map<State, State> ALERT_COLORS = Map.of(ALERT_GREEN, HSBType.fromRGB(85, 139, 47),

View File

@@ -23,26 +23,33 @@
</bridge-type>
<!-- OpenUV Report Thing -->
<thing-type id="uvreport">
<thing-type id="uvreport" extensible="SafeExposure">
<supported-bridge-type-refs>
<bridge-type-ref id="openuvapi"/>
</supported-bridge-type-refs>
<label>UV Report</label>
<description>
Provides various UV data from the OpenUV Project for a given location.
</description>
<description>Provides various UV data from the OpenUV Project for a given location.</description>
<channels>
<channel id="UVIndex" typeId="UVIndex"/>
<channel id="Alert" typeId="Alert"/>
<channel id="UVColor" typeId="UVColor"/>
<channel id="UVMax" typeId="UVMax"/>
<channel id="UVMaxTime" typeId="UVMaxTime"/>
<channel id="UVMaxTime" typeId="timestamp">
<label>UV Max Time</label>
<description>Max UV Index time (solar noon)</description>
</channel>
<channel id="UVMaxEvent" typeId="UVMaxEvent"/>
<channel id="Ozone" typeId="Ozone"/>
<channel id="OzoneTime" typeId="OzoneTime"/>
<channel id="UVTime" typeId="UVTime"/>
<channel id="OzoneTime" typeId="timestamp">
<label>Ozone Observation Time</label>
<description>Latest OMI ozone update timestamp.</description>
</channel>
<channel id="UVTime" typeId="timestamp">
<label>Report Timestamp</label>
<description>UV Report timestamp.</description>
</channel>
<channel id="SafeExposure" typeId="SafeExposure"/>
<channel id="elevation" typeId="elevation"/>
</channels>
@@ -84,26 +91,9 @@
<state readOnly="true" pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="OzoneTime" advanced="true">
<channel-type id="timestamp" advanced="true">
<item-type>DateTime</item-type>
<label>Ozone Observation Time</label>
<description>Latest OMI ozone update timestamp.</description>
<category>time</category>
<state readOnly="true" pattern="%1$tF %1$tR"/>
</channel-type>
<channel-type id="UVMaxTime" advanced="true">
<item-type>DateTime</item-type>
<label>UV Max Time</label>
<description>Max UV Index time (solar noon)</description>
<category>time</category>
<state readOnly="true" pattern="%1$tF %1$tR"/>
</channel-type>
<channel-type id="UVTime" advanced="true">
<item-type>DateTime</item-type>
<label>Report Timestamp</label>
<description>UV Report timestamp.</description>
<label>Timestamp</label>
<category>time</category>
<state readOnly="true" pattern="%1$tF %1$tR"/>
</channel-type>