]> git.basschouten.com Git - openhab-addons.git/blob
f13e2d97644e2c7c8938c8aadc6389518bdc909b
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.ApiResponse;
20 import org.openhab.binding.netatmo.internal.deserialization.NAObjectMap;
21
22 /**
23  * The {@link NAHomeStatus} holds data for a given home.
24  *
25  * @author GaĆ«l L'hopital - Initial contribution
26  *
27  */
28 @NonNullByDefault
29 public class NAHomeStatus {
30     public class NAHomeStatusResponse extends ApiResponse<NAHomeStatus> {
31     }
32
33     public class HomeStatus extends NAThing {
34         private @Nullable NAObjectMap<HomeStatusModule> modules;
35
36         public NAObjectMap<HomeStatusModule> getModules() {
37             NAObjectMap<HomeStatusModule> localModules = modules;
38             return localModules != null ? localModules : new NAObjectMap<>();
39         }
40     }
41
42     public class Energy extends HomeStatus {
43         private NAObjectMap<Room> rooms = new NAObjectMap<>();
44
45         public NAObjectMap<Room> getRooms() {
46             return rooms;
47         }
48     }
49
50     public class Security extends HomeStatus {
51         private NAObjectMap<HomeStatusPerson> persons = new NAObjectMap<>();
52
53         public NAObjectMap<HomeStatusPerson> getPersons() {
54             return persons;
55         }
56     }
57
58     private @Nullable HomeStatus home;
59
60     public Optional<HomeStatus> getHomeStatus() {
61         return Optional.ofNullable(home);
62     }
63 }