]> git.basschouten.com Git - openhab-addons.git/blob
ef102ad7e3fa10281b63ee62cea96ee445de4e71
[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.pentair.internal;
14
15 /**
16  * Pentair status packet specialation of a PentairPacket. Includes public variables for many of the reverse engineered
17  * packet content.
18  *
19  * @author Jeff James - initial contribution
20  *
21  */
22 public class PentairPacketStatus extends PentairPacket { // 29 byte packet format
23
24     protected static final int HOUR = 4 + OFFSET;
25     protected static final int MIN = 5 + OFFSET;
26     protected static final int EQUIP1 = 6 + OFFSET;
27     protected static final int EQUIP2 = 7 + OFFSET;
28     protected static final int EQUIP3 = 8 + OFFSET;
29     protected static final int UOM = 13 + OFFSET; // Celsius (0x04) or Farenheit
30     protected static final int VALVES = 14 + OFFSET; // Not sure what this actually is? Doesn't seem to be valves
31     protected static final int UNKNOWN = 17 + OFFSET; // Something to do with heat?
32     protected static final int POOL_TEMP = 18 + OFFSET;
33     protected static final int SPA_TEMP = 19 + OFFSET;
34     protected static final int HEATACTIVE = 20 + OFFSET; // Does not seem to toggle for my system
35     protected static final int AIR_TEMP = 22 + OFFSET;
36     protected static final int SOLAR_TEMP = 23 + OFFSET;
37     protected static final int HEATMODE = 26 + OFFSET;
38
39     /** hour byte of packet */
40     public int hour;
41     /** minute byte of packet */
42     public int min;
43
44     /** Individual boolean values representing whether a particular ciruit is on or off */
45     public boolean pool, spa, aux1, aux2, aux3, aux4, aux5, aux6, aux7;
46     public boolean feature1, feature2, feature3, feature4, feature5, feature6, feature7, feature8;
47
48     /** Unit of Measure - Celsius = true, Farenheit = false */
49     public boolean uom;
50
51     /** pool temperature */
52     public int pooltemp;
53     /** spa temperature */
54     public int spatemp;
55     /** air temperature */
56     public int airtemp;
57     /** solar temperature */
58     public int solartemp;
59
60     /** spa heat mode - 0 = Off, 1 = Heater, 2 = Solar Pref, 3 = Solar */
61     public int spaheatmode;
62     /** pool heat mode - 0 = Off, 1 = Heater, 2 = Solar Pref, 3 = Solar */
63     public int poolheatmode;
64     /** Heat is currently active - note this does not work for my system, but has been documented on the internet */
65     public int heatactive;
66
67     /** used to store packet value for reverse engineering, not used in normal operation */
68     public int diag;
69
70     /**
71      * Constructor to create a specialized packet representing the generic packet. Note, the internal buffer array is
72      * not
73      * duplicated. Fills in public class members appropriate with the correct values.
74      *
75      * @param p Generic PentairPacket to create specific Status packet
76      */
77     public PentairPacketStatus(PentairPacket p) {
78         super(p);
79
80         hour = buf[HOUR];
81         min = buf[MIN];
82         pool = (buf[EQUIP1] & 0x20) != 0;
83         spa = (buf[EQUIP1] & 0x01) != 0;
84         aux1 = (buf[EQUIP1] & 0x02) != 0;
85         aux2 = (buf[EQUIP1] & 0x04) != 0;
86         aux3 = (buf[EQUIP1] & 0x08) != 0;
87         aux4 = (buf[EQUIP1] & 0x10) != 0;
88         aux5 = (buf[EQUIP1] & 0x40) != 0;
89         aux6 = (buf[EQUIP1] & 0x80) != 0;
90         aux7 = (buf[EQUIP2] & 0x01) != 0;
91
92         feature1 = (buf[EQUIP2] & 0x04) != 0;
93         feature2 = (buf[EQUIP2] & 0x08) != 0;
94         feature3 = (buf[EQUIP2] & 0x10) != 0;
95         feature4 = (buf[EQUIP2] & 0x20) != 0;
96         feature5 = (buf[EQUIP2] & 0x40) != 0;
97         feature6 = (buf[EQUIP2] & 0x80) != 0;
98         feature7 = (buf[EQUIP3] & 0x01) != 0;
99         feature8 = (buf[EQUIP3] & 0x02) != 0;
100
101         uom = (buf[UOM] & 0x04) != 0;
102
103         diag = buf[HEATACTIVE];
104
105         pooltemp = buf[POOL_TEMP];
106         spatemp = buf[SPA_TEMP];
107         airtemp = buf[AIR_TEMP];
108         solartemp = buf[SOLAR_TEMP];
109
110         spaheatmode = (buf[HEATMODE] >> 2) & 0x03;
111         poolheatmode = buf[HEATMODE] & 0x03;
112         heatactive = buf[HEATACTIVE];
113     }
114
115     /**
116      * Constructure to create an empty status packet
117      */
118     public PentairPacketStatus() {
119         super();
120     }
121 }