From 609869534d2a222632089c39cf02c063b915542d Mon Sep 17 00:00:00 2001 From: DMBlakeley Date: Fri, 11 Dec 2020 14:45:19 -0500 Subject: [PATCH] New install updates While performing a new install on Raspberry-Pi 4B it was found that changing 'placeholder' values to 'default' in config.shema.jsan provided a simpler installation. --- CHANGELOG.md | 5 +++++ config.schema.json | 28 ++++++++++++++-------------- package-lock.json | 2 +- package.json | 2 +- src/configTypes.ts | 10 ---------- src/index.ts | 6 ++++++ 6 files changed, 27 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f480e600..acc270fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/). +## v5.6.3 + * Updates for setting up Raspberry Pi for Homebridge and awair2. + * config.schema.json - changed `placeholder` to `default` on `userType`, `airQualityMethod`, `carbonDioxideThreshold` and `carbonDioxideThresholdOff`. + * Add check that `carbonDioxideThresholdOff` is less than `carbonDioxideThreshold`. If not, set to `default` values. + ## v5.6.2 * Housekeeping - remove unused functions (getLocalData, getLocalConfig, getApiUsage). diff --git a/config.schema.json b/config.schema.json index 5a66d532..7689e0fd 100644 --- a/config.schema.json +++ b/config.schema.json @@ -17,13 +17,13 @@ "userType": { "title": "The type of user account", "type": "string", - "placeholder": "users/self", + "default": "users/self", "description": "The type of user account. Default = 'users/self', Options: 'users/self' or 'orgs/###', where ### is the Awair Organization 'orgId'." }, "airQualityMethod": { "title": "Air quality calculation method", "type": "string", - "placeholder": "awair-aqi", + "default": "awair-aqi", "enum": ["awair-aqi", "awair-score", "nowcast-aqi"], "description": "Air quality calculation method used to define the Air Quality Chracteristic. Default = 'awair-aqi', Options: 'awair-aqi', 'awair-score' and 'nowcast-aqi'. Nowcast-aqi only available for Omni, Mint, Awair, Awair-R2 and Element. When 'nowcast-api' selected, 'endpoint' defaults to '15-min-avg' and 'data points returned' to '48." }, @@ -49,31 +49,31 @@ "carbonDioxideThreshold": { "title": "Carbon Dioxide Threshold", "type": "integer", - "placeholder": 0, + "default": 0, "description": "The CO2 level at which HomeKit will turn ON the trigger alert for the CO2 in ppm. Default = `0`." }, "carbonDioxideThresholdOff": { "title": "Carbon Dioxide Threshold Off", "type": "integer", - "placeholder": 0, + "default": 0, "description": "The CO2 level at which HomeKit will turn OFF the trigger alert for the CO2 in ppm, to ensure that it doesn't trigger on/off too frequently choose a number lower than 'carbonDioxideThreshold'. Default = `0`." }, "vocMw": { - "title": "Reference Gas Molecular Weight", - "type": "number", - "placeholder": 72.66578273019740, - "description": "The Molecular Weight (g/mol) of a reference gas or mixture that you use to convert from ppb to ug/m^3." - }, + "title": "Reference Gas Molecular Weight", + "type": "number", + "placeholder": 72.66578273019740, + "description": "The Molecular Weight (g/mol) of a reference gas or mixture that you use to convert from ppb to ug/m^3." + }, "occupancyDetection": { "title": "Omni - Whether to enable Occupancy detection based on minimum sound level.", "type": "boolean", "default": false, - "description": "Omni only - enables occupancy detection based on minimum sound level + occupancyOffset value." + "description": "Omni only - enables occupancy detection based on minimum sound level + occupancyOffset value." }, "occupancyOffset": { - "title": "Omni - used when occupancyDetection enabled.", - "type": "number", - "placeholder": 2.0, + "title": "Omni - used when occupancyDetection enabled.", + "type": "number", + "placeholder": 2.0, "description": "Omni only - Used when `occupancy detection` enabled. Offset value in dBA above background sound level to set `not occupied` level, `occupied` is 0.5dBA higher.", "condition": { "functionBody": "return model.occupancyDetection === true;" @@ -83,7 +83,7 @@ "title": "Omni - restart Occupancy detection measurement on next Homebridge reboot.", "type": "boolean", "default": false, - "description": "Omni only - reinitialize Occupancy detection measurement on Homebridge reboot.", + "description": "Omni only - reinitialize Occupancy detection measurement on Homebridge reboot.", "condition": { "functionBody": "return model.occupancyDetection === true;" } diff --git a/package-lock.json b/package-lock.json index c6d4f341..771e761b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "homebridge-awair2", - "version": "5.6.2", + "version": "5.6.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index efd99e15..3f1d09bc 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "private": false, "displayName": "Homebridge Awair2", "name": "homebridge-awair2", - "version": "5.6.2", + "version": "5.6.3", "description": "HomeKit integration of Awair air quality monitor as Dynamic Platform.", "main": "dist/index.js", "scripts": { diff --git a/src/configTypes.ts b/src/configTypes.ts index d905bf4e..d6cc7145 100644 --- a/src/configTypes.ts +++ b/src/configTypes.ts @@ -34,13 +34,3 @@ export type DeviceConfig = { deviceId: number; locationName: string; }; - -export type UserInfoConfig = { - userTier: string; - fifteenMin: number; - fiveMin: number; - raw: number; - latest: number; - getPowerStatus: number; - getTimeZone: number; -}; diff --git a/src/index.ts b/src/index.ts index d24112d3..042c0bcd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -119,6 +119,12 @@ class AwairPlatform implements DynamicPlatformPlugin { } else { this.carbonDioxideThresholdOff = Number(this.config.carbonDioxideThreshold); } + + if (this.carbonDioxideThreshold < this.carbonDioxideThresholdOff){ + this.log ('"Carbon Dioxide Threshold Off" must be less than "Carbon Dioxide Threshold", using defaults.'); + this.carbonDioxideThresholdOff = 0; + this.carbonDioxideThreshold = 0; + } if (this.config.vocMw) { this.vocMw = this.config.vocMw;