Skip to content

Commit

Permalink
[OmniLink] Fix OmniLink temperature/humidity sensors (openhab#10130)
Browse files Browse the repository at this point in the history
Signed-off-by: Ethan Dye <mrtops03@gmail.com>
  • Loading branch information
ecdye authored and thinkingstone committed Nov 7, 2021
1 parent 8982ff4 commit 6e3e991
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bundles/org.openhab.binding.omnilink/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<dependency>
<groupId>com.github.digitaldan</groupId>
<artifactId>jomnilink</artifactId>
<version>1.4.0</version>
<version>1.4.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ public void handleCommand(ChannelUID channelUID, Command command) {
switch (channelUID.getId()) {
case CHANNEL_AUX_LOW_SETPOINT:
sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_HEAT_LOW_POINT.getNumber(),
TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType<Dimensionless>) command).intValue()),
TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType<Dimensionless>) command).floatValue()),
thingID);
break;
case CHANNEL_AUX_HIGH_SETPOINT:
sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_COOL_HIGH_POINT.getNumber(),
TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType<Dimensionless>) command).intValue()),
TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType<Dimensionless>) command).floatValue()),
thingID);
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ public void handleCommand(ChannelUID channelUID, Command command) {
switch (channelUID.getId()) {
case CHANNEL_AUX_LOW_SETPOINT:
sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_HEAT_LOW_POINT.getNumber(),
temperatureFormat.get().formatToOmni(((QuantityType<Temperature>) command).intValue()),
temperatureFormat.get().formatToOmni(((QuantityType<Temperature>) command).floatValue()),
thingID);
break;
case CHANNEL_AUX_HIGH_SETPOINT:
sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_COOL_HIGH_POINT.getNumber(),
temperatureFormat.get().formatToOmni(((QuantityType<Temperature>) command).intValue()),
temperatureFormat.get().formatToOmni(((QuantityType<Temperature>) command).floatValue()),
thingID);
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public float omniToFormat(int omniNumber) {
}

@Override
public int formatToOmni(int celsius) {
public int formatToOmni(float celsius) {
return MessageUtils.CToOmni(celsius);
}
},
Expand All @@ -44,7 +44,7 @@ public float omniToFormat(int omniNumber) {
}

@Override
public int formatToOmni(int fahrenheit) {
public int formatToOmni(float fahrenheit) {
return MessageUtils.FtoOmni(fahrenheit);
}
};
Expand All @@ -69,7 +69,7 @@ private TemperatureFormat(int formatNumber) {
* @param format Number in the current format.
* @return Omni formatted number.
*/
public abstract int formatToOmni(int format);
public abstract int formatToOmni(float format);

/**
* Get the number which identifies this format as defined by the omniprotocol.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,22 +157,22 @@ public void handleCommand(ChannelUID channelUID, Command command) {
break;
case CHANNEL_THERMO_HEAT_SETPOINT:
sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_HEAT_LOW_POINT.getNumber(),
temperatureFormat.get().formatToOmni(((QuantityType<Temperature>) command).intValue()),
temperatureFormat.get().formatToOmni(((QuantityType<Temperature>) command).floatValue()),
thingID);
break;
case CHANNEL_THERMO_COOL_SETPOINT:
sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_COOL_HIGH_POINT.getNumber(),
temperatureFormat.get().formatToOmni(((QuantityType<Temperature>) command).intValue()),
temperatureFormat.get().formatToOmni(((QuantityType<Temperature>) command).floatValue()),
thingID);
break;
case CHANNEL_THERMO_HUMIDIFY_SETPOINT:
sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_HUMDIFY_POINT.getNumber(),
TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType<Dimensionless>) command).intValue()),
TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType<Dimensionless>) command).floatValue()),
thingID);
break;
case CHANNEL_THERMO_DEHUMIDIFY_SETPOINT:
sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_DEHUMIDIFY_POINT.getNumber(),
TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType<Dimensionless>) command).intValue()),
TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType<Dimensionless>) command).floatValue()),
thingID);
break;
default:
Expand Down

0 comments on commit 6e3e991

Please sign in to comment.