[OmniLink] Fix OmniLink temperature/humidity sensors (#10130)

Signed-off-by: Ethan Dye <mrtops03@gmail.com>
This commit is contained in:
Ethan Dye 2021-02-16 13:48:07 -07:00 committed by GitHub
parent 7abeb97396
commit 6f9d80ea9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 12 deletions

View File

@ -18,7 +18,7 @@
<dependency> <dependency>
<groupId>com.github.digitaldan</groupId> <groupId>com.github.digitaldan</groupId>
<artifactId>jomnilink</artifactId> <artifactId>jomnilink</artifactId>
<version>1.4.0</version> <version>1.4.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -113,12 +113,12 @@ public class HumiditySensorHandler extends AbstractOmnilinkStatusHandler<Extende
switch (channelUID.getId()) { switch (channelUID.getId()) {
case CHANNEL_AUX_LOW_SETPOINT: case CHANNEL_AUX_LOW_SETPOINT:
sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_HEAT_LOW_POINT.getNumber(), sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_HEAT_LOW_POINT.getNumber(),
TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType<Dimensionless>) command).intValue()), TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType<Dimensionless>) command).floatValue()),
thingID); thingID);
break; break;
case CHANNEL_AUX_HIGH_SETPOINT: case CHANNEL_AUX_HIGH_SETPOINT:
sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_COOL_HIGH_POINT.getNumber(), sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_COOL_HIGH_POINT.getNumber(),
TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType<Dimensionless>) command).intValue()), TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType<Dimensionless>) command).floatValue()),
thingID); thingID);
break; break;
default: default:

View File

@ -126,12 +126,12 @@ public class TempSensorHandler extends AbstractOmnilinkStatusHandler<ExtendedAux
switch (channelUID.getId()) { switch (channelUID.getId()) {
case CHANNEL_AUX_LOW_SETPOINT: case CHANNEL_AUX_LOW_SETPOINT:
sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_HEAT_LOW_POINT.getNumber(), sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_HEAT_LOW_POINT.getNumber(),
temperatureFormat.get().formatToOmni(((QuantityType<Temperature>) command).intValue()), temperatureFormat.get().formatToOmni(((QuantityType<Temperature>) command).floatValue()),
thingID); thingID);
break; break;
case CHANNEL_AUX_HIGH_SETPOINT: case CHANNEL_AUX_HIGH_SETPOINT:
sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_COOL_HIGH_POINT.getNumber(), sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_COOL_HIGH_POINT.getNumber(),
temperatureFormat.get().formatToOmni(((QuantityType<Temperature>) command).intValue()), temperatureFormat.get().formatToOmni(((QuantityType<Temperature>) command).floatValue()),
thingID); thingID);
break; break;
default: default:

View File

@ -33,7 +33,7 @@ public enum TemperatureFormat {
} }
@Override @Override
public int formatToOmni(int celsius) { public int formatToOmni(float celsius) {
return MessageUtils.CToOmni(celsius); return MessageUtils.CToOmni(celsius);
} }
}, },
@ -44,7 +44,7 @@ public enum TemperatureFormat {
} }
@Override @Override
public int formatToOmni(int fahrenheit) { public int formatToOmni(float fahrenheit) {
return MessageUtils.FtoOmni(fahrenheit); return MessageUtils.FtoOmni(fahrenheit);
} }
}; };
@ -69,7 +69,7 @@ public enum TemperatureFormat {
* @param format Number in the current format. * @param format Number in the current format.
* @return Omni formatted number. * @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. * Get the number which identifies this format as defined by the omniprotocol.

View File

@ -157,22 +157,22 @@ public class ThermostatHandler extends AbstractOmnilinkStatusHandler<ExtendedThe
break; break;
case CHANNEL_THERMO_HEAT_SETPOINT: case CHANNEL_THERMO_HEAT_SETPOINT:
sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_HEAT_LOW_POINT.getNumber(), sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_HEAT_LOW_POINT.getNumber(),
temperatureFormat.get().formatToOmni(((QuantityType<Temperature>) command).intValue()), temperatureFormat.get().formatToOmni(((QuantityType<Temperature>) command).floatValue()),
thingID); thingID);
break; break;
case CHANNEL_THERMO_COOL_SETPOINT: case CHANNEL_THERMO_COOL_SETPOINT:
sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_COOL_HIGH_POINT.getNumber(), sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_COOL_HIGH_POINT.getNumber(),
temperatureFormat.get().formatToOmni(((QuantityType<Temperature>) command).intValue()), temperatureFormat.get().formatToOmni(((QuantityType<Temperature>) command).floatValue()),
thingID); thingID);
break; break;
case CHANNEL_THERMO_HUMIDIFY_SETPOINT: case CHANNEL_THERMO_HUMIDIFY_SETPOINT:
sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_HUMDIFY_POINT.getNumber(), sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_HUMDIFY_POINT.getNumber(),
TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType<Dimensionless>) command).intValue()), TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType<Dimensionless>) command).floatValue()),
thingID); thingID);
break; break;
case CHANNEL_THERMO_DEHUMIDIFY_SETPOINT: case CHANNEL_THERMO_DEHUMIDIFY_SETPOINT:
sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_DEHUMIDIFY_POINT.getNumber(), sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_DEHUMIDIFY_POINT.getNumber(),
TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType<Dimensionless>) command).intValue()), TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType<Dimensionless>) command).floatValue()),
thingID); thingID);
break; break;
default: default: