2 * Copyright (c) 2010-2022 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.handler.capability;
15 import static org.openhab.binding.netatmo.internal.NetatmoBindingConstants.*;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.netatmo.internal.api.dto.NAMain;
19 import org.openhab.binding.netatmo.internal.handler.CommonInterface;
22 * The {@link DeviceCapability} takes care of handling properties for netatmo devices
24 * @author Gaƫl L'hopital - Initial contribution
28 public class DeviceCapability extends Capability {
29 private static final int DATA_AGE_LIMIT_S = 3600;
31 public DeviceCapability(CommonInterface handler) {
36 protected void updateNAMain(NAMain newData) {
38 newData.getPlace().ifPresent(place -> {
39 place.getCity().map(city -> properties.put(PROPERTY_CITY, city));
40 place.getCountry().map(country -> properties.put(PROPERTY_COUNTRY, country));
41 place.getTimezone().map(tz -> properties.put(PROPERTY_TIMEZONE, tz));
44 if (!newData.hasFreshData(DATA_AGE_LIMIT_S)) {
45 statusReason = "@text/data-over-limit";