From 4c519d657da467f306771a317da989d9e1b492d3 Mon Sep 17 00:00:00 2001 From: chasenicholl Date: Mon, 20 Nov 2023 14:45:43 -0500 Subject: [PATCH 1/2] update readme language to highlight local API support more clearly --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 88bfba6..953a3e2 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ It is recommended when upgrading to v3.0 of the plugin from a prior version that ### Setup and Parameters -You will need to create an account at https://tempestwx.com/ and then generate a Personal Use Token https://tempestwx.com/settings/tokens. +Local API is now supported which requires no authentication. If you choose to use the non-local HTTP API you will need to create an account at https://tempestwx.com/ and then generate a Personal Use Token https://tempestwx.com/settings/tokens. - `name`: _(Required)_ Must always be set to `WeatherFlow Tempest Platform`. - `local_api`: _(Required)_ Use the Local API versus HTTP API. From f7a61a734bda0d8323b1bf707d13a5f303e51b02 Mon Sep 17 00:00:00 2001 From: chasenicholl Date: Mon, 27 Nov 2023 20:49:01 -0500 Subject: [PATCH 2/2] 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(