-
Notifications
You must be signed in to change notification settings - Fork 49
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
Weather level adjustment not working #35
Comments
I had some errors like this when I setup this module. One thing my install was missing the weather_decipher.json file. Another thing is how are you entering your city into the location? |
I tried to create a pull request with my solution to this problem since I encountered it tonight while finally getting around to updating my system. That default file was not automatically provided when downloading the weatheradjust plugin. The below code just creates that config file if it can't be read. The code is far from perfect as it does not handle corruptions to that file all that well but it should get the job done. Let me know if I should create a pull request for this but my attempts were all met with 403 errors. plugins/weather_level_adj.py
201c201,218
< 'status': checker.status
---
> 'status': checker.status,
> 'weather_decipher' : {
> 'Description': 'WeatherCodes and Weights',
> 'PrecipCodes': {
> "HeavyRain": [210, 211, 212, 502, 503, 504, 522, 531],
> "Rain": [200, 201, 230, 231, 232, 313, 314, 500, 501],
> "Drizzle": [300, 301, 302, 310, 311, 312, 321, 520, 804],
> "Clear": [800, 801],
> "Overcast": [802, 803],
> },
> 'PrecipWeights': {
> "HeavyRain": 0,
> "Rain": 10,
> "Drizzle": 30,
> "Clear": 100,
> "Overcast": 80
> }
> }
213,214c230,236
< with open('./data/weather_decipher.json', 'r') as f: # Read the settings from file
< result['weather_decipher'] = json.load(f)
---
> try:
> with open('./data/weather_decipher.json', 'r') as f: # Read the settings from file
> result['weather_decipher'] = json.load(f)
> except:
> print "Building default file: ./data/weather_decipher.json"
> with open('./data/weather_decipher.json', 'w') as w: # write the settings to file
> json.dump(result['weather_decipher'], w) |
Sorry for the delay in getting back to you. I had a disk crash and am just getting thing back together. Fortunately I had a fairly recent backup. I had not taken a close look at the updates on the weather plugins. The plugin should have included all the necessary files but there is a separate folder on the plugins repo named "data_example" which contains the "weather_decipher.json" file among many other things. There is no indication on the plugins repo that the "data_example" files are related to the weather plugins. The plugin system SIP uses includes a file named "[plugin_name].manifest" that tells SIP which files to download and where to put them. I will work on adding the "weather_decipher.json" file and any other necessary files to the manifest and the plugins folders on the repo so that they will be installed with the rest of the plugin. |
Glad you were not down for long. Can be such a pain to loose a drive. Just installing the file directly seams like a straightforward solution vs mine of creating the file if it doesn't exist. I went with the creating of the file since the plugin already is creating weather_adj.json and weather_level_adj.json files with default values and it seams a bit more robust to when the data directory gets clobbered. Either way it great to see this working again and will be nice to make it work for others without fiddling. |
I think it would be good add your code. |
Actually adding "weather_decipher.json" to the plugin directories and the manifest files did not work. There also needs to be at least one folder (weather_current) and perhaps a "weather_level_history" folder created in the data directory. That will need to be generated by the plugin code since attempting copy a folder from GitHub resulted in a blank text file instead of a folder. I am working on updating the plugin but it may be a day or two before things are working properly. |
There might be some interactions between weather_level_adj and weather_adj as well that I didn't dive though. I deleted the plugins and re-installed them and the only file was not created was weather_decipher.json that my patch tries to takes care of, The data directory was created after the first lookup but then again the two plugins might help each others get all the files created and you might have found a bigger issue. |
Yes. I am using your code to generate the weather_decipher.json. |
I didn't get much chance to use it this year since I never had to run our sprinkler system, but when I monitored what the plugging might do it appears to not remember things from day to day. When I looked a little, it never wrote any of the historical data to the file system. Is that what you have seen?
Steve
Get Outlook for Android<https://aka.ms/ghei36>
…________________________________
From: Dan <[email protected]>
Sent: Sunday, September 8, 2019 3:42:59 PM
To: Dan-in-CA/sip_plugins <[email protected]>
Cc: Steve Bauer <[email protected]>; Comment <[email protected]>
Subject: Re: [Dan-in-CA/sip_plugins] Weather level adjustment not working (#35)
Yes. I am using your code to generate the weather_decipher.json.
I am in the early stages of testing the weather_level_adj plugin and have already found a number of things that needed fixing.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#35?email_source=notifications&email_token=ABW4IEYN37WFKCMWO6EBXPDQIVWWHA5CNFSM4H6S35G2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6F2COY#issuecomment-529244475>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABW4IE63OTBZLS6XLBZ7F7DQIVWWHANCNFSM4H6S35GQ>.
|
There was a problem with the plugin code not creating a folder in the data directory where the weather data was supposed to be saved. Some users have eliminated the problem by manually creating a folder named weather_level_history in the SIP/data directory. I still have some testing and clean up to do but I think it is getting close to a properly working plugin |
Just an update: So far I have added a feature to select between units of (inch, deg F) and (mm, deg C) on the plugin options page. I should be able to post the update by the end of next week if things seem to be working properly. There is rain predicted here for tomorrow so that will provide a good test opportunity. |
Excellent work. Sounds like all nice additions.
…On Sun, Sep 15, 2019, 8:25 AM Dan ***@***.***> wrote:
Just an update:
I got a little carried away with the update on the weather_level_adj
plugin.
So far I have added a feature to select between units of (inch, deg F) and
(mm, deg C) on the plugin options page.
I also have been testing the use of lat-lon geographic coordinates for the
location field which gives more accurate weather data according to the
OpenWeather docs.
I have also added a documentation page which should make things a bit
easier to get the plugin working.
I should be able to post the update by the end of next week if things seem
to be working properly.
There is rain predicted here for tomorrow so that will provide a good test
opportunity.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#35?email_source=notifications&email_token=AASW5UCE54PYUOINZBDLYQ3QJZHVHA5CNFSM4H6S35G2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6XS7SI#issuecomment-531574729>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AASW5UFQZI4YTA6ZLC5KAITQJZHVHANCNFSM4H6S35GQ>
.
|
OK. The weather_level_adj plugin update Is now available. It still needs work but it seems to be fully functional. One problem is that it stores a lot of redundant data that is not used by the plugin. This can cause wear on the Pi's SD card. I need to focus on getting SIP Python3 compatible by the end of the year when support for Python2 will end. During that process I will be working through all the plugins and will make updates as appropriate. For a long time I have thought abut making a weather based plugin that uses an estimate of evapotranspiration (ET) for the calculations. That should be much better at saving water and is what "smart" irrigation controllers are based on. One major problem has been that most weather services including OpenWeatherMap don't provide solar radiation data which is central to the calculations. It is possible to estimate solar radiation from other weather data but it is not very accurate. I just discovered that NASA now has an online source of world wide solar radiation data that is in the public domain and has an easy to use API. Combining that resource with OpenWeather looks like it will provide the necessary data. |
Thanks for your hard work. I also had problems with the location configuration but it might have been another late night hickup. |
That round error is strange. I tested the update with a fresh install of SIP and the plugin worked as expected. You might try updating the OS on your pi with |
Hi, I installed the weather_level_adj plugin and am getting the following upon restart of SIP (entering the info in the plugin settings seemed ok as the "status" was just blank): Weather-based water level encountered error: |
Hi, I figured it out. The document "how to" Weather_level_adj Plugin Documentation mentions entering the coordinates as: lat=XXX.XXX_lonXXX.XXX, so I did it exactly so. It actually needs to be: lat=XXX.XXX_lon=XXX.XXX (missing the "=" for lon. Simple goof on my part. Document probably just needs updated for noobs! API was returning "nothing to geocode" before. |
Hi,
I just installed the plugin for the weather level adjustment. I entered all the details like Openweather API, City etc...
I get everytime the following message:
Weather-base water level encountered error: Traceback (most recent call last): File "/home/pi/SIP/plugins/weather_level_adj.py", line 97, in run today = today_info(self, options) File "/home/pi/SIP/plugins/weather_level_adj.py", line 316, in today_info data = get_data(name, request, 'weather', options) File "/home/pi/SIP/plugins/weather_level_adj.py", line 234, in get_data req = urllib2.urlopen(url + "&appid=" + options['apikey']) File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python2.7/urllib2.py", line 435, in open response = meth(req, response) File "/usr/lib/python2.7/urllib2.py", line 548, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib/python2.7/urllib2.py", line 473, in error return self._call_chain(*args) File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain result = func(*args) File "/usr/lib/python2.7/urllib2.py", line 556, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) HTTPError: HTTP Error 404: Not Found
Any ideas?
The text was updated successfully, but these errors were encountered: