Repository navigation
Add weather sensor data API and harden weather provider processing - #180
Merged
Merged
Conversation
Scope Mocha to project tests, replace stale network-dependent fixtures with deterministic provider data, and run tests plus the production build in CI before container builds.
Preserve valid zero readings, distinguish current rain from forecast precipitation, and return AccuWeather precipitation amounts. Mark provider-dependent current and forecast fields optional and cover the corrected semantics with tests.
Apply FAO-56 wind and radiation limits, validate calculation inputs, use the weather location's calendar day, and reject invalid adjustment data cleanly. Correct Open-Meteo radiation and wind normalization, Pirate Weather radiation windows, and Apple wind averaging. Add regression coverage for the calculation, provider normalization, and weather sensor response behavior.
Align provider inputs with documented units and field semantics, including liquid precipitation, historical wind averages, measured solar radiation, local calendar-day grouping, and DST-length days. Normalize HTTP failures and missing provider data, preserve Apple attribution, and improve local PWS persistence and irregular-sample handling. Add focused regression coverage for all corrected provider paths.
Add deterministic cache and endpoint-sharing coverage plus bounded live smoke and full-provider profiles. Validate response contracts, physical ranges, cross-endpoint consistency, and gross cross-provider outliers while supporting optional deployed-service comparisons and redacted JSON reports.
Use PORT as the canonical server setting, retain HTTP_PORT as a compatibility alias, and reject malformed or out-of-range values. Addresses #179.
Require local temperature, humidity, and precipitation for Zimmerman while leaving wind and solar optional for ETo consumers. Preserve unavailable fields through sensor responses and reject incomplete ETo inputs at the adjustment layer. Addresses #178.
Enable local observation persistence independently of the selected weather provider, parse the setting explicitly, and write state atomically to a configurable directory. Provide a persistent Docker data volume for observations and geocoder state. Reimplements the behavior proposed in #144 and #150 against the current provider architecture.
Retain eight days of local PWS observations and return up to seven contiguous complete calendar days for interval-program averaging. Time-weight irregular samples across day boundaries while preserving optional wind and solar data. Normalize all provider history newest-first, reject duplicate or noncontiguous days, validate hourly slots across DST transitions, and correct Pirate Weather handling of 23- and 25-hour days. Extend deterministic and live local-PWS coverage accordingly. Reimplements #170 against the current provider architecture.
Track the npm lockfile required by the CI npm ci step and lock production dependencies to patched transitive versions. This clears the current production npm audit findings while leaving development-only advisories unchanged.
Use the valid leading ETo history when older records lack optional wind or solar data while still requiring a valid newest day. Flush local observations on graceful shutdown and run Node directly in containers so termination signals are handled. Make Docker builds reproducible with npm ci, bind container services to all interfaces, remove the stale 8080 exposure, and clean up unused test and request-handling code.
Shorten the graceful shutdown fallback to avoid Docker's stop timeout, document degraded California restriction coverage and reserved error categories, and remove redundant runtime container metadata. Clarify the example network bind behavior.
Propagate the requested response format through watering adjustment error paths while preserving the legacy format by default. Add regression coverage and standardize development on Node.js 24 with corrected package metadata.
Bump the service version for the new weather sensor API and pin Docker builds to Node.js 24. Instantiate only the selected geocoder so competing cache writers cannot erase persisted entries, and derive Pirate Weather history timestamps from the normalized day selection. Clarify that attribution is passed through only when provider metadata supplies it.
This was referenced Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prepare OpenSprinkler Weather Service 3.1.0 with a compact weather sensor API, more reliable
provider normalization, persistent local weather history, and expanded automated testing.
Main Changes
/weatherSensorDatafor compact current, forecast, and historical sensor values (in preparation to support next firmware's WeatherSensor feature).current,forecast, andhistoricalscopes.Pirate Weather, and Weather Underground.
format=jsonfor watering-adjustment error responses while preserving the legacyresponse format.
Compatibility
Existing
/0through/3,/weatherData, and legacyweatherX.pyroutes remain supported.Legacy watering-adjustment responses remain the default unless
format=jsonis requested.Validation
npx tsc --noEmitnpm run buildCloses #178
Closes #179
This PR also incorporates or supersedes the work proposed in #144, #150, and #170.