Skip to content

Commit

Permalink
Add domesticHotWaterTank with items Readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
adr001db committed Oct 15, 2023
1 parent 5d28ce5 commit f8d2c64
Show file tree
Hide file tree
Showing 16 changed files with 979 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class OnectaBridgeConstants {
// List of all Device Types
public static final String DEVICE = "device";
public static final String GATEWAY = "gateway";
public static final String WATERTANK = "domesticHotWaterTank";
public static final String CHANNEL_REFRESH_TOKEN = "refreshToken";
public static final String CHANNEL_PASSWORD = "password";
public static final String CHANNEL_USERID = "userId";
Expand All @@ -43,4 +44,5 @@ public class OnectaBridgeConstants {
// List of all Thing Type UIDs
public static final ThingTypeUID DEVICE_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE);
public static final ThingTypeUID GATEWAY_THING_TYPE = new ThingTypeUID(BINDING_ID, GATEWAY);
public static final ThingTypeUID WATERTANK_THING_TYPE = new ThingTypeUID(BINDING_ID, WATERTANK);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.openhab.binding.onecta.internal.handler.OnectaBridgeHandler;
import org.openhab.binding.onecta.internal.handler.OnectaDeviceHandler;
import org.openhab.binding.onecta.internal.handler.OnectaGatewayHandler;
import org.openhab.binding.onecta.internal.handler.OnectaWaterTankHandler;
import org.openhab.binding.onecta.internal.service.DeviceDiscoveryService;
import org.openhab.core.config.discovery.DiscoveryService;
import org.openhab.core.i18n.TimeZoneProvider;
Expand Down Expand Up @@ -52,7 +53,7 @@
public class OnectaBridgeHandlerFactory extends BaseThingHandlerFactory {

private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(BRIDGE_THING_TYPE, DEVICE_THING_TYPE,
GATEWAY_THING_TYPE);
GATEWAY_THING_TYPE, WATERTANK_THING_TYPE);
private HttpClientFactory httpClientFactory;
private final TimeZoneProvider timeZoneProvider;

Expand Down Expand Up @@ -97,6 +98,8 @@ public boolean supportsThingType(ThingTypeUID thingTypeUID) {
return new OnectaDeviceHandler(thing);
} else if (thingTypeUID.equals((GATEWAY_THING_TYPE))) {
return new OnectaGatewayHandler(thing);
} else if (thingTypeUID.equals((WATERTANK_THING_TYPE))) {
return new OnectaWaterTankHandler(thing);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@ public class OnectaGatewayConstants {
public static final String CHANNEL_GW_TIME_ZONE = "basic#timezone";
public static final String CHANNEL_GW_WIFICONNENTION_SSID = "basic#wificonnectionssid";
public static final String CHANNEL_GW_WIFICONNENTION_STRENGTH = "basic#wificonnectionpower";

public static final String PROPERTY_GW_NAME = "name";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* Copyright (c) 2010-2023 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.onecta.internal;

import org.eclipse.jdt.annotation.NonNullByDefault;

/**
* The {@link OnectaWaterTankConstant} class defines common constants, which are
* used across the whole binding.
*
* @author Alexander Drent - Initial contribution
*/
@NonNullByDefault
public class OnectaWaterTankConstant {

// List of all Channel ids

public static final String CHANNEL_HWT_POWER = "basic#power";
public static final String CHANNEL_HWT_ERRORCODE = "basic#errorcode";
public static final String CHANNEL_HWT_IS_HOLIDAY_MODE_ACTIVE = "basic#isholidaymodeactive";
public static final String CHANNEL_HWT_IS_IN_ERROR_STATE = "basic#isinerrorstate";
public static final String CHANNEL_HWT_IS_IN_WARNING_STATE = "basic#isinwarningstate";
public static final String CHANNEL_HWT_IS_IN_INSTALLER_STATE = "basic#isininstallerstate";
public static final String CHANNEL_HWT_IS_IN_EMERGENCY_STATE = "basic#isinemergencystate";
public static final String CHANNEL_HWT_IS_POWERFUL_MODE_ACTIVE = "basic#ispowerfulmodeactive";
public static final String CHANNEL_HWT_POWERFUL_MODE = "basic#powerfulmode";
public static final String CHANNEL_HWT_HEATUP_MODE = "basic#heatupmode";
public static final String CHANNEL_HWT_TANK_TEMPERATURE = "basic#tanktemperature";
public static final String CHANNEL_HWT_OPERATION_MODE = "basic#operationmode";
public static final String CHANNEL_HWT_SETPOINT_MODE = "basic#setpointmode";
public static final String CHANNEL_HWT_SETTEMP = "basic#settemp";
public static final String CHANNEL_HWT_SETTEMP_MIN = "basic#settempmin";
public static final String CHANNEL_HWT_SETTEMP_MAX = "basic#settempmax";
public static final String CHANNEL_HWT_SETTEMP_STEP = "basic#settempstep";
public static final String PROPERTY_HWT_NAME = "name";
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,73 @@ public static OperationMode fromValue(String value) {
}
}

public enum HeatupMode {
UNKNOWN(""),
REHEATONLY("reheatOnly"),
SCHEDULEONLY("scheduleOnly"),
REHEATSCHEDULE("reheatSchedule");

private static final Logger LOGGER = LoggerFactory.getLogger(HeatupMode.class);
private final String value;

HeatupMode(String value) {
this.value = value;
}

public String getValue() {
return value;
}

public static HeatupMode fromValue(String value) {
for (HeatupMode m : HeatupMode.values()) {
if (m.getValue().equals(value)) {
return m;
}
}

LOGGER.debug("Unexpected Mode value of \"{}\"", value);

// Default to auto
return UNKNOWN;
}
}

public enum SetpointMode {
UNKNOWN(""),
WEATHERDEPENDENT("weatherDependent"),
FIXED("fixed");

private static final Logger LOGGER = LoggerFactory.getLogger(SetpointMode.class);
private final String value;

SetpointMode(String value) {
this.value = value;
}

public String getValue() {
return value;
}

public static SetpointMode fromValue(String value) {
for (SetpointMode m : SetpointMode.values()) {
if (m.getValue().equals(value)) {
return m;
}
}

LOGGER.debug("Unexpected Mode value of \"{}\"", value);

// Default to auto
return UNKNOWN;
}
}

public enum ManagementPoint {
GATEWAY("gateway"),
CLIMATECONTROL("climateControl"),
INDOORUNIT("indoorUnit"),
OUTDOORUNIT("outdoorUnit");
OUTDOORUNIT("outdoorUnit"),
WATERTANK("domesticHotWaterTank");

private final String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,25 @@ public class ManagementPoint {
// @SerializedName("_id")
// private DtoIsCloudConnectionUp isCoolHeatMaster;
//
// @SerializedName("_id")
// private DtoIsCloudConnectionUp isHolidayModeActive;
@SerializedName("isHolidayModeActive")
private GatwaySubValueBoolean isHolidayModeActive;

@SerializedName("isInEmergencyState")
private GatwaySubValueBoolean isInEmergencyState;
//
// @SerializedName("_id")
// private DtoIsCloudConnectionUp isInCautionState;
//
// @SerializedName("_id")
// private DtoIsCloudConnectionUp isInModeConflict;
//
// @SerializedName("_id")
// private DtoIsCloudConnectionUp isInWarningState;
//
// @SerializedName("_id")
// private DtoIsCloudConnectionUp isLockFunctionEnabled;
@SerializedName("heatupMode")
private GatwaySubValueString heatupMode;
@SerializedName("setpointMode")
private GatwaySubValueString setpointMode;

@SerializedName("isInWarningState")
private GatwaySubValueBoolean isInWarningState;

@SerializedName("isInInstallerState")
private GatwaySubValueBoolean isInInstallerState;
//
@SerializedName("name")
private Name name;
Expand Down Expand Up @@ -154,6 +159,18 @@ public GatwaySubValueBoolean getIsInErrorState() {
return isInErrorState;
}

public GatwaySubValueBoolean getisInWarningState() {
return isInWarningState;
}

public GatwaySubValueBoolean getIsInInstallerState() {
return isInInstallerState;
}

public GatwaySubValueBoolean getIsInWarningState() {
return isInWarningState;
}

public GatwaySubValueBoolean getIsLedEnabled() {
return ledEnabled;
}
Expand Down Expand Up @@ -206,6 +223,14 @@ public HolidayMode getHolidayMode() {
return holidayMode;
}

public GatwaySubValueBoolean getisHolidayModeActive() {
return isHolidayModeActive;
}

public GatwaySubValueBoolean getIsInEmergencyState() {
return isInEmergencyState;
}

public Name getName() {
return name;
}
Expand All @@ -222,6 +247,14 @@ public GatwaySubValueString getOperationMode() {
return operationMode;
}

public GatwaySubValueString getHeatupMode() {
return heatupMode;
}

public GatwaySubValueString getSetpointMode() {
return setpointMode;
}

public IconID getTargetTemperature() {
return targetTemperature;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public class SensoryDataValue {
private IconID outdoorTemperature;
@SerializedName("leavingWaterTemperature")
private IconID leavingWaterTemperature;
@SerializedName("tankTemperature")
private IconID tankTemperature;

public IconID getRoomTemperature() {
return roomTemperature;
Expand All @@ -30,6 +32,10 @@ public IconID getLeavingWaterTemperature() {
return leavingWaterTemperature;
}

public IconID getTankTemperature() {
return tankTemperature;
}

public IconID getSensorData(Enums.SensorData sensorData) {

if (sensorData.getValue() == Enums.SensorData.ROOMTEMP.getValue()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class Setpoints {
private IconID leavingWaterTemperature;
private IconID leavingWaterOffset;

private IconID domesticHotWaterTemperature;

public IconID getRoomTemperature() {
return roomTemperature;
}
Expand All @@ -21,4 +23,8 @@ public IconID getLeavingWaterTemperature() {
public IconID getLeavingWaterOffset() {
return leavingWaterOffset;
}

public IconID getdomesticHotWaterTemperature() {
return domesticHotWaterTemperature;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ private void pollDevices() {
} else if (t.getThingTypeUID().equals(GATEWAY_THING_TYPE)) {
OnectaGatewayHandler onectaGatewayHandler = (OnectaGatewayHandler) t.getHandler();
onectaGatewayHandler.refreshDevice();
} else if (t.getThingTypeUID().equals(WATERTANK_THING_TYPE)) {
OnectaWaterTankHandler onectaWaterTankHandler = (OnectaWaterTankHandler) t.getHandler();
onectaWaterTankHandler.refreshDevice();
} else
continue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ private State getIndoorTemperature() {

private State getLeavingWaterTemperatur() {
try {
return new DecimalType(dataTransService.getLeavingWaterTemperatur());
return new DecimalType(dataTransService.getLeavingWaterTemperature());
} catch (Exception e) {
return UnDefType.UNDEF;
}
Expand Down
Loading

0 comments on commit f8d2c64

Please sign in to comment.