]> git.basschouten.com Git - openhab-addons.git/blob
ac53c2a34eadbc06e46010790fc89fd514d9a61f
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.netatmo.internal.api.dto;
14
15 import java.util.Optional;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.netatmo.internal.api.data.NetatmoConstants.AlimentationStatus;
20 import org.openhab.binding.netatmo.internal.api.data.NetatmoConstants.BatteryState;
21 import org.openhab.binding.netatmo.internal.api.data.NetatmoConstants.FloodLightMode;
22 import org.openhab.binding.netatmo.internal.api.data.NetatmoConstants.SdCardStatus;
23 import org.openhab.core.library.types.OnOffType;
24 import org.openhab.core.library.types.OpenClosedType;
25 import org.openhab.core.types.State;
26 import org.openhab.core.types.UnDefType;
27
28 /**
29  * The {@link HomeStatusModule} holds module informations returned by getHomeData endpoint
30  *
31  * @author GaĆ«l L'hopital - Initial contribution
32  *
33  */
34
35 @NonNullByDefault
36 public class HomeStatusModule extends NAThing {
37     private @Nullable String firmwareName;
38     private @Nullable String wifiState;
39     private @Nullable String status;
40     private @Nullable OnOffType monitoring;
41     private FloodLightMode floodlight = FloodLightMode.UNKNOWN;
42     private SdCardStatus sdStatus = SdCardStatus.UNKNOWN;
43     private AlimentationStatus alimStatus = AlimentationStatus.UNKNOWN;
44     private @Nullable String sirenStatus;
45     private @Nullable String vpnUrl;
46     private boolean isLocal;
47     private BatteryState batteryState = BatteryState.UNKNOWN;
48     private int batteryLevel;
49
50     private @Nullable OpenClosedType boilerStatus;
51     private boolean boilerValveComfortBoost;
52
53     public State getBoilerStatus() {
54         OpenClosedType status = boilerStatus;
55         return status != null ? status : UnDefType.NULL;
56     }
57
58     public boolean getBoilerValveComfortBoost() {
59         return boilerValveComfortBoost;
60     }
61
62     public Optional<String> getFirmwareName() {
63         return Optional.ofNullable(firmwareName);
64     }
65
66     public Optional<String> getWifiState() {
67         return Optional.ofNullable(wifiState);
68     }
69
70     public Optional<String> getStatus() {
71         return Optional.ofNullable(status);
72     }
73
74     public State getMonitoring() {
75         OnOffType localStatus = monitoring;
76         return localStatus != null ? localStatus : UnDefType.NULL;
77     }
78
79     public FloodLightMode getFloodlight() {
80         return floodlight;
81     }
82
83     public SdCardStatus getSdStatus() {
84         return sdStatus;
85     }
86
87     public AlimentationStatus getAlimStatus() {
88         return alimStatus;
89     }
90
91     public Optional<String> getSirenStatus() {
92         return Optional.ofNullable(sirenStatus);
93     }
94
95     public @Nullable String getVpnUrl() {
96         return vpnUrl;
97     }
98
99     public boolean isLocal() {
100         return isLocal;
101     }
102
103     public BatteryState getBatteryState() {
104         return batteryState;
105     }
106
107     public int getBatteryLevel() {
108         return batteryLevel;
109     }
110 }