mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-10 13:21:53 +01:00
Adding UV Index system channel (#3878)
* Adding UV Index system channel Signed-off-by: clinique <gael@lhopital.org>
This commit is contained in:
parent
c40b82f16e
commit
6887db3b89
@ -105,6 +105,7 @@ public class DefaultSystemChannelTypeProvider implements ChannelTypeProvider {
|
||||
"electric-voltage");
|
||||
public static final ChannelTypeUID SYSTEM_CHANNEL_TYPE_UID_ELECTRIC_ENERGY = new ChannelTypeUID(BINDING_ID,
|
||||
"electric-energy");
|
||||
public static final ChannelTypeUID SYSTEM_CHANNEL_TYPE_UID_UV_INDEX = new ChannelTypeUID(BINDING_ID, "uv-index");
|
||||
|
||||
/**
|
||||
* Signal strength default system wide {@link ChannelType}. Represents signal strength of a device as a number
|
||||
@ -397,6 +398,15 @@ public class DefaultSystemChannelTypeProvider implements ChannelTypeProvider {
|
||||
StateDescriptionFragmentBuilder.create().withReadOnly(true).withPattern("%.1f %unit%").build())
|
||||
.withTags(List.of("Measurement", "Energy")).build();
|
||||
|
||||
/**
|
||||
* UV Index: system wide {@link ChannelType} which shows the UV Index
|
||||
*/
|
||||
public static final ChannelType SYSTEM_UV_INDEX = ChannelTypeBuilder
|
||||
.state(SYSTEM_CHANNEL_TYPE_UID_UV_INDEX, "UV Index", CoreItemFactory.NUMBER)
|
||||
.withDescription("Current UV index").withStateDescriptionFragment(StateDescriptionFragmentBuilder.create()
|
||||
.withReadOnly(true).withPattern("%d").withMinimum(BigDecimal.ONE).build())
|
||||
.withTags(List.of("Measurement", "Ultraviolet")).build();
|
||||
|
||||
private static final Collection<ChannelType> CHANNEL_TYPES = List.of(SYSTEM_CHANNEL_SIGNAL_STRENGTH,
|
||||
SYSTEM_CHANNEL_LOW_BATTERY, SYSTEM_CHANNEL_BATTERY_LEVEL, SYSTEM_TRIGGER, SYSTEM_RAWBUTTON, SYSTEM_BUTTON,
|
||||
SYSTEM_RAWROCKER, SYSTEM_POWER, SYSTEM_LOCATION, SYSTEM_MOTION, SYSTEM_BRIGHTNESS, SYSTEM_COLOR,
|
||||
@ -404,7 +414,7 @@ public class DefaultSystemChannelTypeProvider implements ChannelTypeProvider {
|
||||
SYSTEM_MEDIA_TITLE, SYSTEM_MEDIA_ARTIST, SYSTEM_WIND_DIRECTION, SYSTEM_WIND_SPEED,
|
||||
SYSTEM_OUTDOOR_TEMPERATURE, SYSTEM_INDOOR_TEMPERATURE, SYSTEM_ATMOSPHERIC_HUMIDITY,
|
||||
SYSTEM_BAROMETRIC_PRESSURE, SYSTEM_ELECTRIC_POWER, SYSTEM_ELECTRIC_CURRENT, SYSTEM_ELECTRIC_VOLTAGE,
|
||||
SYSTEM_ELECTRICAL_ENERGY);
|
||||
SYSTEM_ELECTRICAL_ENERGY, SYSTEM_UV_INDEX);
|
||||
|
||||
private final Map<LocalizedKey, ChannelType> localizedChannelTypeCache = new ConcurrentHashMap<>();
|
||||
|
||||
|
@ -56,3 +56,5 @@ channel-type.system.electric-voltage.label = Electric Voltage
|
||||
channel-type.system.electric-voltage.description = Current electric voltage
|
||||
channel-type.system.electrical-energy.label = Electrical Energy
|
||||
channel-type.system.electrical-energy.description = Current electrical energy
|
||||
channel-type.system.uv-index.label = UV Index
|
||||
channel-type.system.uv-index.description = Current UV index
|
||||
|
@ -36,7 +36,7 @@ import org.openhab.core.types.StateOption;
|
||||
@NonNullByDefault
|
||||
public class SystemWideChannelTypesTest extends JavaOSGiTest {
|
||||
|
||||
private static final int NUMBER_OF_SYSTEM_WIDE_CHANNEL_TYPES = 29;
|
||||
private static final int NUMBER_OF_SYSTEM_WIDE_CHANNEL_TYPES = 30;
|
||||
|
||||
private @NonNullByDefault({}) ChannelTypeProvider systemChannelTypeProvider;
|
||||
|
||||
@ -81,6 +81,7 @@ public class SystemWideChannelTypesTest extends JavaOSGiTest {
|
||||
assertNotNull(systemChannelTypeProvider.getChannelType(SYSTEM_CHANNEL_TYPE_UID_ELECTRIC_CURRENT, null));
|
||||
assertNotNull(systemChannelTypeProvider.getChannelType(SYSTEM_CHANNEL_TYPE_UID_ELECTRIC_VOLTAGE, null));
|
||||
assertNotNull(systemChannelTypeProvider.getChannelType(SYSTEM_CHANNEL_TYPE_UID_ELECTRIC_ENERGY, null));
|
||||
assertNotNull(systemChannelTypeProvider.getChannelType(SYSTEM_CHANNEL_TYPE_UID_UV_INDEX, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user