]> git.basschouten.com Git - openhab-addons.git/commitdiff
[ecobee] Add air quality channels for Ecobee Smart Thermostat Premium (#13705)
authorrobnielsen <rob.nielsen@yahoo.com>
Mon, 14 Nov 2022 20:29:34 +0000 (14:29 -0600)
committerGitHub <noreply@github.com>
Mon, 14 Nov 2022 20:29:34 +0000 (21:29 +0100)
* [ecobee] Add air quality channels for Ecobee Smart Thermostat Premium

Signed-off-by: Rob Nielsen <rob.nielsen@yahoo.com>
bundles/org.openhab.binding.ecobee/README.md
bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/EcobeeBindingConstants.java
bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/dto/thermostat/ExtendedRuntimeDTO.java
bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/dto/thermostat/RuntimeDTO.java
bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/handler/EcobeeThermostatBridgeHandler.java
bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/handler/EcobeeUtils.java
bundles/org.openhab.binding.ecobee/src/main/resources/OH-INF/i18n/ecobee.properties
bundles/org.openhab.binding.ecobee/src/main/resources/OH-INF/thing/thing-types.xml

index 1e478bc93c3eca848bec0ffae2bd9c603b0f278a..ea5c6268a8ec23c68406d814aad3cc0447bfc492 100644 (file)
@@ -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%]" <temperature> (gRuntime) { channel="ecobee:thermostat:account:729318833078:runtime#desiredHeatRangeHigh" }
 Number:Temperature Runtime_DesiredCoolRangeLow "Desired Cool Range Low [%.1f %unit%]" <temperature> (gRuntime) { channel="ecobee:thermostat:account:729318833078:runtime#desiredCoolRangeLow" }
 Number:Temperature Runtime_DesiredCoolRangeHigh "Desired Cool Range High [%.1f %unit%]" <temperature> (gRuntime) { channel="ecobee:thermostat:account:729318833078:runtime#desiredCoolRangeHigh" }
+Number Runtime_ActualAQAccuracy "Actual Air Quality Accuracy [%d]" <none> (gRuntime) { channel="ecobee:thermostat:account:729318833078:runtime#actualAQAccuracy" }
+Number Runtime_ActualAQScore "Actual Air Quality Score [%d]" <none> (gRuntime) { channel="ecobee:thermostat:account:729318833078:runtime#actualAQScore" }
+Number:Dimensionless Runtime_ActualCO2 "Actual CO2 [%d %unit%]" <carbondioxide> (gRuntime) { channel="ecobee:thermostat:account:729318833078:runtime#actualCO2" }
+Number:Dimensionless Runtime_ActualVOC "Actual VOC [%d %unit%]" <none> (gRuntime) { channel="ecobee:thermostat:account:729318833078:runtime#actualVOC" }
 
 // Settings group
 String Settings_HvacMode "HVAC Mode [%s]" <text> (gSettings) { channel="ecobee:thermostat:account:729318833078:settings#hvacMode" }
index 0fc4ce9316b453c96b13cac8e87f456efbcfb481..05c29e5735f2db7d94786f0e29253bb49dab99fd 100644 (file)
@@ -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";
index 70d12ed42c85749d9775ee5a597ff08f912b4927..9d152203e1da21c525335ee4a390d37659ad0f40 100644 (file)
@@ -81,6 +81,26 @@ public class ExtendedRuntimeDTO {
      */
     public List<Integer> desiredDehumidity;
 
+    /*
+     * The last three 5 minute actual air quality accuracy readings
+     */
+    public List<Integer> actualAQAccuracy;
+
+    /*
+     * The last three 5 minute actual air quality score readings
+     */
+    public List<Integer> actualAQScore;
+
+    /*
+     * The last three 5 minute actual CO2 readings
+     */
+    public List<Integer> actualCO2;
+
+    /*
+     * The last three 5 minute actual VOC readings
+     */
+    public List<Integer> actualVOC;
+
     /*
      * The last three 5 minute desired Demand Management temeprature offsets.
      * This value is Demand Management adjustment value which was applied by
index 0e12cb31b1c8a422498fc229c832fbb86a4183c6..485da4d0ce77a7eb0a90e4818eff2f1f7c2f9a25 100644 (file)
@@ -152,4 +152,24 @@ public class RuntimeDTO {
      * minimum and maximim, e.g. [650,920].
      */
     public List<Integer> 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;
 }
index 0b98523fe5d0e6a574240d589d62a2f680f8f34b..4c5083f40506123d175feeda52b337c8e5770735 100644 (file)
@@ -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) {
index 90d68588a907e6336d0796ec53aab9d018a38a86..5ddb44347ad322951ba8ab60dda486cd6af4c358 100644 (file)
@@ -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);
     }
index 96c6dcf0e0680151898a06edd040aaeb843321cc..8e311d977fa918633ec9558d3697f1d0ab96232b 100644 (file)
@@ -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
index c112b8e278dfb76ecfbe6bc1159e12d1d2cc07cb..4d741a0fc896a51ce50aaa042ac9a680718e042f 100644 (file)
                        <channel id="desiredHeatRangeHigh" typeId="desiredHeatRangeHigh"/>
                        <channel id="desiredCoolRangeLow" typeId="desiredCoolRangeLow"/>
                        <channel id="desiredCoolRangeHigh" typeId="desiredCoolRangeHigh"/>
+                       <channel id="actualAQAccuracy" typeId="actualAQAccuracy"/>
+                       <channel id="actualAQScore" typeId="actualAQScore"/>
+                       <channel id="actualCO2" typeId="actualCO2"/>
+                       <channel id="actualVOC" typeId="actualVOC"/>
                </channels>
        </channel-group-type>
 
                <label>Desired Cool Range High</label>
                <state readOnly="true" pattern="%.1f %unit%"/>
        </channel-type>
+       <channel-type id="actualAQAccuracy" advanced="true">
+               <item-type>Number</item-type>
+               <label>Actual Air Quality Accuracy</label>
+               <state readOnly="true" pattern="%d"/>
+       </channel-type>
+       <channel-type id="actualAQScore" advanced="true">
+               <item-type>Number</item-type>
+               <label>Actual Air Quality Score</label>
+               <state readOnly="true" pattern="%d"/>
+       </channel-type>
+       <channel-type id="actualCO2" advanced="true">
+               <item-type>Number:Dimensionless</item-type>
+               <label>Actual CO2</label>
+               <state readOnly="true" pattern="%d %unit%"/>
+       </channel-type>
+       <channel-type id="actualVOC" advanced="true">
+               <item-type>Number:Dimensionless</item-type>
+               <label>Actual VOC</label>
+               <state readOnly="true" pattern="%d %unit%"/>
+       </channel-type>
 
        <channel-group-type id="settings">
                <label>Thermostat Settings</label>