From 3bb0fa7d76e2f8ebb0aee9ee85a4165f19c9e793 Mon Sep 17 00:00:00 2001 From: Jacek Suliga Date: Sat, 17 Feb 2024 12:39:30 -0800 Subject: [PATCH] Fix for VOC readings from local sensors (#66) * Fix for VOC readings from local sensors * Bump the version --- README.md | 1 + package.json | 2 +- src/SensorReading.ts | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1eaac94..797e940 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ sudo npm publish # Changelog +- 3.0.1: Fixed fetching VOC for local sensors - 3.0.0: Major rewwrite to convert to the Platform plugin. Added humidity and temperatures reporting. Added ALT-CF3 conversion. - 2.1.0: Only fetch API fields needed for the core functionality of the plugin. - 2.0.2: Verbose network error logging. diff --git a/package.json b/package.json index 80299f8..56f76fd 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "private": false, "displayName": "Homebridge PurpleAir Sensor", "name": "homebridge-purpleair-sensor", - "version": "3.0.0", + "version": "3.0.1", "description": "Monitor air quality using PurpleAir.", "license": "Apache-2.0", "repository": { diff --git a/src/SensorReading.ts b/src/SensorReading.ts index 2d854e5..19393aa 100644 --- a/src/SensorReading.ts +++ b/src/SensorReading.ts @@ -29,7 +29,8 @@ function parseLocalPurpleAirJson(data, averages?: string, conversion?: string) { const humidity = parseFloat(data.current_humidity) + 4; const sensor = data.Id; const temperature = convertTemperatureToCelcius(parseFloat(data.current_temp_f)); - return new SensorReading(sensor, pm25, pm25Cf1, humidity, temperature, null, conv, pm25alt); + const voc = data.gas_680 ? parseFloat(data.gas_680) : null; + return new SensorReading(sensor, pm25, pm25Cf1, humidity, temperature, voc, conv, pm25alt); } function getPM25(sensor_data, sensor_stats, averages) {