]> git.basschouten.com Git - openhab-addons.git/blob
d7f1cbf75719d36be458134bf7ea8dfee5e9c1c6
[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.config;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.netatmo.internal.api.data.NetatmoConstants.FeatureArea;
17
18 /**
19  * The {@link HomeConfiguration} is responsible for holding configuration information for any
20  * Netatmo Home - security or energy, or both
21  *
22  * @author GaĆ«l L'hopital - Initial contribution
23  */
24 @NonNullByDefault
25 public class HomeConfiguration extends NAThingConfiguration {
26     public String securityId = "";
27     public String energyId = "";
28
29     @Override
30     public String getId() {
31         return getIdForArea(energyId.isBlank() ? FeatureArea.SECURITY : FeatureArea.ENERGY);
32     }
33
34     public String getIdForArea(FeatureArea feature) {
35         return FeatureArea.ENERGY.equals(feature) ? energyId.isBlank() ? id : energyId
36                 : FeatureArea.SECURITY.equals(feature) ? securityId.isBlank() ? id : securityId : id;
37     }
38 }