2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.pentair.internal;
16 * Pentair status packet specialation of a PentairPacket. Includes public variables for many of the reverse engineered
19 * @author Jeff James - initial contribution
22 public class PentairPacketStatus extends PentairPacket { // 29 byte packet format
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;
39 /** hour byte of packet */
41 /** minute byte of packet */
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;
48 /** Unit of Measure - Celsius = true, Farenheit = false */
51 /** pool temperature */
53 /** spa temperature */
55 /** air temperature */
57 /** solar temperature */
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;
67 /** used to store packet value for reverse engineering, not used in normal operation */
71 * Constructor to create a specialized packet representing the generic packet. Note, the internal buffer array is
73 * duplicated. Fills in public class members appropriate with the correct values.
75 * @param p Generic PentairPacket to create specific Status packet
77 public PentairPacketStatus(PentairPacket p) {
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;
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;
101 uom = (buf[UOM] & 0x04) != 0;
103 diag = buf[HEATACTIVE];
105 pooltemp = buf[POOL_TEMP];
106 spatemp = buf[SPA_TEMP];
107 airtemp = buf[AIR_TEMP];
108 solartemp = buf[SOLAR_TEMP];
110 spaheatmode = (buf[HEATMODE] >> 2) & 0x03;
111 poolheatmode = buf[HEATMODE] & 0x03;
112 heatactive = buf[HEATACTIVE];
116 * Constructure to create an empty status packet
118 public PentairPacketStatus() {