]> git.basschouten.com Git - openhab-addons.git/blob
f769025d310c34394f63ad810adec278dcb8737c
[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.plugwiseha.internal.config;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * The {@link PlugwiseHAThingConfig} encapsulates the configuration options for
19  * an instance of the {@link org.openhab.binding.plugwiseha.internal.handler.PlugwiseHAApplianceHandler}
20  * and the {@link org.openhab.binding.plugwiseha.internal.handler.PlugwiseHAZoneHandler}
21  *
22  * @author Bas van Wetten - Initial contribution
23  * @author Leo Siepel - finish initial contribution
24  */
25 @NonNullByDefault
26 public class PlugwiseHAThingConfig {
27
28     private String id = "";
29
30     private int lowBatteryPercentage = 15;
31
32     // Getters
33
34     public String getId() {
35         return id;
36     }
37
38     public int getLowBatteryPercentage() {
39         return this.lowBatteryPercentage;
40     }
41
42     // Member methods
43
44     public boolean isValid() {
45         return !id.isBlank() && lowBatteryPercentage > 0 && lowBatteryPercentage < 100;
46     }
47
48     @Override
49     public String toString() {
50         return "PlugwiseHAThingConfig{id = " + id + ", lowBatteryPercentage = " + lowBatteryPercentage + "}";
51     }
52 }