2 * Copyright (c) 2010-2020 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.openuv.internal.json;
15 import java.time.LocalDateTime;
16 import java.time.ZoneId;
17 import java.time.ZonedDateTime;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.core.library.types.DateTimeType;
21 import org.openhab.core.types.State;
22 import org.openhab.core.types.UnDefType;
25 * The {@link OpenUVResult} is responsible for storing
26 * the "result" node from the OpenUV JSON response
28 * @author Gaƫl L'hopital - Initial contribution
31 public class OpenUVResult {
32 private final ZonedDateTime DEFAULT_ZDT = ZonedDateTime.of(LocalDateTime.MIN, ZoneId.systemDefault());
34 private ZonedDateTime uvTime = DEFAULT_ZDT;
36 private ZonedDateTime uvMaxTime = DEFAULT_ZDT;
38 private ZonedDateTime ozoneTime = DEFAULT_ZDT;
39 private SafeExposureTime safeExposureTime = new SafeExposureTime();
45 public int getUvMax() {
49 public double getOzone() {
53 public State getUVTime() {
54 return uvTime != DEFAULT_ZDT ? new DateTimeType(uvTime.withZoneSameInstant(ZoneId.systemDefault()))
58 public State getUVMaxTime() {
59 return uvMaxTime != DEFAULT_ZDT ? new DateTimeType(uvMaxTime.withZoneSameInstant(ZoneId.systemDefault()))
63 public State getOzoneTime() {
64 return ozoneTime != DEFAULT_ZDT ? new DateTimeType(ozoneTime.withZoneSameInstant(ZoneId.systemDefault()))
68 public SafeExposureTime getSafeExposureTime() {
69 return safeExposureTime;