From d85c2532e4d5604c3926a054730a5fba629344bb Mon Sep 17 00:00:00 2001 From: lsiepel Date: Fri, 9 Dec 2022 19:30:08 +0100 Subject: [PATCH] Add channel return temp (#13833) Signed-off-by: Leo Siepel --- bundles/org.openhab.binding.plugwiseha/README.md | 14 ++++++++------ .../internal/PlugwiseHABindingConstants.java | 1 + .../internal/api/model/dto/Appliance.java | 8 ++++++++ .../plugwiseha/internal/api/model/dto/Logs.java | 9 +++++++++ .../handler/PlugwiseHAApplianceHandler.java | 9 +++++++++ .../resources/OH-INF/i18n/plugwiseha.properties | 2 ++ .../src/main/resources/OH-INF/thing/channels.xml | 8 ++++++++ .../main/resources/OH-INF/thing/thing-types.xml | 1 + 8 files changed, 46 insertions(+), 6 deletions(-) diff --git a/bundles/org.openhab.binding.plugwiseha/README.md b/bundles/org.openhab.binding.plugwiseha/README.md index 22e86da08b478..093da9c8184ba 100644 --- a/bundles/org.openhab.binding.plugwiseha/README.md +++ b/bundles/org.openhab.binding.plugwiseha/README.md @@ -153,17 +153,18 @@ Switch main_boiler_chState "Heating active" { channel="plugwiseha:appliance_boil Switch main_boiler_dhwState "Domestic hot water active" { channel="plugwiseha:appliance_boiler:home:main_boiler:dhwState"} Switch main_boiler_coolingState "Cooling state" { channel="plugwiseha:appliance_boiler:home:main_boiler:coolingState"} -Number:Temperature main_boiler_intendedBoilerTemp "Intended boiler temperature" {channel="plugwiseha:appliance_boiler:home:living_room_thermostat:intendedBoilerTemp"} +Number:Temperature main_boiler_intendedBoilerTemp "Intended boiler temperature" {channel="plugwiseha:appliance_boiler:home:main_boiler:intendedBoilerTemp"} Switch main_boiler_flameState "Flame state" { channel="plugwiseha:appliance_boiler:home:main_boiler:flameState"} Switch main_boiler_intendedHeatingState "Intended heating state" { channel="plugwiseha:appliance_boiler:home:main_boiler:intendedHeatingState"} Number main_boiler_modulationLevel "Modulation level" {channel="plugwiseha:appliance_boiler:home:living_room_radiator:modulationLevel"} Number main_boiler_otAppFaultCode "Opentherm app. faultcode" {channel="plugwiseha:appliance_boiler:home:living_room_radiator:otAppFaultCode"} -Number:Temperature main_boiler_dhwTemperature "DHW temperature" {channel="plugwiseha:appliance_boiler:home:living_room_thermostat:dhwTemperature"} -Number main_boiler_otOEMFaultCode "Opentherm OEM faultcode" {channel="plugwiseha:appliance_boiler:home:living_room_radiator:otOEMFaultCode"} -Number:Temperature main_boiler_boilerTemperature "Boiler temperature" {channel="plugwiseha:appliance_boiler:home:living_room_thermostat:boilerTemperature"} -Number:Temperature main_boiler_dhwSetpoint "DHW setpoint" {channel="plugwiseha:appliance_boiler:home:living_room_thermostat:dhwSetpoint"} -Number:Temperature main_boiler_maxBoilerTemperature "Max. boiler temperature" {channel="plugwiseha:appliance_boiler:home:living_room_thermostat:maxBoilerTemperature"} +Number:Temperature main_boiler_dhwTemperature "DHW temperature" {channel="plugwiseha:appliance_boiler:home:main_boiler:dhwTemperature"} +Number main_boiler_otOEMFaultCode "Opentherm OEM faultcode" {channel="plugwiseha:appliance_boiler:home:main_boiler:otOEMFaultCode"} +Number:Temperature main_boiler_boilerTemperature "Boiler temperature" {channel="plugwiseha:appliance_boiler:home:main_boiler:boilerTemperature"} +Number:Temperature main_boiler_dhwSetpoint "DHW setpoint" {channel="plugwiseha:appliance_boiler:home:main_boiler:dhwSetpoint"} +Number:Temperature main_boiler_maxBoilerTemperature "Max. boiler temperature" {channel="plugwiseha:appliance_boiler:home:main_boiler:maxBoilerTemperature"} Switch main_boiler_dhwComfortMode "DHW comfort mode" { channel="plugwiseha:appliance_boiler:home:main_boiler:dhwComfortMode"} +Number:Temperature main_boiler_returnTemperature "Boiler return temperature" {channel="plugwiseha:appliance_boiler:home:main_boiler:returnWaterTemperature"} ``` **transform/plugwiseha.map** @@ -214,6 +215,7 @@ sitemap plugwiseha label="PlugwiseHA Binding" Number item=main_boiler_dhwSetpoint Number item=main_boiler_maxBoilerTemperature Switch item=main_boiler_dhwComfortMode + Number item=main_boiler_returnTemperature } } ``` diff --git a/bundles/org.openhab.binding.plugwiseha/src/main/java/org/openhab/binding/plugwiseha/internal/PlugwiseHABindingConstants.java b/bundles/org.openhab.binding.plugwiseha/src/main/java/org/openhab/binding/plugwiseha/internal/PlugwiseHABindingConstants.java index 49b77e4370557..043ecfafac35d 100644 --- a/bundles/org.openhab.binding.plugwiseha/src/main/java/org/openhab/binding/plugwiseha/internal/PlugwiseHABindingConstants.java +++ b/bundles/org.openhab.binding.plugwiseha/src/main/java/org/openhab/binding/plugwiseha/internal/PlugwiseHABindingConstants.java @@ -116,6 +116,7 @@ public class PlugwiseHABindingConstants { public static final String APPLIANCE_DHWSETPOINT_CHANNEL = "dhwSetpoint"; public static final String APPLIANCE_MAXBOILERTEMPERATURE_CHANNEL = "maxBoilerTemperature"; public static final String APPLIANCE_DHWCOMFORTMODE_CHANNEL = "dhwComfortMode"; + public static final String APPLIANCE_RETURNWATERTEMPERATURE_CHANNEL = "returnWaterTemperature"; // List of all Appliance Types public static final String APPLIANCE_TYPE_THERMOSTAT = "thermostat"; diff --git a/bundles/org.openhab.binding.plugwiseha/src/main/java/org/openhab/binding/plugwiseha/internal/api/model/dto/Appliance.java b/bundles/org.openhab.binding.plugwiseha/src/main/java/org/openhab/binding/plugwiseha/internal/api/model/dto/Appliance.java index 3c24e0547acd4..e71a329530bb9 100644 --- a/bundles/org.openhab.binding.plugwiseha/src/main/java/org/openhab/binding/plugwiseha/internal/api/model/dto/Appliance.java +++ b/bundles/org.openhab.binding.plugwiseha/src/main/java/org/openhab/binding/plugwiseha/internal/api/model/dto/Appliance.java @@ -156,6 +156,14 @@ public Optional getIntendedBoilerTempUnit() { return this.pointLogs.getIntendedBoilerTempUnit(); } + public Optional getReturnWaterTemp() { + return this.pointLogs.getReturnWaterTemp(); + } + + public Optional getReturnWaterTempUnit() { + return this.pointLogs.getReturnWaterTempUnit(); + } + public Optional getFlameState() { return this.pointLogs.getFlameState(); } diff --git a/bundles/org.openhab.binding.plugwiseha/src/main/java/org/openhab/binding/plugwiseha/internal/api/model/dto/Logs.java b/bundles/org.openhab.binding.plugwiseha/src/main/java/org/openhab/binding/plugwiseha/internal/api/model/dto/Logs.java index 877cb67c613bb..f80b2ba081c53 100644 --- a/bundles/org.openhab.binding.plugwiseha/src/main/java/org/openhab/binding/plugwiseha/internal/api/model/dto/Logs.java +++ b/bundles/org.openhab.binding.plugwiseha/src/main/java/org/openhab/binding/plugwiseha/internal/api/model/dto/Logs.java @@ -47,6 +47,7 @@ public class Logs extends PlugwiseHACollection { private static final String CHSTATE = "central_heating_state"; private static final String VALVE_POSITION = "valve_position"; private static final String WATER_PRESSURE = "central_heater_water_pressure"; + private static final String RETURNWATERTEMP = "return_water_temperature"; public Optional getCoolingState() { return this.getLog(COOLINGSTATE).map(logEntry -> logEntry.getMeasurementAsBoolean()).orElse(Optional.empty()); @@ -99,6 +100,14 @@ public Optional getBoilerTempUnit() { return this.getLog(BOILERTEMP).map(logEntry -> logEntry.getMeasurementUnit()).orElse(Optional.empty()); } + public Optional getReturnWaterTemp() { + return this.getLog(RETURNWATERTEMP).map(logEntry -> logEntry.getMeasurementAsDouble()).orElse(Optional.empty()); + } + + public Optional getReturnWaterTempUnit() { + return this.getLog(RETURNWATERTEMP).map(logEntry -> logEntry.getMeasurementUnit()).orElse(Optional.empty()); + } + public Optional getDHTSetpoint() { return this.getLog(DHWSETPOINT).map(logEntry -> logEntry.getMeasurementAsDouble()).orElse(Optional.empty()); } diff --git a/bundles/org.openhab.binding.plugwiseha/src/main/java/org/openhab/binding/plugwiseha/internal/handler/PlugwiseHAApplianceHandler.java b/bundles/org.openhab.binding.plugwiseha/src/main/java/org/openhab/binding/plugwiseha/internal/handler/PlugwiseHAApplianceHandler.java index 9a2df94374209..cc3dc4800b4d7 100644 --- a/bundles/org.openhab.binding.plugwiseha/src/main/java/org/openhab/binding/plugwiseha/internal/handler/PlugwiseHAApplianceHandler.java +++ b/bundles/org.openhab.binding.plugwiseha/src/main/java/org/openhab/binding/plugwiseha/internal/handler/PlugwiseHAApplianceHandler.java @@ -220,6 +220,7 @@ private State getDefaultState(String channelID) { case APPLIANCE_TEMPERATURE_CHANNEL: case APPLIANCE_VALVEPOSITION_CHANNEL: case APPLIANCE_WATERPRESSURE_CHANNEL: + case APPLIANCE_RETURNWATERTEMPERATURE_CHANNEL: state = UnDefType.NULL; break; case APPLIANCE_BATTERYLEVELLOW_CHANNEL: @@ -359,6 +360,14 @@ protected void refreshChannel(Appliance entity, ChannelUID channelUID) { state = new QuantityType(entity.getOTAppFaultCode().get().intValue(), Units.PERCENT); } break; + case APPLIANCE_RETURNWATERTEMPERATURE_CHANNEL: + if (entity.getBoilerTemp().isPresent()) { + Unit unit = entity.getReturnWaterTempUnit().orElse(UNIT_CELSIUS).equals(UNIT_CELSIUS) + ? SIUnits.CELSIUS + : ImperialUnits.FAHRENHEIT; + state = new QuantityType(entity.getReturnWaterTemp().get(), unit); + } + break; case APPLIANCE_DHWTEMPERATURE_CHANNEL: if (entity.getDHWTemp().isPresent()) { Unit unit = entity.getDHWTempUnit().orElse(UNIT_CELSIUS).equals(UNIT_CELSIUS) diff --git a/bundles/org.openhab.binding.plugwiseha/src/main/resources/OH-INF/i18n/plugwiseha.properties b/bundles/org.openhab.binding.plugwiseha/src/main/resources/OH-INF/i18n/plugwiseha.properties index d45afdc7b3836..fdca9b09d97ff 100644 --- a/bundles/org.openhab.binding.plugwiseha/src/main/resources/OH-INF/i18n/plugwiseha.properties +++ b/bundles/org.openhab.binding.plugwiseha/src/main/resources/OH-INF/i18n/plugwiseha.properties @@ -96,6 +96,8 @@ channel-type.plugwiseha.regulationControl.description = Switch the regulation co channel-type.plugwiseha.regulationControl.state.option.active = Active channel-type.plugwiseha.regulationControl.state.option.passive = Passive channel-type.plugwiseha.regulationControl.state.option.off = Off +channel-type.plugwiseha.returnWaterTemperature.label = Return Water Temperature +channel-type.plugwiseha.returnWaterTemperature.description = Gets the temperature of the boiler return water channel-type.plugwiseha.setpointTemperature.label = Setpoint Temperature channel-type.plugwiseha.setpointTemperature.description = Gets or sets the set point of this zone channel-type.plugwiseha.temperature.label = Zone Temperature diff --git a/bundles/org.openhab.binding.plugwiseha/src/main/resources/OH-INF/thing/channels.xml b/bundles/org.openhab.binding.plugwiseha/src/main/resources/OH-INF/thing/channels.xml index 5c605deca4762..bf4472648a3ee 100644 --- a/bundles/org.openhab.binding.plugwiseha/src/main/resources/OH-INF/thing/channels.xml +++ b/bundles/org.openhab.binding.plugwiseha/src/main/resources/OH-INF/thing/channels.xml @@ -172,6 +172,14 @@ + + Number:Temperature + + Gets the temperature of the return water + heating + + + Number:Temperature diff --git a/bundles/org.openhab.binding.plugwiseha/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.plugwiseha/src/main/resources/OH-INF/thing/thing-types.xml index 53d8754b25f36..3b7dd23b13a58 100644 --- a/bundles/org.openhab.binding.plugwiseha/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.plugwiseha/src/main/resources/OH-INF/thing/thing-types.xml @@ -37,6 +37,7 @@ + id