rszimm / sprinklers_pi

Sprinkling System Control Program for the Raspberry Pi
GNU General Public License v2.0
309 stars 100 forks source link

sprinklers_pi stops running intermitently #184

Closed gargamelonly closed 8 months ago

gargamelonly commented 2 years ago

I am running sprinklers_pi for a long time now, about 2 years now, on a GreenIQ Gen2 hub. For some time I noticed that the service stops working for some reason which I could not find why. I find that it stops running when irrigation schedule stops and I could not reach the web interface. The Pi is pingable and SSH accessible so it is still running the OS. My way to power cycle the Pi. Is there a way to debug what is causing it to stop suddenly?

here are the last rows of the /var/log/ file:

` 2021/08/10 08:00:38 Adjusting H(-33)T(56)R(0):123 2021/08/10 08:00:38 Turning on Zone 5 2021/08/10 08:18:00 Turning Off All Zones 2021/08/10 16:30:00 Get Today's Weather 2021/08/10 16:30:01 curl error output: 2021/08/10 16:30:01 Parsed the following values: temp: 85 wind: 6.70 precip: 0.00 uv: 1.90 2021/08/10 16:30:01 Get Today's Weather for the hours between midnight and now 2021/08/10 16:30:02 curl error output: 2021/08/10 16:30:02 Parsed the following values: temp: 84 wind: 7.90 precip: 0.00 uv: 3.00 2021/08/10 16:30:02 Get Yesterday's Weather 2021/08/10 16:30:03 curl error output: 2021/08/10 16:30:03 Parsed the following values: temp: 84 wind: 7.30 precip: 0.00 uv: 1.80 2021/08/10 16:30:03 Adjusting H(-33)T(56)R(0):123 2021/08/10 16:30:03 Turning on Zone 4 2021/08/10 16:17:17 Starting v1.7.0.. 2021/08/10 16:17:17 Turning Off All Zones 2021/08/10 16:17:17 Listening on Port 8080 2021/08/10 16:17:17 Turning Off All Zones 2021/08/10 16:59:15 Get Today's Weather 2021/08/10 17:01:56 curl error output:

`

nhorvath commented 2 years ago

You could see what the log file says. Does the pi work normally aside from sprinklers pi when this occurs?

On Wed, Aug 11, 2021, 4:53 PM gargamelonly @.***> wrote:

I am running sprinklers_pi for a long time now, about 2 years now, on a GreenIQ Gen2 hub. For some time I noticed that the service stops working for some reason which I could not find why. I find that it stops running when irrigation schedule stops and I could not reach the web interface. The Pi is pingable and SSH accessible so it is still running the OS. My way to power cycle the Pi. Is there a way to debug what is causing it to stop suddenly?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/184, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABIJXBECKKC4TDULTOCQCLT4LPNTANCNFSM5B7OPBCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

gargamelonly commented 2 years ago

Comment updated with the tail of the /var/log. It looks like at 16:30, when zone 4 was scheduled to start, sprinklers_pi restarted but did not recover. Log timestamp is out of order. Irrigation log does not show it working from that day on.

gargamelonly commented 2 years ago

Here is another log and sprinklers_pi stopped again:

