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.util.Optional;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.netatmo.internal.api.data.ModuleType;
20 import org.openhab.binding.netatmo.internal.api.data.NetatmoConstants.AlimentationStatus;
21 import org.openhab.binding.netatmo.internal.api.data.NetatmoConstants.BatteryState;
22 import org.openhab.binding.netatmo.internal.api.data.NetatmoConstants.FloodLightMode;
23 import org.openhab.binding.netatmo.internal.api.data.NetatmoConstants.SdCardStatus;
24 import org.openhab.core.library.types.OnOffType;
25 import org.openhab.core.library.types.OpenClosedType;
26 import org.openhab.core.types.State;
27 import org.openhab.core.types.UnDefType;
30 * The {@link HomeStatusModule} holds module informations returned by getHomeData endpoint
32 * @author Gaƫl L'hopital - Initial contribution
37 public class HomeStatusModule extends NAThing {
38 private @Nullable String firmwareName;
39 private @Nullable String wifiState;
40 private @Nullable String status;
41 private @Nullable OnOffType monitoring;
42 private FloodLightMode floodlight = FloodLightMode.UNKNOWN;
43 private SdCardStatus sdStatus = SdCardStatus.UNKNOWN;
44 private AlimentationStatus alimStatus = AlimentationStatus.UNKNOWN;
45 private @Nullable String sirenStatus;
46 private @Nullable String vpnUrl;
47 private boolean isLocal;
48 private BatteryState batteryState = BatteryState.UNKNOWN;
49 private int batteryLevel;
51 private @Nullable OpenClosedType boilerStatus;
52 private boolean boilerValveComfortBoost;
54 public State getBoilerStatus() {
55 OpenClosedType status = boilerStatus;
56 return status != null ? status : UnDefType.NULL;
59 public boolean getBoilerValveComfortBoost() {
60 return boilerValveComfortBoost;
63 public Optional<String> getFirmwareName() {
64 return Optional.ofNullable(firmwareName);
67 public Optional<String> getWifiState() {
68 return Optional.ofNullable(wifiState);
71 public Optional<String> getStatus() {
72 return Optional.ofNullable(status);
75 public State getMonitoring() {
76 OnOffType localStatus = monitoring;
77 return localStatus != null ? localStatus // Monitoring is always active on Doorbell
78 : getType().equals(ModuleType.DOORBELL) ? OnOffType.ON : UnDefType.NULL;
81 public FloodLightMode getFloodlight() {
85 public SdCardStatus getSdStatus() {
89 public AlimentationStatus getAlimStatus() {
93 public Optional<String> getSirenStatus() {
94 return Optional.ofNullable(sirenStatus);
97 public @Nullable String getVpnUrl() {
101 public boolean isLocal() {
105 public BatteryState getBatteryState() {
109 public int getBatteryLevel() {