]> git.basschouten.com Git - openhab-addons.git/blob
e86af6f92eb5f442d1c4dd3ff9d57377580b8bcd
[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.sinope.internal.core.appdata;
14
15 /**
16  * The Class SinopeRoomTempData.
17  *
18  * @author Pascal Larin - Initial contribution
19  */
20 public class SinopeHeatLevelData extends SinopeAppData {
21
22     /**
23      * Instantiates a new sinope set point temp data.
24      */
25     public SinopeHeatLevelData() {
26         super(new byte[] { 0x00, 0x00, 0x02, 0x20 }, new byte[] { 0 });
27     }
28
29     /**
30      * Gets the room temp.
31      *
32      * @return the room temp
33      */
34     public int getHeatLevel() {
35         if (getData() != null) {
36             return getData()[0] & 0xFF;
37         }
38         return -273;
39     }
40
41     /**
42      * @see org.openhab.binding.sinope.internal.core.appdata.SinopeAppData#toString()
43      */
44     @Override
45     public String toString() {
46         StringBuilder sb = new StringBuilder();
47         sb.append(super.toString());
48         if (getData() != null) {
49             sb.append(String.format("\nHeat Level is %d %%", this.getHeatLevel()));
50         }
51         return sb.toString();
52     }
53 }