Open taHC81 opened 5 years ago
As far I remember, sprinkler are non efficace over 10 kmH, so around 25 kmh gust in 10 mn. Just put 99 for each one from arduino with your limit, then sprinklerpi can handle that.
From: taHC81 Sent: Friday, February 8, 2019 12:47 PM To: rszimm/sprinklers_pi Cc: Subscribed Subject: [rszimm/sprinklers_pi] Cancel watering when windy (#129)
Hi all, would it be possible to include wind speed into consideration? Like skip the watering if there's a wind stronger than some specific speed. I've got my own Arudino-based weather station providing also average wind speed (5-minute average) and max gust (from the same 5 minute interval). From the code I see the wind speed is also fetched from public weather services along with temperatures and humidity and could be easily used for this. Thanks!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
I've checked core.cpp and there's nothing related to wind. Even the WU diagnostics shows "Wind Yesterday: 1.6mph / 0.72 m/s", which definitely isn't actual wind which can be used to skip the watering.
Anyone to suggest where this could be added? core.cpp?
In here in weather.cpp you would return 0 if you want to prevent watering.
int16_t Weather::GetScale(const ReturnVals & vals) const
{
if (!vals.valid)
return 100;
const int humid_factor = NEUTRAL_HUMIDITY - (vals.maxhumidity + vals.minhumidity) / 2;
const int temp_factor = (vals.meantempi - 70) * 4;
const int rain_factor = (vals.precipi + vals.precip_today) * -2;
const int16_t adj = (uint16_t)spi_min(spi_max(0, 100+humid_factor+temp_factor+rain_factor), 200);
trace(F("Adjusting H(%d)T(%d)R(%d):%d\n"), humid_factor, temp_factor, rain_factor, adj);
return adj;
}
Aside from that though, you still need a way to get current wind speed. The wunderground request we make is for yesterday's averages, which also come with a predicted today. I'm not sure if the today prediction has wind in it. Either way it's not actual wind. If you do find something you can save it to windmph in Wunderground.cpp (or Aeris.cpp) and use it. I don't think windmph is used anywhere.
Thanks for the hint! As I mentioned in another thread, I've got Arudino-based weather station doing HTTP POST to a DB every 5 minutes, so I've got perfect data for that. And of course, I "know" current wind speed as well.
But in any case, I need to post some info about skipped watering into DB, to take it into consideration for next day - like if skipped, then water somehow more than calculated with formula :)
You might want to write your own custom weather plugin then that reads from the DB and checks the wind, then puts something in the DB for you to read tomorrow. You could report that you had negative inches of rain to force it to water more, for example. See this readme about adding a new weather provider: https://github.com/rszimm/sprinklers_pi/blob/master/DEV_WEATHER.md
@nhorvath I'm just prototyping PCB for OrangePi Zero, I can share it somewhere here in case of interest. photo
@taHC81 Looks nice, forever ago I designed a board that used triacs instead of relays for bulletproofness https://github.com/nhorvath/sprinklers_pi/tree/e513e873ac42a265d584e83f03813cd52204b0ba/hardware/Sprinkler%20Controller
If you want you can create a Wiki page for hardware and put it there.
Sure, but have to build & test first. It's single-sided (easier for home users), inspired by OpenSprinlerPi with common ground, thus no need for optotriacs (less components).
https://github.com/taHC81/sprinklers_pi/tree/master/hardware
@nhorvath , I'd like to implement what's mentioned in this topic - cancel or postpone schedule if currently windy. Cancel should be easy, but what if I'd like to implement something like if windy, postpone schedule by one hour (for this day only), and repeat after that hour, but f.i. do not retry after 7am (watering is planned at 4:30am). Any idea how to accomplish that? Is it possible with current code somehow easily, or some major update is required? Thanks for any suggestion ;)
Cancel would be easy for any weather adjusted schedule. Postpone would be very difficult. I didn't build the scheduler, @rszimm did, so I'm not sure how you would even go about temporarily altering a scheduled event. Possibly you could add and enable an additional scheduled time, but you would need some way to flag it for removal after it ran.
Cancel would be easy for any weather adjusted schedule. Postpone would be very difficult. I didn't build the scheduler, @rszimm did, so I'm not sure how you would even go about temporarily altering a scheduled event. Possibly you could add and enable an additional scheduled time, but you would need some way to flag it for removal after it ran.
Okay, so let's start with with easy one (cancel) - just return 0 in GetScale? If so, I will code in PHP to generate JSON with some value which leads to 0 watering (like 100mm rainfall on a past day).
Yeah basically edit GetScale in weather.cpp to return 0 if vals.windmph is over some threshold. Make sure vals.windmph is set to the current windspeed in the weather provider you are using. I know it's currently getting yesterday's speed for most if not all providers, but it's unused so you can change that.
On Tue, Apr 2, 2019 at 9:22 AM taHC81 notifications@github.com wrote:
Cancel would be easy for any weather adjusted schedule. Postpone would be very difficult. I didn't build the scheduler, @rszimm https://github.com/rszimm did, so I'm not sure how you would even go about temporarily altering a scheduled event. Possibly you could add and enable an additional scheduled time, but you would need some way to flag it for removal after it ran.
Okay, so let's start with with easy one (cancel) - just return 0 in GetScale? If so, I will code in PHP to generate JSON with some value which leads to 0 watering (like 100mm rainfall on a past day).
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/129#issuecomment-478992829, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKE3PFdHCJyy0JRKE-hE3vmZI-hA2V-ks5vc1mDgaJpZM4avNHy .
So, I've added new keypair for windspeed, had to modify Weather.h, web.cpp & web/WCheck.htm to have it included. If I correctly understood the program flow, weather adjustment is applied in ProcessEvents->LoadSchedTimeEvents->DurationAdjustments - thus right before we start the watering event. If so, then I really need to add a line like below, to GetScale:
if (wind_ms_5min_avg > 3) adj = 0;
Even if not used, I've added UV index to JSON data, getting it from WU website for my location, parsed using PHP, code below:
$wh = file_get_contents("https://www.wunderground.com/health/sk/hlohovec?cm_ven=localwx_moduv"); $uvstart = strpos($wh, "uvIndex-label label-xxlarge"); $uv = substr($wh, strpos($wh, ">", $uvstart) + 1); $uv = substr($uv, 0, strpos($uv, "<"));
Plus script will notify me via e-mail, if parsing fails, like WU web get changed.
Yes that sounds right.
On Wed, Apr 3, 2019 at 9:39 AM taHC81 notifications@github.com wrote:
So, I've added new keypair for windspeed, had to modify Weather.h, web.cpp & web/WCheck.htm to have it included. If I correctly understood the program flow, weather adjustment is applied in ProcessEvents->LoadSchedTimeEvents->DurationAdjustments - thus right before we start the watering event. If so, then I really need to add a line like below, to GetScale: if (wind_ms_5min_avg > 3) adj = 0;
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/129#issuecomment-479493385, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKE3MO4agovdo-xOvgtxIXdzRQ3MLZHks5vdK8IgaJpZM4avNHy .
Modified, checked - working :) Would be great to have it logged with some new tag, like Sched: M for manual runs. Maybe with zero runtime and W like Windy. Already digging into it.
Uh-oh, I spend some nights with that, and decided to omit. Still can't fully understand program flow and made more issues than enhancements. On the other hand, I set my SprinklersPi into production with home-made relay board, and now selling Hunter X-CORE :) Will do the final update to Eagle files and share with crowd.
Hello In the end how did you fix the problem of the wind and what are the files to modify, it interests me, thanks
Hello In the end how did you fix the problem of the wind and what are the files to modify, it interests me, thanks
Hello, basically you need to get the your current local wind speed (or let's say 5 minute floating average) and populate it within weather data in JSON reply. With this data available, you can modify Weather.cpp and add something like:
if (vals.wind_ms_5min_avg > WIND_THRESHOLD){ return 0}
But please note, i'm generating JSON reply by PHP script with data from my private meteo station.
I wish I could get it back on Darksky. but I do not control well enough the language of programming...
Hi all, would it be possible to include wind speed into consideration? Like skip the watering if there's a wind stronger than some specific speed. I've got my own Arudino-based weather station providing also average wind speed (5-minute average) and max gust (from the same 5 minute interval). From the code I see the wind speed is also fetched from public weather services along with temperatures and humidity and could be easily used for this. Thanks!