2021/08/13 16:30:14 Parsed the following values: temp: 85 wind: 6.90 precip: 0.00 uv: 1.80 2021/08/13 16:30:14 Adjusting H(-36)T(60)R(0):124 2021/08/13 16:30:14 Turning on Zone 4 2021/08/13 17:07:00 Turning Off All Zones 2021/08/13 17:50:52 Got a client 2021/08/13 17:50:52 Page:json/state 2021/08/13 17:50:52 Got a client 2021/08/13 17:50:52 Page:json/schedules 2021/08/13 17:50:58 Got a client 2021/08/13 17:50:58 Found a KV pair : -> 1628866252747 2021/08/13 17:50:58 Page:jquery/jquery.flot.min.js 2021/08/13 17:50:58 Serving Page: /web/jquery/jquery.flot.min.js 2021/08/13 17:50:58 Got a client 2021/08/13 17:50:58 Found a KV pair : -> 1628866252748 2021/08/13 17:50:58 Page:jquery/jquery.flot.time.min.js 2021/08/13 17:50:58 Serving Page: /web/jquery/jquery.flot.time.min.js 2021/08/13 17:50:58 Got a client 2021/08/13 17:50:58 Found a KV pair : -> 1628866252749 2021/08/13 17:50:58 Page:jquery/jquery.flot.resize.min.js 2021/08/13 17:50:58 Serving Page: /web/jquery/jquery.flot.resize.min.js 2021/08/13 17:50:58 Got a client 2021/08/13 17:50:58 Found a KV pair : -> 1628866252750 2021/08/13 17:50:58 Page:jquery/jquery.flot.orderBars.js 2021/08/13 17:50:58 Serving Page: /web/jquery/jquery.flot.orderBars.js 2021/08/13 17:50:58 Got a client 2021/08/13 17:50:58 Page:json/zones 2021/08/13 17:50:58 Got a client 2021/08/13 17:50:58 Found a KV pair : g -> h 2021/08/13 17:50:58 Found a KV pair : sdate -> 1628208000 2021/08/13 17:50:58 Found a KV pair : edate -> 1628812800 2021/08/13 17:50:58 Page:json/logs 2021/08/13 17:50:58 SELECT zone, strftime('%H', date, 'unixepoch') as hour, SUM(duration) FROM zonelog WHERE date BETWEEN 1628208000 AND 1628899200 GROUP BY zone,hour ORDER BY zone,hour 2021/08/13 17:50:58 Got a client 2021/08/13 17:50:58 Found a KV pair : g -> h 2021/08/13 17:50:58 Found a KV pair : sdate -> 1628208000 2021/08/13 17:50:58 Found a KV pair : edate -> 1628812800 2021/08/13 17:50:58 Page:json/logs 2021/08/13 17:50:58 SELECT zone, strftime('%H', date, 'unixepoch') as hour, SUM(duration) FROM zonelog WHERE date BETWEEN 1628208000 AND 1628899200 GROUP BY zone,hour ORDER BY zone,hour 2021/08/13 17:50:59 Got a client 2021/08/13 17:50:59 Found a KV pair : sdate -> 1628208000 2021/08/13 17:50:59 Found a KV pair : edate -> 1628812800 2021/08/13 17:50:59 Page:json/tlogs 2021/08/14 00:00:00 Reloading Midnight 2021/08/14 00:00:00 Turning Off All Zones 2021/08/14 08:00:00 Get Today's Weather 2021/08/14 08:00:19 curl error output:

nhorvath commented 2 years ago

Thanks there's probably a bug in handling the weather if we can't get a response. Is your internet often unstable in the morning? Which weather provider are you using?

On Sat, Aug 14, 2021, 2:32 AM gargamelonly @.***> wrote:

Here is another log and sprinklers_pi stopped again:

2021/08/13 16:30:14 Parsed the following values: temp: 85 wind: 6.90 precip: 0.00 uv: 1.80 2021/08/13 16:30:14 Adjusting H(-36)T(60)R(0):124 2021/08/13 16:30:14 Turning on Zone 4 2021/08/13 17:07:00 Turning Off All Zones 2021/08/13 17:50:52 Got a client 2021/08/13 17:50:52 Page:json/state 2021/08/13 17:50:52 Got a client 2021/08/13 17:50:52 Page:json/schedules 2021/08/13 17:50:58 Got a client 2021/08/13 17:50:58 Found a KV pair : -> 1628866252747 2021/08/13 17:50:58 Page:jquery/jquery.flot.min.js 2021/08/13 17:50:58 Serving Page: /web/jquery/jquery.flot.min.js 2021/08/13 17:50:58 Got a client 2021/08/13 17:50:58 Found a KV pair : -> 1628866252748 2021/08/13 17:50:58 Page:jquery/jquery.flot.time.min.js 2021/08/13 17:50:58 Serving Page: /web/jquery/jquery.flot.time.min.js 2021/08/13 17:50:58 Got a client 2021/08/13 17:50:58 Found a KV pair : -> 1628866252749 2021/08/13 17:50:58 Page:jquery/jquery.flot.resize.min.js 2021/08/13 17:50:58 Serving Page: /web/jquery/jquery.flot.resize.min.js 2021/08/13 17:50:58 Got a client 2021/08/13 17:50:58 Found a KV pair : -> 1628866252750 2021/08/13 17:50:58 Page:jquery/jquery.flot.orderBars.js 2021/08/13 17:50:58 Serving Page: /web/jquery/jquery.flot.orderBars.js 2021/08/13 17:50:58 Got a client 2021/08/13 17:50:58 Page:json/zones 2021/08/13 17:50:58 Got a client 2021/08/13 17:50:58 Found a KV pair : g -> h 2021/08/13 17:50:58 Found a KV pair : sdate -> 1628208000 2021/08/13 17:50:58 Found a KV pair : edate -> 1628812800 2021/08/13 17:50:58 Page:json/logs 2021/08/13 17:50:58 SELECT zone, strftime('%H', date, 'unixepoch') as hour, SUM(duration) FROM zonelog WHERE date BETWEEN 1628208000 AND 1628899200 GROUP BY zone,hour ORDER BY zone,hour 2021/08/13 17:50:58 Got a client 2021/08/13 17:50:58 Found a KV pair : g -> h 2021/08/13 17:50:58 Found a KV pair : sdate -> 1628208000 2021/08/13 17:50:58 Found a KV pair : edate -> 1628812800 2021/08/13 17:50:58 Page:json/logs 2021/08/13 17:50:58 SELECT zone, strftime('%H', date, 'unixepoch') as hour, SUM(duration) FROM zonelog WHERE date BETWEEN 1628208000 AND 1628899200 GROUP BY zone,hour ORDER BY zone,hour 2021/08/13 17:50:59 Got a client 2021/08/13 17:50:59 Found a KV pair : sdate -> 1628208000 2021/08/13 17:50:59 Found a KV pair : edate -> 1628812800 2021/08/13 17:50:59 Page:json/tlogs 2021/08/14 00:00:00 Reloading Midnight 2021/08/14 00:00:00 Turning Off All Zones 2021/08/14 08:00:00 Get Today's Weather 2021/08/14 08:00:19 curl error output:

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/184#issuecomment-898846122, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABIJXHYVRCMQSOBQVPZPKDT4YEZLANCNFSM5B7OPBCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

