Skip to content

Commit

Permalink
[haywardomnilogic] Added support ColorLogic V2 Lights, Updated Chlor …
Browse files Browse the repository at this point in the history
…Enable, Alert, Error, Status (openhab#15478)

* Update polling times based on Hayward API recommendations

---------

Signed-off-by: Matt Myers <mmyers75@icloud.com>
  • Loading branch information
matchews committed Oct 18, 2024
1 parent 0541883 commit 173fe88
Show file tree
Hide file tree
Showing 26 changed files with 986 additions and 775 deletions.
65 changes: 53 additions & 12 deletions bundles/org.openhab.binding.haywardomnilogic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Hayward OmniLogic Connection Parameters:
| Host Name | <https://app1.haywardomnilogic.com/HAAPI/HomeAutomation/API.ash> | Yes | Host name of the Hayward API server |
| User Name | None | Yes | Your Hayward User Name (not email address) |
| Password | None | Yes | Your Hayward User Password |
| Telemetry Poll Delay | 12 | Yes | Telemetry Poll Delay (10-60 seconds) |
| Alarm Poll Delay | 60 | Yes | Alarm Poll Delay (0-120 seconds, 0 disabled) |
| Telemetry Poll Delay | 3 | Yes | Telemetry Poll Delay (2-60 seconds) |
| Alarm Poll Delay | 10 | Yes | Alarm Poll Delay (0-120 seconds, 0 disabled) |

## Channels

Expand Down Expand Up @@ -65,14 +65,53 @@ Hayward OmniLogic Connection Parameters:
|-----------------------|----------------------|----------------------------------------------------------|:----------:|
| chlorEnable | Switch | Chlorinator enable | R/W |
| chlorOperatingMode | String | Chlorinator operating mode | R |
| chlorTimedPercent | Number:Dimensionless | Chlorinator timed percent | R/W |
| chlorTimedPercent | Number:Dimensionless | Chlorinator salt output (%) | R/W |
| chlorOperatingState | Number | Chlorinator operating state | R |
| chlorScMode | String | Chlorinator super chlorinate mode | R |
| chlorError | Number | Chlorinator error | R |
| chlorAlert | String | Chlorinator alert | R |
| chlorError | String | Chlorinator error bit array | R |
| chlorAlert | String | Chlorinator alert bit array | R |
| chlorAvgSaltLevel | Number:Dimensionless | Chlorinator average salt level in Part per Million (ppm) | R |
| chlorInstantSaltLevel | Number:Dimensionless | Chlorinator instant salt level in Part per Million (ppm) | R |
| chlorStatus | Number | Chlorinator K1/K2 relay status | R |
| chlorStatus | String | Chlorinator status bit array | R |

### Chlorinator Error Bit Array

|Bits |Value |Description |
|------|--------------------------------------------------------------------|-------------------------------|
|1:0 |00 = OK<br> 01 = Short<br> 10 = Open |Current Sensor |
|3:2 |00 = OK<br> 01 = Short<br> 10 = Open |Voltage Sensor |
|5:4 |00 = OK<br> 01 = Short<br> 10 = Open |Cell Temp Sensor |
|7:6 |00 = OK<br> 01 = Short<br> 10 = Open |Board Temp Sensor |
|9:8 |00 = OK<br> 01 = Short<br> 10 = Open |K1 Relay |
|11:10 |00 = OK<br> 01 = Short<br> 10 = Open |K2 Relay |
|13:12 |00 = OK<br> 01 = Type<br> 10 = Authentication <br> 11 = Comm Loss |Cell Errors |
|14 |0 |Aquarite PCB Error |

### Chlorinator Alert Bit Array

|Bits |Value |Description |
|------|--------------------------------------------------------------------|-------------------------------|
|1:0 |00 = OK<br> 01 = Salt Low<br> 10 = Salt too Low |Low salt |
|2 |0 = OK<br> 1 = High |High Current |
|3 |0 = OK<br> 1 = Low |Low Voltage |
|5:4 |00 = OK<br> 01 = Low<br> 10 = Scaleback<br> 11 = High |Cell Water Temp |
|7:6 |00 = OK<br> 01 = High<br> 10 = Clearing |Board Temp |
|8 |0 |Not Used |
|10:9 |0 |Not Used |
|12:11 |00 = OK<br> 01 = Clean |Cell Cleaning/Runtime |

### Chlorinator Status Bit Array

|Bits |Value |Description |
|------|----------------------------------------------------------------|-------------------------------|
|0 |0 = OK<br>1 = Error Present |Error Present |
|1 |0 = OK<br>1 = Alert Present |Alert Present |
|2 |0 = Standy<br>1 = Generating |Generating |
|3 |0 = Not Paused<br>1 = Paused<br> |Paused |
|4 |0 = Local Not Paused<br>1 = Local Paused<br> |Local Pause |
|5 |0 = Not Authenticated<><BR>1 = Authenticated |T-Cell Authenticated |
|6 |0 = K1 Relay Off<br> 1 = K1 Relay On |K1 Relay Active |
|7 |0 = K2 Relay Off<br> 1 = K2 Relay On |K2 Relay Active |

### Colorlogic Light Channels

Expand All @@ -88,11 +127,11 @@ Hayward OmniLogic Connection Parameters:
|---------------------|----------------------|------------------------|:----------:|
| filterEnable | Switch | Filter enable | R/W |
| filterValvePosition | String | Filter valve position | R |
| filterSpeedPercent | Number:Dimensionless | Filter speed in % | R/W |
| filterSpeedRpm | Number | Filter speed in RPM | R/W |
| filterSpeedPercent | Number:Dimensionless | Filter speed (%) | R/W |
| filterSpeedRpm | Number:Frequency | Filter speed (rpm) | R/W |
| filterSpeedSelect | String | Filter speed presets | R/W |
| filterState | String | Filter state | R |
| filterLastSpeed | Number:Dimensionless | Filter last speed in % | R |
| filterLastSpeed | Number:Dimensionless | Filter last speed (%) | R |

### Heater Channels

Expand All @@ -106,11 +145,11 @@ Hayward OmniLogic Connection Parameters:
| Channel Type ID | Item Type | Description | Read Write |
|------------------|----------------------|----------------------|:----------:|
| pumpEnable | Switch | Pump enable | R/W |
| pumpSpeedPercent | Number:Dimensionless | Pump speed in % | R/W |
| pumpSpeedRpm | Number | Pump speed in RPM | R/W |
| pumpSpeedPercent | Number:Dimensionless | Pump speed (%) | R/W |
| pumpSpeedRpm | Number: Frequency | Pump speed in rpm | R/W |
| pumpSpeedSelect | String | Pump speed presets | R/W |
| pumpState | String | Pump state | R |
| pumpLastSpeed | Number:Dimensionless | Pump last speed in % | R |
| pumpLastSpeed | Number:Dimensionless | Pump last speed (%) | R |

### Relay Channels

Expand All @@ -125,6 +164,8 @@ Hayward OmniLogic Connection Parameters:
| heaterEnable | Switch | Heater enable | R |
| heaterCurrentSetpoint | Number:Temperature | Heater Current Setpoint | R/W |

**Item Types Number:Dimensionless should have the units (i.e. %, ppm) defined in the Unit metadata

## Full Example

After installing the binding, you will need to manually add the Hayward Connection thing and enter your credentials.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
@NonNullByDefault
public class HaywardBindingConstants {

private static final String BINDING_ID = "haywardomnilogic";
public static final String BINDING_ID = "haywardomnilogic";

// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_BACKYARD = new ThingTypeUID(BINDING_ID, "backyard");
Expand Down Expand Up @@ -87,8 +87,13 @@ public class HaywardBindingConstants {

// List of all Channel ids (colorlogic)
public static final String CHANNEL_COLORLOGIC_ENABLE = "colorLogicLightEnable";
public static final String CHANNEL_COLORLOGIC_LIGHTSTATE = "colorLogicLightState";
public static final String CHANNEL_COLORLOGIC_STATE = "colorLogicLightState";
public static final String CHANNEL_COLORLOGIC_CURRENTSHOW = "colorLogicLightCurrentShow";
public static final String CHANNEL_COLORLOGIC_BRIGHTNESS = "colorLogicLightBrightness";
public static final String CHANNEL_COLORLOGIC_SPEED = "colorLogicLightSpeed";

public static final String TYPE_COLORLOGIC_LIGHTBRIGHTNESS = "lightBrightness";
public static final String TYPE_COLORLOGIC_LIGHTSPEED = "lightSpeed";

public static final String PROPERTY_COLORLOGIC_TYPE = "colorlogicType";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ public HaywardHandlerFactory(final @Reference HaywardDynamicStateDescriptionProv
}
if (thingTypeUID.equals(HaywardBindingConstants.THING_TYPE_RELAY)) {
return new HaywardRelayHandler(thing);

}
if (thingTypeUID.equals(HaywardBindingConstants.THING_TYPE_VIRTUALHEATER)) {
return new HaywardVirtualHeaterHandler(thing);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,19 @@ public State toState(String type, String channelID, String value) throws NumberF
return new QuantityType<>(Integer.parseInt(value), Units.PERCENT);
case HaywardBindingConstants.CHANNEL_FILTER_SPEEDPERCENT:
return new QuantityType<>(Integer.parseInt(value), Units.PERCENT);
case HaywardBindingConstants.CHANNEL_FILTER_SPEEDRPM:
case HaywardBindingConstants.CHANNEL_PUMP_LASTSPEED:
return new QuantityType<>(Integer.parseInt(value), Units.PERCENT);
case HaywardBindingConstants.CHANNEL_PUMP_SPEEDPERCENT:
return new QuantityType<>(Integer.parseInt(value), Units.PERCENT);
case HaywardBindingConstants.CHANNEL_PUMP_SPEEDRPM:
}
return StringType.valueOf(value);
case "Number:Frequency":
switch (channelID) {
case HaywardBindingConstants.CHANNEL_FILTER_SPEEDRPM:
return new QuantityType<>(Integer.parseInt(value), Units.RPM);
case HaywardBindingConstants.CHANNEL_PUMP_SPEEDRPM:
return new QuantityType<>(Integer.parseInt(value), Units.RPM);
}
case "Number:Temperature":
Bridge bridge = getBridge();
if (bridge != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ public synchronized void mspConfigDiscovery(String xmlResponse) {
final List<String> colorLogicProperty1 = thingHandler.evaluateXPath("//Backyard//ColorLogic-Light/Type/text()",
xmlResponse);

final List<String> colorLogicProperty2 = thingHandler
.evaluateXPath("//Backyard//ColorLogic-Light/V2-Active/text()", xmlResponse);

for (int i = 0; i < colorLogicProperty2.size(); i++) {
if (colorLogicProperty1.get(i).equals("COLOR_LOGIC_UCL") && colorLogicProperty2.get(i).equals("yes")) {
colorLogicProperty1.set(i, "COLOR_LOGIC_UCL_V2");
}
}

discoverDevices(thingHandler, xmlResponse, "ColorLogic-Light", HaywardTypeToRequest.COLORLOGIC,
HaywardBindingConstants.THING_TYPE_COLORLOGIC, (props, i) -> {
props.put(HaywardBindingConstants.PROPERTY_COLORLOGIC_TYPE, colorLogicProperty1.get(i));
Expand Down
Loading

0 comments on commit 173fe88

Please sign in to comment.