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.binding.netatmo.internal.api.data.NetatmoConstants.SirenStatus;
25 import org.openhab.core.library.types.OnOffType;
26 import org.openhab.core.library.types.OpenClosedType;
27 import org.openhab.core.types.State;
28 import org.openhab.core.types.UnDefType;
31 * The {@link HomeStatusModule} holds module informations returned by getHomeData endpoint
33 * @author Gaƫl L'hopital - Initial contribution
38 public class HomeStatusModule extends NAThing {
39 private @Nullable String firmwareName;
40 private @Nullable String wifiState;
41 private @Nullable String status;
42 private @Nullable OnOffType monitoring;
43 private FloodLightMode floodlight = FloodLightMode.UNKNOWN;
44 private SdCardStatus sdStatus = SdCardStatus.UNKNOWN;
45 private AlimentationStatus alimStatus = AlimentationStatus.UNKNOWN;
46 private SirenStatus sirenStatus = SirenStatus.UNKNOWN;
47 private @Nullable String vpnUrl;
48 private boolean isLocal;
49 private BatteryState batteryState = BatteryState.UNKNOWN;
50 private int batteryLevel;
52 private @Nullable OpenClosedType boilerStatus;
53 private boolean boilerValveComfortBoost;
55 public State getBoilerStatus() {
56 OpenClosedType status = boilerStatus;
57 return status != null ? status : UnDefType.NULL;
60 public boolean getBoilerValveComfortBoost() {
61 return boilerValveComfortBoost;
64 public Optional<String> getFirmwareName() {
65 return Optional.ofNullable(firmwareName);
68 public Optional<String> getWifiState() {
69 return Optional.ofNullable(wifiState);
72 public Optional<String> getStatus() {
73 return Optional.ofNullable(status);
76 public State getMonitoring() {
77 OnOffType localStatus = monitoring;
78 return localStatus != null ? localStatus // Monitoring is always active on Doorbell
79 : getType().equals(ModuleType.DOORBELL) ? OnOffType.ON : UnDefType.NULL;
82 public FloodLightMode getFloodlight() {
86 public SdCardStatus getSdStatus() {
90 public AlimentationStatus getAlimStatus() {
94 public SirenStatus getSirenStatus() {
98 public @Nullable String getVpnUrl() {
102 public boolean isLocal() {
106 public BatteryState getBatteryState() {
110 public int getBatteryLevel() {