Fix setpoint parsing error (#11635)

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
This commit is contained in:
mlobstein 2021-11-23 06:18:30 -06:00 committed by GitHub
parent 860244b18b
commit 43ff86c1b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 18 deletions

View File

@ -74,7 +74,7 @@ The thermostat information that is retrieved is available as these channels:
radiotherm.map: radiotherm.map:
```text ```
UNDEF_stus=- UNDEF_stus=-
NULL_stus=- NULL_stus=-
-_stus=- -_stus=-
@ -117,14 +117,14 @@ NULL_over=-
radiotherm.things: radiotherm.things:
```java ```
radiothermostat:rtherm:mytherm1 "My 1st floor thermostat" [ hostName="192.168.10.1", refresh=2, logRefresh=10, isCT80=false, disableLogs=false, setpointMode="temporary" ] radiothermostat:rtherm:mytherm1 "My 1st floor thermostat" [ hostName="192.168.10.1", refresh=2, logRefresh=10, isCT80=false, disableLogs=false, setpointMode="temporary" ]
radiothermostat:rtherm:mytherm2 "My 2nd floor thermostat" [ hostName="mythermhost2", refresh=1, logRefresh=20, isCT80=true, disableLogs=false, setpointMode="absolute" ] radiothermostat:rtherm:mytherm2 "My 2nd floor thermostat" [ hostName="mythermhost2", refresh=1, logRefresh=20, isCT80=true, disableLogs=false, setpointMode="absolute" ]
``` ```
radiotherm.items: radiotherm.items:
```java ```
Number:Temperature Therm_Temp "Current Temperature [%.1f °F] " <temperature> { channel="radiothermostat:rtherm:mytherm1:temperature" } Number:Temperature Therm_Temp "Current Temperature [%.1f °F] " <temperature> { channel="radiothermostat:rtherm:mytherm1:temperature" }
// Humidity only supported on CT80 // Humidity only supported on CT80
Number Therm_Hum "Current Humidity [%d %%]" <temperature> { channel="radiothermostat:rtherm:mytherm1:humidity" } Number Therm_Hum "Current Humidity [%d %%]" <temperature> { channel="radiothermostat:rtherm:mytherm1:humidity" }
@ -158,7 +158,7 @@ Switch Therm_mysetting "Send my preferred setting"
radiotherm.sitemap: radiotherm.sitemap:
```perl ```
sitemap radiotherm label="My Thermostat" { sitemap radiotherm label="My Thermostat" {
Frame label="My 1st floor thermostat" { Frame label="My 1st floor thermostat" {
Text item=Therm_Temp icon="temperature" valuecolor=[>76="orange",>67.5="green",<=67.5="blue"] Text item=Therm_Temp icon="temperature" valuecolor=[>76="orange",>67.5="green",<=67.5="blue"]
@ -196,7 +196,7 @@ sitemap radiotherm label="My Thermostat" {
radiotherm.rules: radiotherm.rules:
```java ```
rule "Send my thermostat command" rule "Send my thermostat command"
when when
Item Therm_mysetting received command Item Therm_mysetting received command

View File

@ -35,10 +35,10 @@ public class RadioThermostatTstatDTO {
private Integer programMode; private Integer programMode;
@SerializedName("t_heat") @SerializedName("t_heat")
private Integer heatTarget; private Double heatTarget;
@SerializedName("t_cool") @SerializedName("t_cool")
private Integer coolTarget; private Double coolTarget;
@SerializedName("override") @SerializedName("override")
private Integer override; private Integer override;
@ -86,19 +86,19 @@ public class RadioThermostatTstatDTO {
this.programMode = programMode; this.programMode = programMode;
} }
public Integer getHeatTarget() { public Double getHeatTarget() {
return heatTarget; return heatTarget;
} }
public void setHeatTarget(Integer heatTarget) { public void setHeatTarget(Double heatTarget) {
this.heatTarget = heatTarget; this.heatTarget = heatTarget;
} }
public Integer getCoolTarget() { public Double getCoolTarget() {
return coolTarget; return coolTarget;
} }
public void setCoolTarget(Integer coolTarget) { public void setCoolTarget(Double coolTarget) {
this.coolTarget = coolTarget; this.coolTarget = coolTarget;
} }
@ -129,9 +129,9 @@ public class RadioThermostatTstatDTO {
*/ */
public Integer getSetpoint() { public Integer getSetpoint() {
if (mode == 1) { if (mode == 1) {
return heatTarget; return heatTarget.intValue();
} else if (mode == 2) { } else if (mode == 2) {
return coolTarget; return coolTarget.intValue();
} else { } else {
return 0; return 0;
} }

View File

@ -233,7 +233,8 @@ public class RadioThermostatHandler extends BaseThingHandler implements RadioThe
}; };
logRefreshJob = null; logRefreshJob = null;
this.logRefreshJob = scheduler.scheduleWithFixedDelay(runnable, 1, logRefreshPeriod, TimeUnit.MINUTES); this.logRefreshJob = scheduler.scheduleWithFixedDelay(runnable, (!this.clockSync ? 1 : 2), logRefreshPeriod,
TimeUnit.MINUTES);
} }
} }
@ -289,8 +290,8 @@ public class RadioThermostatHandler extends BaseThingHandler implements RadioThe
// set the new operating mode, reset everything else, // set the new operating mode, reset everything else,
// because refreshing the tstat data below is really slow. // because refreshing the tstat data below is really slow.
rthermData.getThermostatData().setMode(cmdInt); rthermData.getThermostatData().setMode(cmdInt);
rthermData.getThermostatData().setHeatTarget(0); rthermData.getThermostatData().setHeatTarget(Double.valueOf(0));
rthermData.getThermostatData().setCoolTarget(0); rthermData.getThermostatData().setCoolTarget(Double.valueOf(0));
updateChannel(SET_POINT, rthermData); updateChannel(SET_POINT, rthermData);
rthermData.getThermostatData().setHold(0); rthermData.getThermostatData().setHold(0);
updateChannel(HOLD, rthermData); updateChannel(HOLD, rthermData);
@ -323,10 +324,10 @@ public class RadioThermostatHandler extends BaseThingHandler implements RadioThe
String cmdKey = null; String cmdKey = null;
if (rthermData.getThermostatData().getMode() == 1) { if (rthermData.getThermostatData().getMode() == 1) {
cmdKey = this.setpointCmdKeyPrefix + "heat"; cmdKey = this.setpointCmdKeyPrefix + "heat";
rthermData.getThermostatData().setHeatTarget(cmdInt); rthermData.getThermostatData().setHeatTarget(Double.valueOf(cmdInt));
} else if (rthermData.getThermostatData().getMode() == 2) { } else if (rthermData.getThermostatData().getMode() == 2) {
cmdKey = this.setpointCmdKeyPrefix + "cool"; cmdKey = this.setpointCmdKeyPrefix + "cool";
rthermData.getThermostatData().setCoolTarget(cmdInt); rthermData.getThermostatData().setCoolTarget(Double.valueOf(cmdInt));
} else { } else {
// don't do anything if we are not in heat or cool mode // don't do anything if we are not in heat or cool mode
break; break;