From f7a61a734bda0d8323b1bf707d13a5f303e51b02 Mon Sep 17 00:00:00 2001 From: chasenicholl Date: Mon, 27 Nov 2023 20:49:01 -0500 Subject: [PATCH] last minute backwards config compatibility for easier transition to 4.0.0 --- CHANGELOG.md | 6 +++++- src/platform.ts | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95e77f4..2ae5860 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,11 @@ All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/). ## v4.0.0 -* Added Local UDP API support! Now you can choose to listen to your Weather Stations observations directly over your local network. No Station ID or API Token needed. Observations are broadcasted every 60 seconds. This leverages the `obs_st` message. See [documentation](https://weatherflow.github.io/Tempest/api/udp/v171/) for more information. +* Added Local UDP API support! Now you can choose to listen to your Weather Stations observations directly over your local network. No Station ID or API Token needed. + * To use the local API add `local_api`: `true` or `false` to your top level configuration. + * Observations are broadcasted every 60 seconds. + * Leverages the `obs_st` message. See [documentation](https://weatherflow.github.io/Tempest/api/udp/v171/) for more information. + * `precip_accum_local_day` not available with local API ## v3.0.3 * Update node-version: [18.x, 20.x], remove 16.x which is no longer supported by homebridge. diff --git a/src/platform.ts b/src/platform.ts index 37f267e..e69f210 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -61,6 +61,12 @@ export class WeatherFlowTempestPlatform implements DynamicPlatformPlugin { this.tempest_battery_level = 0; this.tempest_device_id = 0; + // Backwards compatible config check for new local_api variable + if (!('local_api' in this.config)) { + this.config['local_api'] = false; + this.log.info('local_api config parameter not set defaulting to false.'); + } + // Make sure the Station ID is the integer ID if (this.config.local_api === false && isNaN(this.config.station_id)) { log.warn(