Skip to content

Commit

Permalink
New install updates
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DMBlakeley committed Dec 11, 2020
1 parent 250bc4a commit 6098695
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 26 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
28 changes: 14 additions & 14 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
},
Expand All @@ -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;"
Expand All @@ -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;"
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
10 changes: 0 additions & 10 deletions src/configTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6098695

Please sign in to comment.