Skip to content

Conversation

@ccorcos
Copy link

@ccorcos ccorcos commented Jan 17, 2024

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 :)

@ccorcos
Copy link
Author

ccorcos commented Jan 17, 2024

Phew. There was some annoying bugs to figure out there.

  • Node versions are annoying and making http requests.
  • For some reason, mDNS isn't working on my raspberry pi so I'm just using the IP address instead.

I think everything looks good now though. Here's the numbers in OpenSprinkler as they compare to Weatherlink

Screenshot 2024-01-17 at 3 19 56 PM Screenshot 2024-01-17 at 3 20 14 PM

@salbahra salbahra requested a review from Copilot June 6, 2025 23:46
Copy link

Copilot AI left a 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> {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant