*/
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;
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);
}
*/
@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),
</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>
<state readOnly="true" pattern="%.1f %unit%"/>
</channel-type>
- <channel-type id="OzoneTime" 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">
+ <channel-type id="timestamp" 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>