mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-26 15:21:41 +01:00
[homekit] do unit conversion for min/max heating/cooling temps (#12450)
this is especially important if you use the same item for both TargetTemperature and HeatingThresholdTemperature characteristics, since the former was already doing unit conversion for min/max. Signed-off-by: Cody Cutrer <cody@cutrer.us>
This commit is contained in:
parent
ba03fef082
commit
d06cc6a60a
@ -694,33 +694,29 @@ public class HomekitCharacteristicFactory {
|
|||||||
|
|
||||||
private static CoolingThresholdTemperatureCharacteristic createCoolingThresholdCharacteristic(
|
private static CoolingThresholdTemperatureCharacteristic createCoolingThresholdCharacteristic(
|
||||||
HomekitTaggedItem taggedItem, HomekitAccessoryUpdater updater) {
|
HomekitTaggedItem taggedItem, HomekitAccessoryUpdater updater) {
|
||||||
return new CoolingThresholdTemperatureCharacteristic(
|
double minValue = HomekitCharacteristicFactory.convertToCelsius(taggedItem.getConfigurationAsDouble(
|
||||||
taggedItem.getConfigurationAsDouble(HomekitTaggedItem.MIN_VALUE,
|
HomekitTaggedItem.MIN_VALUE, CoolingThresholdTemperatureCharacteristic.DEFAULT_MIN_VALUE));
|
||||||
CoolingThresholdTemperatureCharacteristic.DEFAULT_MIN_VALUE),
|
double maxValue = HomekitCharacteristicFactory.convertToCelsius(taggedItem.getConfigurationAsDouble(
|
||||||
taggedItem.getConfigurationAsDouble(HomekitTaggedItem.MAX_VALUE,
|
HomekitTaggedItem.MAX_VALUE, CoolingThresholdTemperatureCharacteristic.DEFAULT_MAX_VALUE));
|
||||||
CoolingThresholdTemperatureCharacteristic.DEFAULT_MAX_VALUE),
|
return new CoolingThresholdTemperatureCharacteristic(minValue, maxValue,
|
||||||
taggedItem.getConfigurationAsDouble(HomekitTaggedItem.STEP,
|
taggedItem.getConfigurationAsDouble(HomekitTaggedItem.STEP,
|
||||||
CoolingThresholdTemperatureCharacteristic.DEFAULT_STEP),
|
CoolingThresholdTemperatureCharacteristic.DEFAULT_STEP),
|
||||||
getTemperatureSupplier(taggedItem,
|
getTemperatureSupplier(taggedItem, minValue), setTemperatureConsumer(taggedItem),
|
||||||
taggedItem.getConfigurationAsDouble(HomekitTaggedItem.MIN_VALUE,
|
getSubscriber(taggedItem, COOLING_THRESHOLD_TEMPERATURE, updater),
|
||||||
CoolingThresholdTemperatureCharacteristic.DEFAULT_MIN_VALUE)),
|
|
||||||
setTemperatureConsumer(taggedItem), getSubscriber(taggedItem, COOLING_THRESHOLD_TEMPERATURE, updater),
|
|
||||||
getUnsubscriber(taggedItem, COOLING_THRESHOLD_TEMPERATURE, updater));
|
getUnsubscriber(taggedItem, COOLING_THRESHOLD_TEMPERATURE, updater));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HeatingThresholdTemperatureCharacteristic createHeatingThresholdCharacteristic(
|
private static HeatingThresholdTemperatureCharacteristic createHeatingThresholdCharacteristic(
|
||||||
HomekitTaggedItem taggedItem, HomekitAccessoryUpdater updater) {
|
HomekitTaggedItem taggedItem, HomekitAccessoryUpdater updater) {
|
||||||
return new HeatingThresholdTemperatureCharacteristic(
|
double minValue = HomekitCharacteristicFactory.convertToCelsius(taggedItem.getConfigurationAsDouble(
|
||||||
taggedItem.getConfigurationAsDouble(HomekitTaggedItem.MIN_VALUE,
|
HomekitTaggedItem.MIN_VALUE, HeatingThresholdTemperatureCharacteristic.DEFAULT_MIN_VALUE));
|
||||||
HeatingThresholdTemperatureCharacteristic.DEFAULT_MIN_VALUE),
|
double maxValue = HomekitCharacteristicFactory.convertToCelsius(taggedItem.getConfigurationAsDouble(
|
||||||
taggedItem.getConfigurationAsDouble(HomekitTaggedItem.MAX_VALUE,
|
HomekitTaggedItem.MAX_VALUE, HeatingThresholdTemperatureCharacteristic.DEFAULT_MAX_VALUE));
|
||||||
HeatingThresholdTemperatureCharacteristic.DEFAULT_MAX_VALUE),
|
return new HeatingThresholdTemperatureCharacteristic(minValue, maxValue,
|
||||||
taggedItem.getConfigurationAsDouble(HomekitTaggedItem.STEP,
|
taggedItem.getConfigurationAsDouble(HomekitTaggedItem.STEP,
|
||||||
HeatingThresholdTemperatureCharacteristic.DEFAULT_STEP),
|
HeatingThresholdTemperatureCharacteristic.DEFAULT_STEP),
|
||||||
getTemperatureSupplier(taggedItem,
|
getTemperatureSupplier(taggedItem, minValue), setTemperatureConsumer(taggedItem),
|
||||||
taggedItem.getConfigurationAsDouble(HomekitTaggedItem.MIN_VALUE,
|
getSubscriber(taggedItem, HEATING_THRESHOLD_TEMPERATURE, updater),
|
||||||
HeatingThresholdTemperatureCharacteristic.DEFAULT_MIN_VALUE)),
|
|
||||||
setTemperatureConsumer(taggedItem), getSubscriber(taggedItem, HEATING_THRESHOLD_TEMPERATURE, updater),
|
|
||||||
getUnsubscriber(taggedItem, HEATING_THRESHOLD_TEMPERATURE, updater));
|
getUnsubscriber(taggedItem, HEATING_THRESHOLD_TEMPERATURE, updater));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user