gargamelonly commented 2 years ago

Connection is usually very stable. I am using the last weather provider you added to replace Darksky, not sure but I think it's openweathermap. In any case, when there is no connection I assume we should use default times. Is weather data updated at 8AM? What if there is a scheduled watering at the same time?

nhorvath commented 2 years ago

Does this file exist "/tmp/openWeather.json". If so post the contents.

On Sat, Aug 14, 2021, 8:24 AM gargamelonly @.***> wrote:

Connection is usually very stable. I am using the last weather provider you added to replace Darksky, not sure but I think it's openweathermap.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/184#issuecomment-898887849, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABIJXF454DC6IGLZB2RLV3T4ZOBHANCNFSM5B7OPBCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

gargamelonly commented 2 years ago

Hi Nick, Yes, openweather is the one set in the config.h Here is the json file contents from tmp folder:

{"lat":32.1606,"lon":34.8841,"timezone":"Asia/Jerusalem","timezone_offset":10800,"current":{"dt":1628889270,"sunrise":16 28910251,"sunset":1628958380,"temp":80.64,"feels_like":84.47,"pressure":1009,"humidity":73,"dew_point":71.19,"uvi":0,"cl ouds":0,"visibility":10000,"wind_speed":3.44,"wind_deg":0,"weather":[{"id":800,"main":"Clear","description":"clear sky", "icon":"01n"}]},"hourly":[{"dt":1628812800,"temp":79.34,"feels_like":79.34,"pressure":1009,"humidity":76,"dew_point":71. 11,"uvi":0,"clouds":20,"visibility":10000,"wind_speed":5.75,"wind_deg":160,"weather":[{"id":801,"main":"Clouds","descrip tion":"few clouds","icon":"02n"}]},{"dt":1628816400,"temp":78.71,"feels_like":78.71,"pressure":1008,"humidity":71,"dew_p oint":68.52,"uvi":0,"clouds":20,"visibility":10000,"wind_speed":5.75,"wind_deg":160,"weather":[{"id":801,"main":"Clouds" ,"description":"few clouds","icon":"02n"}]},{"dt":1628820000,"temp":77.86,"feels_like":78.6,"pressure":1009,"humidity":6 9,"dew_point":66.88,"uvi":0,"clouds":0,"visibility":10000,"wind_speed":4.61,"wind_deg":140,"weather":[{"id":800,"main":" Clear","description":"clear sky","icon":"01n"}]},{"dt":1628823600,"temp":77.41,"feels_like":78.04,"pressure":1009,"humid ity":68,"dew_point":66.02,"uvi":0,"clouds":20,"visibility":10000,"wind_speed":3.44,"wind_deg":0,"weather":[{"id":801,"ma in":"Clouds","description":"few clouds","icon":"02n"}]},{"dt":1628827200,"temp":77.22,"feels_like":77.79,"pressure":1009 ,"humidity":67,"dew_point":65.41,"uvi":0.3,"clouds":0,"visibility":10000,"wind_speed":3.44,"wind_deg":0,"weather":[{"id" :800,"main":"Clear","description":"clear sky","icon":"01d"}]},{"dt":1628830800,"temp":80.94,"feels_like":82.71,"pressure ":1010,"humidity":58,"dew_point":64.78,"uvi":1.24,"clouds":20,"visibility":10000,"wind_speed":4.61,"wind_deg":150,"weath er":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02d"}]},{"dt":1628834400,"temp":84.97,"feels_like":89. 53,"pressure":1010,"humidity":61,"dew_point":70.02,"uvi":3.06,"clouds":20,"visibility":10000,"wind_speed":2.3,"winddeg" :0,"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02d"}]},{"dt":1628838000,"temp":87.13,"feels like":92.14,"pressure":1010,"humidity":57,"dew_point":70.05,"uvi":5.53,"clouds":20,"visibility":10000,"wind_speed":3.44, "wind_deg":0,"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02d"}]},{"dt":1628841600,"temp":90. 09,"feels_like":94.32,"pressure":1010,"humidity":49,"dew_point":68.36,"uvi":7.97,"clouds":20,"visibility":10000,"wind_sp eed":3.44,"wind_deg":0,"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02d"}]},{"dt":1628845200, "temp":90.52,"feels_like":96.06,"pressure":1010,"humidity":51,"dew_point":69.93,"uvi":9.61,"clouds":20,"visibility":1000 0,"wind_speed":9.22,"wind_deg":280,"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02d"}]},{"dt" :1628848800,"temp":91.8,"feels_like":95.61,"pressure":1010,"humidity":45,"dew_point":67.42,"uvi":9.77,"clouds":20,"visib ility":10000,"wind_speed":9.22,"wind_deg":270,"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02 d"}]},{"dt":1628852400,"temp":92.21,"feels_like":95.43,"pressure":1009,"humidity":43,"dew_point":66.49,"uvi":8.64,"cloud s":20,"visibility":10000,"wind_speed":11.5,"wind_deg":300,"weather":[{"id":801,"main":"Clouds","description":"few clouds ","icon":"02d"}]},{"dt":1628856000,"temp":92.43,"feels_like":94.91,"pressure":1009,"humidity":41,"dew_point":65.32,"uvi" :6.46,"clouds":20,"visibility":10000,"wind_speed":10.36,"wind_deg":300,"weather":[{"id":801,"main":"Clouds","description ":"few clouds","icon":"02d"}]},{"dt":1628859600,"temp":92.01,"feels_like":96.01,"pressure":1009,"humidity":45,"dew_point ":67.62,"uvi":3.97,"clouds":20,"visibility":10000,"wind_speed":10.36,"wind_deg":310,"weather":[{"id":801,"main":"Clouds" ,"description":"few clouds","icon":"02d"}]},{"dt":1628863200,"temp":91.58,"feels_like":93.9,"pressure":1009,"humidity":4 2,"dew_point":65.25,"uvi":1.85,"clouds":0,"visibility":10000,"wind_speed":9.22,"wind_deg":320,"weather":[{"id":800,"main ":"Clear","description":"clear sky","icon":"01d"}]},{"dt":1628866800,"temp":89.04,"feels_like":94.55,"pressure":1009,"hu midity":54,"dew_point":70.23,"uvi":0.57,"clouds":0,"visibility":10000,"wind_speed":8.05,"wind_deg":320,"weather":[{"id": 800,"main":"Clear","description":"clear sky","icon":"01d"}]},{"dt":1628870400,"temp":88.18,"feels_like":91.35,"pressure" :1009,"humidity":50,"dew_point":67.19,"uvi":0,"clouds":0,"visibility":10000,"wind_speed":6.91,"wind_deg":330,"weather":[ {"id":800,"main":"Clear","description":"clear sky","icon":"01d"}]},{"dt":1628874000,"temp":86.41,"feels_like":89.11,"pre ssure":1009,"humidity":52,"dew_point":66.72,"uvi":0,"clouds":0,"visibility":10000,"wind_speed":4.61,"wind_deg":320,"weat her":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}]},{"dt":1628877600,"temp":84.7,"feels_like":89.33 ,"pressure":1009,"humidity":62,"dew_point":70.25,"uvi":0,"clouds":0,"visibility":10000,"wind_speed":3.44,"wind_deg":0,"w eather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}]},{"dt":1628881200,"temp":83.01,"feels_like":8 7.62,"pressure":1009,"humidity":67,"dew_point":70.92,"uvi":0,"clouds":0,"visibility":10000,"wind_speed":5.75,"wind_deg": 330,"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}]},{"dt":1628884800,"temp":82.13,"feels_l ike":86.68,"pressure":1009,"humidity":70,"dew_point":71.37,"uvi":0,"clouds":0,"visibility":10000,"wind_speed":3.44,"wind _deg":0,"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}]},{"dt":1628888400,"temp":80.83,"fee ls_like":84.18,"pressure":1009,"humidity":69,"dew_point":69.71,"uvi":0,"clouds":0,"visibility":10000,"wind_speed":3.44," wind_deg":0,"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}]},{"dt":1628892000,"temp":79.56, "feels_like":79.56,"pressure":1008,"humidity":70,"dew_point":68.92,"uvi":0,"clouds":0,"visibility":10000,"wind_speed":3. 44,"wind_deg":0,"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}]},{"dt":1628895600,"temp":78 .91,"feels_like":78.91,"pressure":1008,"humidity":72,"dew_point":69.12,"uvi":0,"clouds":0,"visibility":10000,"wind_speed ":3.44,"wind_deg":0,"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}]}]}

On Sat, Aug 14, 2021 at 3:47 PM Nick Horvath @.***> wrote:

Does this file exist "/tmp/openWeather.json". If so post the contents.

On Sat, Aug 14, 2021, 8:24 AM gargamelonly @.***> wrote:

Connection is usually very stable. I am using the last weather provider you added to replace Darksky, not sure but I think it's openweathermap.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/rszimm/sprinklers_pi/issues/184#issuecomment-898887849 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AABIJXF454DC6IGLZB2RLV3T4ZOBHANCNFSM5B7OPBCA

. Triage notifications on the go with GitHub Mobile for iOS < https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675

or Android < https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/184#issuecomment-898890096, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHC6R2WGTKSMTMEF3KAEEJDT4ZQVLANCNFSM5B7OPBCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

gargamelonly commented 2 years ago

I noticed that once internet connection is down some time during the day, even if it resumes, sprinklers_pi stops working and resumes only once pi is rebooted. Ping to the pi continues to work when network is up but sprinklers_pi service is probably halted. Is there a way to resume the service or put a watchdog to restart it when it fails?

nhorvath commented 2 years ago

Is the service stopped or just non-functional. You should be able to set up restarts in sysctrl if it's completely dead. If not, there would have to be a way to detect that it was stuck.

On Thu, Sep 9, 2021 at 4:08 PM gargamelonly @.***> wrote:

I noticed that once internet connection is down some time during the day, even if it resumes, sprinklers_pi stops working and resumes only once pi is rebooted. Ping to the pi continues to work when network is up but sprinklers_pi service is probably halted. Is there a way to resume the service or put a watchdog to restart it when it fails?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/184#issuecomment-916400990, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABIJXFLN6LLJRKKNK7N42DUBEH5FANCNFSM5B7OPBCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

gargamelonly commented 2 years ago

The way I know it does not work is when I see my garden is not watered at the scheduled time and the web interface is not responding. After a restart I see in the schedule log that it skipped it. I am a newbie. Could you please help: How do I check the service status when it happens again? How to detect it and setup restarts?

nhorvath commented 2 years ago

This is probably happening if your internet is unstable when the weather report is grabbed in the morning. Restarting the service makes it get a new weather report. you could add a cron job to restart the service a short while before your first scheduled run if your internet is working better during that time.

On Thu, Sep 9, 2021 at 4:24 PM gargamelonly @.***> wrote:

The way I know it does not work is when I see my garden is not watered at the scheduled time and the web interface is not responding. After a restart I see in the schedule log that it skipped it. I am a newbie. Could you please help: How do I check the service status when it happens again? How to detect it and setup restarts?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/184#issuecomment-916411129, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABIJXCF362F36YROFFRMYDUBEJWPANCNFSM5B7OPBCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

gargamelonly commented 2 years ago

At what time in the morning does sprinklers_pi grab the weather report?

nhorvath commented 2 years ago

My mistake, it pulls the weather for each schedule at the start time of the schedule. So that workaround won't help. You could just do a restart every night at midnight (sprkinlerspi reloads at midnight anyway, but can't if it's crashed).

First check that systemclt service is setup right: systemctl status sprinklers_pi should return something like this:

pi@mirrorpi:~ $ systemctl status sprinklers_pi
● sprinklers_pi.service - LSB: Start sprinklers_pi daemon at boot time
   Loaded: loaded (/etc/init.d/sprinklers_pi)
   Active: active (running) since Mon 2021-08-23 13:17:07 EDT; 2 weeks 3 days ago
  Process: 548 ExecStart=/etc/init.d/sprinklers_pi start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/sprinklers_pi.service
           └─585 /usr/local/sbin/sprinklers_pi -L/var/log/sprinklers_pi

if that looks good, add a new line to /etc/crontab at the bottom: 1 0 * * * root systemctl restart sprinklers_pi

if not you need to fix your service setup (follow the install guide)

gargamelonly commented 2 years ago

I added the cron as you wrote but using "crontab -e"

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
0 6 * * * root systemctl restart sprinklers_pi

I am not sure why but status shows the following and web interface is not working:

pi@GreenIQ:~ $ systemctl status sprinklers_pi
● sprinklers_pi.service - LSB: Start sprinklers_pi daemon at boot time
   Loaded: loaded (/etc/init.d/sprinklers_pi; generated; vendor preset: enabled)
   Active: active (exited) since Fri 2021-09-10 01:01:17 IDT; 22h ago
     Docs: man:systemd-sysv-generator(8)
  Process: 312 ExecStart=/etc/init.d/sprinklers_pi start (code=exited, status=0/SUCCESS)

Sep 10 01:01:14 GreenIQ systemd[1]: Starting LSB: Start sprinklers_pi daemon at boot time...
Sep 10 01:01:17 GreenIQ sprinklers_pi[312]: Starting : sprinklers_pi.
Sep 10 01:01:17 GreenIQ systemd[1]: Started LSB: Start sprinklers_pi daemon at boot time.
nhorvath commented 2 years ago

crontab -e doesn't take a user, remove "root"

On Fri, Sep 10, 2021 at 4:46 PM gargamelonly @.***> wrote:

I added the cron as you wrote but using "crontab -e"

Edit this file to introduce tasks to be run by cron.

#

Each task to run has to be defined through a single line

indicating with different fields when the task will be run

and what command to run for the task

#

To define the time you can provide concrete values for

minute (m), hour (h), day of month (dom), month (mon),

and day of week (dow) or use '*' in these fields (for 'any').

Notice that tasks will be started based on the cron's system

daemon's notion of time and timezones.

#

Output of the crontab jobs (including errors) is sent through

email to the user the crontab file belongs to (unless redirected).

#

For example, you can run a backup of all your user accounts

at 5 a.m every week with:

0 5 1 tar -zcf /var/backups/home.tgz /home/

#

For more information see the manual pages of crontab(5) and cron(8)

#

m h dom mon dow command

0 6 * root systemctl restart sprinklers_pi

I am not sure why but status shows the following and web interface is not working:

@.***:~ $ systemctl status sprinklers_pi

● sprinklers_pi.service - LSB: Start sprinklers_pi daemon at boot time

Loaded: loaded (/etc/init.d/sprinklers_pi; generated; vendor preset: enabled)

Active: active (exited) since Fri 2021-09-10 01:01:17 IDT; 22h ago

 Docs: man:systemd-sysv-generator(8)

Process: 312 ExecStart=/etc/init.d/sprinklers_pi start (code=exited, status=0/SUCCESS)

Sep 10 01:01:14 GreenIQ systemd[1]: Starting LSB: Start sprinklers_pi daemon at boot time...

Sep 10 01:01:17 GreenIQ sprinklers_pi[312]: Starting : sprinklers_pi.

Sep 10 01:01:17 GreenIQ systemd[1]: Started LSB: Start sprinklers_pi daemon at boot time.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/184#issuecomment-917200460, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABIJXCSFZ3RPHRR65F5BYLUBJVAVANCNFSM5B7OPBCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

nhorvath commented 2 years ago

also add it to root's crontab sudo crontab -u root -e not your non privileged user's crontab.

On Fri, Sep 10, 2021 at 4:46 PM Nick Horvath @.***> wrote:

crontab -e doesn't take a user, remove "root"

On Fri, Sep 10, 2021 at 4:46 PM gargamelonly @.***> wrote:

I added the cron as you wrote but using "crontab -e"

Edit this file to introduce tasks to be run by cron.

#

Each task to run has to be defined through a single line

indicating with different fields when the task will be run

and what command to run for the task

#

To define the time you can provide concrete values for

minute (m), hour (h), day of month (dom), month (mon),

and day of week (dow) or use '*' in these fields (for 'any').

Notice that tasks will be started based on the cron's system

daemon's notion of time and timezones.

#

Output of the crontab jobs (including errors) is sent through

email to the user the crontab file belongs to (unless redirected).

#

For example, you can run a backup of all your user accounts

at 5 a.m every week with:

0 5 1 tar -zcf /var/backups/home.tgz /home/

#

For more information see the manual pages of crontab(5) and cron(8)

#

m h dom mon dow command

0 6 * root systemctl restart sprinklers_pi

I am not sure why but status shows the following and web interface is not working:

@.***:~ $ systemctl status sprinklers_pi

● sprinklers_pi.service - LSB: Start sprinklers_pi daemon at boot time

Loaded: loaded (/etc/init.d/sprinklers_pi; generated; vendor preset: enabled)

Active: active (exited) since Fri 2021-09-10 01:01:17 IDT; 22h ago

 Docs: man:systemd-sysv-generator(8)

Process: 312 ExecStart=/etc/init.d/sprinklers_pi start (code=exited, status=0/SUCCESS)

Sep 10 01:01:14 GreenIQ systemd[1]: Starting LSB: Start sprinklers_pi daemon at boot time...

Sep 10 01:01:17 GreenIQ sprinklers_pi[312]: Starting : sprinklers_pi.

Sep 10 01:01:17 GreenIQ systemd[1]: Started LSB: Start sprinklers_pi daemon at boot time.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/184#issuecomment-917200460, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABIJXCSFZ3RPHRR65F5BYLUBJVAVANCNFSM5B7OPBCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

gargamelonly commented 2 years ago

Here is the crontab content when run the command sudo crontab -u root -e

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
*/5 * * * * /home/pi/scripts/wifi_led.sh >/dev/null 2>&1
0 6 * * * systemctl restart sprinklers_pi

The wifi_led row is used to turn on the "link" led in the Greeniq box front panel when these is an active wifi connection. Anyway, why is the service not restarted automatically when internet connection is temporarily down?

nhorvath commented 2 years ago

Not sure. I haven't been able to replicate your issue.

On Fri, Sep 10, 2021, 5:18 PM gargamelonly @.***> wrote:

Here is the crontab content when run the command sudo crontab -u root -e

Edit this file to introduce tasks to be run by cron.

#

Each task to run has to be defined through a single line

indicating with different fields when the task will be run

and what command to run for the task

#

To define the time you can provide concrete values for

minute (m), hour (h), day of month (dom), month (mon),

and day of week (dow) or use '*' in these fields (for 'any').

Notice that tasks will be started based on the cron's system

daemon's notion of time and timezones.

#

Output of the crontab jobs (including errors) is sent through

email to the user the crontab file belongs to (unless redirected).

#

For example, you can run a backup of all your user accounts

at 5 a.m every week with:

0 5 1 tar -zcf /var/backups/home.tgz /home/

#

For more information see the manual pages of crontab(5) and cron(8)

#

m h dom mon dow command

/5 /home/pi/scripts/wifi_led.sh >/dev/null 2>&1 0 6 systemctl restart sprinklers_pi

The wifi_led row is used to turn on the "link" led in the Greeniq box front panel when these is an active wifi connection. Anyway, why is the service not restarted automatically when internet connection is temporarily down?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/184#issuecomment-917217877, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABIJXAH57X4KR6377P7EATUBJYZNANCNFSM5B7OPBCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

gargamelonly commented 2 years ago

Hi Nick, I see 3 possible scenarios to check:

  1. Wifi connection down-up with connection resumed.
  2. Only internet connection not available (controller ip still valid and wifi did not drop).
  3. Internet connection active and ok but only the weather service update cannot be reached.

Sorry I cannot help pinpoint it. What other options are valid in the code that may cause it to exit and stop the service?

fivad commented 2 years ago

Hi, I too have the same problems as @gargamelonly. In fact I 'm using sprinklers_pi (1.7.0) in two different homes, on raspberry pi 3+, both wired ethernet, both have been running for years like a charm. Lately I have very frequent failures and time wise I could also associate them with switching to OpenWeather. As I'm using ethernet, you can exclude WiFi (scenario 1) from the suspects list. I would also don't think that it's an internet connection issue, in both houses I have solid monitored connections with no disconnects. Let me know if I can provide any other useful info about this issue.

Wish we could find a solution to this as my plants don't look so happy any more.

nhorvath commented 2 years ago

It could be some unreliability in openweather. Personally I uae aeris.

On Sat, Sep 25, 2021, 11:39 AM fivad @.***> wrote:

Hi, I too have the same problems as @gargamelonly https://github.com/gargamelonly. In fact I 'm using sprinklers_pi (1.7.0) in two different homes, on raspberry pi 3+, both wired ethernet, both have been running for years like a charm. Lately I have very frequent failures and time wise I could also associate them with switching to OpenWeather. As I'm using ethernet, you can exclude WiFi (scenario 1) from the suspects list. I would also don't think that it's an internet connection issue, in both houses I have solid monitored connections with no disconnects. Let me know if I can provide any other useful info about this issue.

Wish we could find a solution to this as my plants don't look so happy any more.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/184#issuecomment-927138458, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABIJXHQ7S2HEZLM6QRUQ3LUDXUKDANCNFSM5B7OPBCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

gargamelonly commented 2 years ago

It shows as "exited" and the web interface is not working. I have a lot of lines with "Got a client" and then lines ending with "ERROR!" appearing in the sprinkler_pi log file after service restarted at the same time indicated below (14:17) Then at 16:30 when irrigation was supposed to start it did not but log shows "Get Today's Weather" and then "curl error output:" and log ends. Please help debug.

● sprinklers_pi.service - LSB: Start sprinklers_pi daemon at boot time
   Loaded: loaded (/etc/init.d/sprinklers_pi; generated; vendor preset: enabled)
   Active: active (exited) since Mon 2021-09-27 14:17:17 IDT; 2h 58min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 320 ExecStart=/etc/init.d/sprinklers_pi start (code=exited, status=0/SUCCESS)

Sep 27 14:17:15 GreenIQ systemd[1]: Starting LSB: Start sprinklers_pi daemon at boot time...
Sep 27 14:17:17 GreenIQ sprinklers_pi[320]: Starting : sprinklers_pi.
Sep 27 14:17:17 GreenIQ systemd[1]: Started LSB: Start sprinklers_pi daemon at boot time.
gargamelonly commented 2 years ago

@nhorvath , I have looked more into the log and it is definitely some bug in handling an error or some other timeout when trying to get weather data. The service hangs or exists and does not recover. Could you please look into fixing it?

fernplant commented 1 year ago

I had an issue today with mine being locked up. Had to manually restart the service and then back to working. My irrigation system is really critical this time of year so Im thinking about ways to bulletproof this so in case of failure, it automatically recovers. Any suggestions about auto restart on failure?

nhorvath commented 1 year ago

Was the process stopped or just hung? if the sprinkler_pi process was not running you can manage that with systemd to auto restart it.

fernplant commented 1 year ago

I believe it was stopped (I viewed list of running and was not there). I am weak in Linux knowledge, could you explain how I set that up with systemd? Thanks much! (Running Debian on Pi 4)

nhorvath commented 1 year ago

This is a pretty concise guide: https://ma.ttias.be/auto-restart-crashed-service-systemd/ After you set it up you can test it by running killall sprinklers_pi and it should restart it automatically after the delay.

gargamelonly commented 1 year ago

Based on my experience with this issue, I am running it on an RPI1, yes, first one, no WIFI, I had replaced both the SD card and WIFI dongle and all is good for the past 2+ years since then. I suspect that at the point where the SD cards begin failing there are random failing processes in the system. I advise you first replace the SD card and manually monitor the system for a few weeks.

nhorvath-bowery commented 1 year ago

I advise you first replace the SD card and manually monitor the system for a few weeks.

This is good advice. Also buy a name brand sd card they do really last longer.

fernplant commented 1 year ago

I have an SSD in mine so no worries there

I was able to get the service setup as described in the link you shared (thank you) but not properly, Im doing something wrong (again, my knowledge here is unfortunately very limited, sorry). The service starts successfully but uses default settings and not the settings/schedules Ive already saved I have for /etc/systemd/system/sprinklers_pi.service:

[Unit]
Description=sprinklers_pi

StartLimitIntervalSec=500
StartLimitBurst=5

[Service]
Restart=on-failure
RestartSec=5s

ExecStart=/usr/local/sbin/sprinklers_pi

[Install]
WantedBy=multi-user.target

For ExecStart I originally put /etc/init.d/sprinklers_pi start but that didn't work

nhorvath commented 1 year ago

Before ExecStart add WorkingDirectory=/usr/local/etc/sprinklers_pi Once you have it working can you please paste the file here, I'll add it to the repo for others.

fernplant commented 1 year ago

Really appreciate your help here. That was it. Works now. I killed the PID and it came back automatically in 5 seconds Do I assume correctly now that I want to remove the sprinklers_pi script from init.d?

[Unit]
Description=sprinklers_pi

StartLimitIntervalSec=500
StartLimitBurst=5

[Service]
Restart=on-failure
RestartSec=5s

WorkingDirectory=/usr/local/etc/sprinklers_pi
ExecStart=/usr/local/sbin/sprinklers_pi

[Install]
WantedBy=multi-user.target
nhorvath commented 1 year ago

Yes, that's correct you don't want the init.d file anymore since systemd will handle it. in your systemd status you should see that it's set to autostart. Hope this fixes your issue.

nhorvath commented 1 year ago

After you remove it run sudo update-rc.d sprinklers_pi remove to remove the symlinks for starting/stopping, but double check that didn't mess with your systemd script after.

fernplant commented 1 year ago

Thanks. I ran update-rc.d just now and it disabled the service. I had to re-enable it with systemctl enable sprinklers_pi . I then removed the script file from init.d