[draytonwiser] Add comfort mode option to boiler controller (#9649)

Signed-off-by: Andrew Schofield <the.uncle.fungus@gmail.com>
This commit is contained in:
Andrew Schofield 2021-01-02 19:58:16 +00:00 committed by GitHub
parent 10d2ab2079
commit d133959abf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 4 deletions

View File

@ -121,10 +121,11 @@ The `awaySetPoint` defines the temperature in degrees Celsius that will be sent
#### Boiler Controller
| Channel | Item Type | Description |
|-----------------|-----------|----------------------------|
| `awayModeState` | Switch | Has away mode been enabled |
| `ecoModeState` | Switch | Has eco mode been enabled |
| Channel | Item Type | Description |
|--------------------|-----------|-------------------------------|
| `awayModeState` | Switch | Has away mode been enabled |
| `ecoModeState` | Switch | Has eco mode been enabled |
| `comfortModeState` | Switch | Has comfort mode been enabled |
#### Hot Water

View File

@ -104,6 +104,7 @@ public class DraytonWiserBindingConstants {
public static final String CHANNEL_DEVICE_LOCKED = "deviceLocked";
public static final String CHANNEL_SMARTPLUG_OUTPUT_STATE = "plugOutputState";
public static final String CHANNEL_SMARTPLUG_AWAY_ACTION = "plugAwayAction";
public static final String CHANNEL_COMFORT_MODE_STATE = "comfortModeState";
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections
.unmodifiableSet(new HashSet<>(Arrays.asList(THING_TYPE_CONTROLLER, THING_TYPE_ROOM, THING_TYPE_ROOMSTAT,

View File

@ -171,6 +171,11 @@ public class DraytonWiserApi {
sendMessageToHeatHub(SMARTPLUG_ENDPOINT + id, "PATCH", payload);
}
public void setComfortMode(final boolean comfortMode) throws DraytonWiserApiException {
final String payload = "{\"ComfortModeEnabled\":" + comfortMode + "}";
sendMessageToHeatHub(SYSTEM_ENDPOINT, "PATCH", payload);
}
private synchronized @Nullable ContentResponse sendMessageToHeatHub(final String path, final HttpMethod method)
throws DraytonWiserApiException {
return sendMessageToHeatHub(path, method.asString(), "");

View File

@ -60,6 +60,8 @@ public class ControllerHandler extends DraytonWiserThingHandler<ControllerData>
setAwayMode(onOffState);
} else if (CHANNEL_ECO_MODE_STATE.equals(channelId)) {
setEcoMode(onOffState);
} else if (CHANNEL_COMFORT_MODE_STATE.equals(channelId)) {
setComfortMode(onOffState);
}
}
}
@ -76,6 +78,7 @@ public class ControllerHandler extends DraytonWiserThingHandler<ControllerData>
updateState(CHANNEL_HEATCHANNEL_2_DEMAND_STATE, this::getHeatChannel2DemandState);
updateState(CHANNEL_AWAY_MODE_STATE, this::getAwayModeState);
updateState(CHANNEL_ECO_MODE_STATE, this::getEcoModeState);
updateState(CHANNEL_COMFORT_MODE_STATE, this::getComfortModeState);
}
@Override
@ -139,6 +142,11 @@ public class ControllerHandler extends DraytonWiserThingHandler<ControllerData>
return OnOffType.from(getData().system.getEcoModeEnabled() != null && getData().system.getEcoModeEnabled());
}
private State getComfortModeState() {
return OnOffType
.from(getData().system.getComfortModeEnabled() != null && getData().system.getComfortModeEnabled());
}
private void setAwayMode(final Boolean awayMode) throws DraytonWiserApiException {
getApi().setAwayMode(awayMode);
}
@ -147,6 +155,10 @@ public class ControllerHandler extends DraytonWiserThingHandler<ControllerData>
getApi().setEcoMode(ecoMode);
}
private void setComfortMode(final Boolean comfortMode) throws DraytonWiserApiException {
getApi().setComfortMode(comfortMode);
}
static class ControllerData {
public final DeviceDTO device;
public final SystemDTO system;

View File

@ -26,6 +26,7 @@ public class SystemDTO {
private Boolean fotaEnabled;
private Boolean valveProtectionEnabled;
private Boolean ecoModeEnabled;
private Boolean comfortModeEnabled;
private BoilerSettingsDTO boilerSettings;
private Long unixTime;
private String cloudConnectionStatus;
@ -162,4 +163,12 @@ public class SystemDTO {
public void setHotWaterButtonOverrideState(final String hotWaterButtonOverrideState) {
this.hotWaterButtonOverrideState = hotWaterButtonOverrideState;
}
public Boolean getComfortModeEnabled() {
return comfortModeEnabled;
}
public void setComfortModeEnabled(final Boolean comfortModeEnabled) {
this.comfortModeEnabled = comfortModeEnabled;
}
}

View File

@ -62,6 +62,7 @@
<channel id="currentSignalRSSI" typeId="signalRSSI-channel"/>
<channel id="currentSignalStrength" typeId="system.signal-strength"/>
<channel id="currentWiserSignalStrength" typeId="wiserSignalStrength-channel"/>
<channel id="comfortModeState" typeId="comfortModeState-channel"/>
</channels>
<representation-property>id</representation-property>
@ -422,4 +423,10 @@
<description>Should the smart plug switch off when in away mode</description>
</channel-type>
<channel-type id="comfortModeState-channel">
<item-type>Switch</item-type>
<label>Comfort Mode Active</label>
<description>Should the room pre-heat to achieve the desired temperature</description>
</channel-type>
</thing:thing-descriptions>