-
Notifications
You must be signed in to change notification settings - Fork 45
Support for Weatherlink Live data locally from Davis Weather Station #146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Support polling Weatherlink Live device for local weather data and streamline local provider logic
- Add request logging with morgan and new WEATHERLINK_URL polling branch in server.ts
- Implement Weatherlink Live polling, parsing, and queuing in
local.ts, removing old 23-hour delay logic - Include documentation and dependency updates for local Weatherlink Live integration
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| server.ts | Add morgan for logging and WEATHERLINK_URL-based polling logic |
| routes/weatherProviders/local.ts | Define data types, implement fetch helper and pollWeatherlink, update queue logic |
| package.json | Add morgan dependency |
| docs/davis-weatherlink.md | New guide for setting up local WeatherLink Live integration |
Comments suppressed due to low confidence (5)
server.ts:38
- [nitpick] The error message for missing WEATHERLINK_URL is not very descriptive; consider throwing an error or exiting the process with a clear message to avoid silent failures.
if (!weatherLinkUrl) console.error("Missing WEATHERLINK_URL.")
routes/weatherProviders/local.ts:166
- Consider adding unit tests for 'pollWeatherlink' (and the custom 'fetch' helper) to verify data parsing, error handling, and interval calculations.
export async function pollWeatherlink(weatherLinkUrl: string) {
docs/davis-weatherlink.md:20
- Typo in 'showiung'; should be 'showing'.
This is showiung that my weatherlink live instance name as `weatherlinklive-719e35`.
routes/weatherProviders/local.ts:5
- The 'url' module is imported but never used; consider removing this unused import to keep the code clean.
import * as url from "url";
routes/weatherProviders/local.ts:353
- [nitpick] The custom 'fetch' function shadows the global fetch API; consider renaming it (e.g., fetchText) to avoid confusion.
function fetch(urlString: string): Promise<string> {


I don't know what's going on with the other document about integrating with a Davis Weather Station, but it seems outdated and/or overcomplicated.
I'm using a weather link live device which has a local api for getting weather data. All I did was add some env variables and leverage the rest of the local weather service api.
I added a markdown doc explaining how to set it up.
I think I have all the units working right and left some comments to help out others.
I also removed the condition to wait 23 hours before ETo weather will work. The only measurement that will be incorrect is the precipitation because it hasn't accumulated yet. But for the other values, its averaging so that should be fine after just a single sample...
Let me know what you think! I now have a full local system going now :)