2 * Copyright (c) 2010-2023 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.netatmo.internal.api.dto;
15 import java.time.Duration;
16 import java.time.Instant;
17 import java.time.ZonedDateTime;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.binding.netatmo.internal.api.ApiResponse;
21 import org.openhab.binding.netatmo.internal.api.ListBodyResponse;
24 * The {@link NAMain} defines a weather or nhc device.
26 * @author Gaƫl L'hopital - Initial contribution
31 public class NAMain extends Device {
32 public class StationDataResponse extends ApiResponse<ListBodyResponse<NAMain>> {
35 private boolean readOnly;
38 * true when the user was invited to (or has favorited) a station, false when the user owns it
42 public boolean isReadOnly() {
46 public boolean hasFreshData(int dataFreshnessLimit) {
47 // check by comparing data freshness
48 ZonedDateTime localLastSeen = lastSeen;
49 if (localLastSeen != null && !getType().isLogical()) {
50 return Duration.between(localLastSeen.toInstant(), Instant.now()).getSeconds() < dataFreshnessLimit;