From 0276d3289749b40dd585f154bb34795570628aa1 Mon Sep 17 00:00:00 2001 From: robnielsen Date: Mon, 14 Nov 2022 14:29:34 -0600 Subject: [PATCH] [ecobee] Add air quality channels for Ecobee Smart Thermostat Premium (#13705) * [ecobee] Add air quality channels for Ecobee Smart Thermostat Premium Signed-off-by: Rob Nielsen --- bundles/org.openhab.binding.ecobee/README.md | 8 +++++++ .../internal/EcobeeBindingConstants.java | 4 ++++ .../dto/thermostat/ExtendedRuntimeDTO.java | 20 ++++++++++++++++ .../internal/dto/thermostat/RuntimeDTO.java | 20 ++++++++++++++++ .../EcobeeThermostatBridgeHandler.java | 4 ++++ .../ecobee/internal/handler/EcobeeUtils.java | 4 ++++ .../resources/OH-INF/i18n/ecobee.properties | 4 ++++ .../resources/OH-INF/thing/thing-types.xml | 24 +++++++++++++++++++ 8 files changed, 88 insertions(+) diff --git a/bundles/org.openhab.binding.ecobee/README.md b/bundles/org.openhab.binding.ecobee/README.md index 1e478bc93c3..ea5c6268a8e 100644 --- a/bundles/org.openhab.binding.ecobee/README.md +++ b/bundles/org.openhab.binding.ecobee/README.md @@ -169,6 +169,10 @@ The following channels are available on the Ecobee Thermostat. | runtime | desiredHeatRangeHigh | Number:Temperature | | Desired Heat Range High | | runtime | desiredCoolRangeLow | Number:Temperature | | Desired Cool Range Low | | runtime | desiredCoolRangeHigh | Number:Temperature | | Desired Cool Range High | +| runtime | actualAQAccuracy | Number | | Actual Air Quality Accuracy | +| runtime | actualAQScore | Number | | Actual Air Quality Score | +| runtime | actualCO2 | Number:Dimensionless | | Actual CO2 | +| runtime | actualVOC | Number:Dimensionless | | Actual VOC | |||||| | settings | hvacMode | String | yes | HVAC Mode | | settings | lastServiceDate | String | yes | Last Service Date | @@ -853,6 +857,10 @@ Number:Temperature Runtime_DesiredHeatRangeLow "Desired Heat Range Low [%.1f %un Number:Temperature Runtime_DesiredHeatRangeHigh "Desired Heat Range High [%.1f %unit%]" (gRuntime) { channel="ecobee:thermostat:account:729318833078:runtime#desiredHeatRangeHigh" } Number:Temperature Runtime_DesiredCoolRangeLow "Desired Cool Range Low [%.1f %unit%]" (gRuntime) { channel="ecobee:thermostat:account:729318833078:runtime#desiredCoolRangeLow" } Number:Temperature Runtime_DesiredCoolRangeHigh "Desired Cool Range High [%.1f %unit%]" (gRuntime) { channel="ecobee:thermostat:account:729318833078:runtime#desiredCoolRangeHigh" } +Number Runtime_ActualAQAccuracy "Actual Air Quality Accuracy [%d]" (gRuntime) { channel="ecobee:thermostat:account:729318833078:runtime#actualAQAccuracy" } +Number Runtime_ActualAQScore "Actual Air Quality Score [%d]" (gRuntime) { channel="ecobee:thermostat:account:729318833078:runtime#actualAQScore" } +Number:Dimensionless Runtime_ActualCO2 "Actual CO2 [%d %unit%]" (gRuntime) { channel="ecobee:thermostat:account:729318833078:runtime#actualCO2" } +Number:Dimensionless Runtime_ActualVOC "Actual VOC [%d %unit%]" (gRuntime) { channel="ecobee:thermostat:account:729318833078:runtime#actualVOC" } // Settings group String Settings_HvacMode "HVAC Mode [%s]" (gSettings) { channel="ecobee:thermostat:account:729318833078:settings#hvacMode" } diff --git a/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/EcobeeBindingConstants.java b/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/EcobeeBindingConstants.java index 0fc4ce9316b..05c29e5735f 100644 --- a/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/EcobeeBindingConstants.java +++ b/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/EcobeeBindingConstants.java @@ -224,6 +224,10 @@ public class EcobeeBindingConstants { public static final String CH_DESIRED_HEAT_RANGE_HIGH = "desiredHeatRangeHigh"; public static final String CH_DESIRED_COOL_RANGE_LOW = "desiredCoolRangeLow"; public static final String CH_DESIRED_COOL_RANGE_HIGH = "desiredCoolRangeHigh"; + public static final String CH_ACTUAL_AQ_ACCURACY = "actualAQAccuracy"; + public static final String CH_ACTUAL_AQ_SCORE = "actualAQScore"; + public static final String CH_ACTUAL_CO2 = "actualCO2"; + public static final String CH_ACTUAL_VOC = "actualVOC"; // Thermostat bridge SETTINGS channels public static final String CH_HVAC_MODE = "hvacMode"; diff --git a/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/dto/thermostat/ExtendedRuntimeDTO.java b/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/dto/thermostat/ExtendedRuntimeDTO.java index 70d12ed42c8..9d152203e1d 100644 --- a/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/dto/thermostat/ExtendedRuntimeDTO.java +++ b/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/dto/thermostat/ExtendedRuntimeDTO.java @@ -81,6 +81,26 @@ public class ExtendedRuntimeDTO { */ public List desiredDehumidity; + /* + * The last three 5 minute actual air quality accuracy readings + */ + public List actualAQAccuracy; + + /* + * The last three 5 minute actual air quality score readings + */ + public List actualAQScore; + + /* + * The last three 5 minute actual CO2 readings + */ + public List actualCO2; + + /* + * The last three 5 minute actual VOC readings + */ + public List actualVOC; + /* * The last three 5 minute desired Demand Management temeprature offsets. * This value is Demand Management adjustment value which was applied by diff --git a/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/dto/thermostat/RuntimeDTO.java b/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/dto/thermostat/RuntimeDTO.java index 0e12cb31b1c..485da4d0ce7 100644 --- a/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/dto/thermostat/RuntimeDTO.java +++ b/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/dto/thermostat/RuntimeDTO.java @@ -152,4 +152,24 @@ public class RuntimeDTO { * minimum and maximim, e.g. [650,920]. */ public List desiredCoolRange; + + /* + * The current air quality accuracy + */ + public Integer actualAQAccuracy; + + /* + * The current air quality score + */ + public Integer actualAQScore; + + /* + * The current CO2 in ppm + */ + public Integer actualCO2; + + /* + * The current VOC in ppb + */ + public Integer actualVOC; } diff --git a/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/handler/EcobeeThermostatBridgeHandler.java b/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/handler/EcobeeThermostatBridgeHandler.java index 0b98523fe5d..4c5083f4050 100644 --- a/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/handler/EcobeeThermostatBridgeHandler.java +++ b/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/handler/EcobeeThermostatBridgeHandler.java @@ -417,6 +417,10 @@ public class EcobeeThermostatBridgeHandler extends BaseBridgeHandler { updateChannel(grp + CH_DESIRED_COOL_RANGE_HIGH, EcobeeUtils.undefOrTemperature(runtime.desiredCoolRange.get(1))); } + updateChannel(grp + CH_ACTUAL_AQ_ACCURACY, EcobeeUtils.undefOrLong(runtime.actualAQAccuracy)); + updateChannel(grp + CH_ACTUAL_AQ_SCORE, EcobeeUtils.undefOrLong(runtime.actualAQScore)); + updateChannel(grp + CH_ACTUAL_CO2, EcobeeUtils.undefOrQuantity(runtime.actualCO2, Units.PARTS_PER_MILLION)); + updateChannel(grp + CH_ACTUAL_VOC, EcobeeUtils.undefOrQuantity(runtime.actualVOC, Units.PARTS_PER_BILLION)); } private void updateSettings(@Nullable SettingsDTO settings) { diff --git a/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/handler/EcobeeUtils.java b/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/handler/EcobeeUtils.java index 90d68588a90..5ddb44347ad 100644 --- a/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/handler/EcobeeUtils.java +++ b/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/handler/EcobeeUtils.java @@ -70,6 +70,10 @@ public final class EcobeeUtils { return (value == null || isUnknown(value)) ? UnDefType.UNDEF : new DecimalType(value.doubleValue()); } + public static State undefOrLong(@Nullable Number value) { + return (value == null || isUnknown(value)) ? UnDefType.UNDEF : new DecimalType(value.longValue()); + } + public static State undefOrQuantity(@Nullable Number value, Unit unit) { return (value == null || isUnknown(value)) ? UnDefType.UNDEF : new QuantityType<>(value, unit); } diff --git a/bundles/org.openhab.binding.ecobee/src/main/resources/OH-INF/i18n/ecobee.properties b/bundles/org.openhab.binding.ecobee/src/main/resources/OH-INF/i18n/ecobee.properties index 96c6dcf0e06..8e311d977fa 100644 --- a/bundles/org.openhab.binding.ecobee/src/main/resources/OH-INF/i18n/ecobee.properties +++ b/bundles/org.openhab.binding.ecobee/src/main/resources/OH-INF/i18n/ecobee.properties @@ -70,8 +70,12 @@ channel-group-type.ecobee.weather.label = Weather # channel types +channel-type.ecobee.actualAQAccuracy.label = Actual Air Quality Accuracy +channel-type.ecobee.actualAQScore.label = Actual Air Quality Score channel-type.ecobee.actualHumidity.label = Actual Humidity channel-type.ecobee.actualTemperature.label = Actual Temperature +channel-type.ecobee.actualCO2.label = Actual CO2 +channel-type.ecobee.actualVOC.label = Actual VOC channel-type.ecobee.alertAcknowledgeRef.label = Acknowledge Ref channel-type.ecobee.alertAcknowledgement.label = Acknowledgement channel-type.ecobee.alertDate.label = Date diff --git a/bundles/org.openhab.binding.ecobee/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.ecobee/src/main/resources/OH-INF/thing/thing-types.xml index c112b8e278d..4d741a0fc89 100644 --- a/bundles/org.openhab.binding.ecobee/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.ecobee/src/main/resources/OH-INF/thing/thing-types.xml @@ -202,6 +202,10 @@ + + + + @@ -315,6 +319,26 @@ + + Number + + + + + Number + + + + + Number:Dimensionless + + + + + Number:Dimensionless + + +