Closed DrTron closed 2 years ago
I believe that it's not 24 measurements but 24 hours (i.e., one day) of measurements. That makes some sense, since the Zimmerman method depends upon average temperature and average humidity over the past 24 hours. In that case, it's the second "if" statement that's triggering the error, based on not having samples for more than 23 hours.
Thanks. I just noticed that it's been around 23 hours since I started the weewx feed, so that would explain it. Is there a way to check which data the server already has? The only file in the directory that seems to get updated is "geocoderCache.json", and that only contains "[]".
I vaguely recall having this problem when using the eTO method because the solar radiation parameter was zero. I'm not at a place where I can look at the code, but it might be expecting solar radiation even though that's not used by Zimmerman.
I'm pretty sure that the data is maintained in a memory array within the program. [I'm an old guy and my memory is getting really terrible. I spent a lot of time looking though the code last year, but don't recall much.]
I'm pretty sure that the data is maintained in a memory array within the program.
That would mean that whenever the system/weather server is restarted, it wouldn't work for the next 24 hours. Which would be somewhat disappointing.
I took a quick look at the code, and the data are cached in a file "observations.json." I don't have time to follow the logic as to when/how that file is updated or read.
You are right, seems like the function saveQueue does that for everything that's less than 24 hours old:
function saveQueue() { queue = queue.filter(function (obs) { return moment().unix() - obs.timestamp < 24 * 60 * 60; }); try { fs.writeFileSync("observations.json", JSON.stringify(queue), "utf8"); }
Given that, I should be seeing that file, which I don't. npm is currently running as root for testing, so it can't be a permissions problem...
In your .env file do you have "LOCAL_PERSISTENCE=true" ?
I have now, although I can't say that I've seen that option in the docs anywhere. Doesn't seem to make a difference, either, at least there's still no observations.json file. And I still get "error 10". I had the impression that "WEATHER_PROVIDER=local" in .env meant that local data needs to be cached for 24h.
That did it after all. It took a while, but observations.json showed up eventually and got filled with weather data in json format. After that, I had to wait a day until the "24h" condition was met and the data could be used for the Zimmerman method. But then I got meaningful scale values back and I was able to set my OsPi to use the local PWS.
That's definitively something that should go into the Readme here: https://github.com/OpenSprinkler/OpenSprinkler-Weather/blob/master/docs/local-installation.md
The DarkSky API is one of the best weather services I know, but even so my local data differs, especially for the rainfall data. So thanks again for the help and for the possibility to use one's own weather data to calculate watering times.
All,
I, too, am trying to get OpenSprinkler to use my own data, so I installed the weather server in conjunction with weewx. However, I'm getting the above error in the logs, and the http-reply is "&errCode=10&scale=100"
Does anyone have an idea what that error code "10" is? Where does the weather server store the data it gets, if at all?
Thanks!
Edit: I see in the errors.ts that Error 10 is:
InsufficientWeatherData = 10, /** A necessary field was missing from weather data returned by the API. */
In Wunderground.js I find:// Fail if not enough data is available. if (samples.length !== 24) { throw new errors_1.CodedError(errors_1.ErrorCode.InsufficientWeatherData);
So obviously 24 measurements are needed. That time (sample every 5 minutes) has long passed. Or is it this from local.ts?if ( queue.length == 0 || queue[ 0 ].timestamp - queue[ queue.length - 1 ].timestamp < 23*60*60 ) { console.error( "There is insufficient data to support Zimmerman calculation from local PWS." ); throw new CodedError( ErrorCode.InsufficientWeatherData );
That would indicate that at least 24 hours must have passed...