mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 23:22:02 +01:00
[homekit] allow RelativeHumidity as an optional characteristic on Thermostat (#13504)
also support QuantityType as a valid state type for double characteristics (such as RelativeHumidity). Signed-off-by: Cody Cutrer <cody@cutrer.us>
This commit is contained in:
parent
0aa28e5d40
commit
0409484c2e
@ -691,6 +691,7 @@ Support for this is planned for the future release of openHAB HomeKit binding.
|
||||
| | | Name | String | Name of the thermostat |
|
||||
| | | CoolingThresholdTemperature | Number | Maximum temperature that must be reached before cooling is turned on. min/max/step can configured at item level, e.g. minValue=10.5, maxValue=50, step=2] |
|
||||
| | | HeatingThresholdTemperature | Number | Minimum temperature that must be reached before heating is turned on. min/max/step can configured at item level, e.g. minValue=10.5, maxValue=50, step=2] |
|
||||
| | | RelativeHumidity | Number | Relative humidity in % between 0 and 100. |
|
||||
| HeaterCooler | | | | Heater or/and cooler device |
|
||||
| | ActiveStatus | | Switch | Accessory current working status. A value of "ON"/"OPEN" indicates that the accessory is active and is functioning without any errors. |
|
||||
| | CurrentTemperature | | Number | Current temperature. supported configuration: minValue, maxValue, step |
|
||||
|
@ -96,6 +96,7 @@ import io.github.hapjava.characteristics.impl.fan.TargetFanStateCharacteristic;
|
||||
import io.github.hapjava.characteristics.impl.fan.TargetFanStateEnum;
|
||||
import io.github.hapjava.characteristics.impl.filtermaintenance.FilterLifeLevelCharacteristic;
|
||||
import io.github.hapjava.characteristics.impl.filtermaintenance.ResetFilterIndicationCharacteristic;
|
||||
import io.github.hapjava.characteristics.impl.humiditysensor.CurrentRelativeHumidityCharacteristic;
|
||||
import io.github.hapjava.characteristics.impl.lightbulb.BrightnessCharacteristic;
|
||||
import io.github.hapjava.characteristics.impl.lightbulb.ColorTemperatureCharacteristic;
|
||||
import io.github.hapjava.characteristics.impl.lightbulb.HueCharacteristic;
|
||||
@ -159,6 +160,7 @@ public class HomekitCharacteristicFactory {
|
||||
put(VOLUME, HomekitCharacteristicFactory::createVolumeCharacteristic);
|
||||
put(COOLING_THRESHOLD_TEMPERATURE, HomekitCharacteristicFactory::createCoolingThresholdCharacteristic);
|
||||
put(HEATING_THRESHOLD_TEMPERATURE, HomekitCharacteristicFactory::createHeatingThresholdCharacteristic);
|
||||
put(RELATIVE_HUMIDITY, HomekitCharacteristicFactory::createRelativeHumidityCharacteristic);
|
||||
put(REMAINING_DURATION, HomekitCharacteristicFactory::createRemainingDurationCharacteristic);
|
||||
put(OZONE_DENSITY, HomekitCharacteristicFactory::createOzoneDensityCharacteristic);
|
||||
put(NITROGEN_DIOXIDE_DENSITY, HomekitCharacteristicFactory::createNitrogenDioxideDensityCharacteristic);
|
||||
@ -355,6 +357,8 @@ public class HomekitCharacteristicFactory {
|
||||
value = ((PercentType) state).doubleValue();
|
||||
} else if (state instanceof DecimalType) {
|
||||
value = ((DecimalType) state).doubleValue();
|
||||
} else if (state instanceof QuantityType) {
|
||||
value = ((QuantityType) state).doubleValue();
|
||||
}
|
||||
return CompletableFuture.completedFuture(value);
|
||||
};
|
||||
@ -750,6 +754,13 @@ public class HomekitCharacteristicFactory {
|
||||
getUnsubscriber(taggedItem, HEATING_THRESHOLD_TEMPERATURE, updater));
|
||||
}
|
||||
|
||||
private static CurrentRelativeHumidityCharacteristic createRelativeHumidityCharacteristic(
|
||||
HomekitTaggedItem taggedItem, HomekitAccessoryUpdater updater) {
|
||||
return new CurrentRelativeHumidityCharacteristic(getDoubleSupplier(taggedItem, 0.0),
|
||||
getSubscriber(taggedItem, RELATIVE_HUMIDITY, updater),
|
||||
getUnsubscriber(taggedItem, RELATIVE_HUMIDITY, updater));
|
||||
}
|
||||
|
||||
private static OzoneDensityCharacteristic createOzoneDensityCharacteristic(final HomekitTaggedItem taggedItem,
|
||||
HomekitAccessoryUpdater updater) {
|
||||
return new OzoneDensityCharacteristic(
|
||||
|
Loading…
Reference in New Issue
Block a user