]> git.basschouten.com Git - openhab-addons.git/blob
0da9ca5144df09ca5d3f468e71f90e43ece46045
[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.io.imperihome.internal.model.device;
14
15 import org.openhab.core.items.Item;
16 import org.openhab.io.imperihome.internal.model.param.NumericValueParam;
17
18 /**
19  * Parent of devices with a {@link NumericValueParam}. Contains the value unit.
20  *
21  * @author Pepijn de Geus - Initial contribution
22  */
23 public abstract class AbstractNumericValueDevice extends AbstractDevice {
24
25     private transient String unit;
26
27     public AbstractNumericValueDevice(DeviceType type, Item item, String defaultUnit) {
28         super(type, item);
29         this.unit = defaultUnit;
30     }
31
32     public String getUnit() {
33         return unit;
34     }
35
36     public void setUnit(String unit) {
37         this.unit = unit;
38     }
39
40     @Override
41     public String toString() {
42         return getClass().getSimpleName() + "{" + "super=" + super.toString() + ", unit='" + unit + '\'' + '}';
43     }
44 }