GithubHelp home page GithubHelp logo

Comments (35)

nhorvath avatar nhorvath commented on August 15, 2024 1

from sprinklers_pi.

gargamelonly avatar gargamelonly commented on August 15, 2024 1

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?

from sprinklers_pi.

gargamelonly avatar gargamelonly commented on August 15, 2024 1

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?

from sprinklers_pi.

nhorvath avatar nhorvath commented on August 15, 2024 1

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.

from sprinklers_pi.

nhorvath avatar nhorvath commented on August 15, 2024

from sprinklers_pi.

gargamelonly avatar gargamelonly commented on August 15, 2024

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.

from sprinklers_pi.

gargamelonly avatar gargamelonly commented on August 15, 2024

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:

from sprinklers_pi.

nhorvath avatar nhorvath commented on August 15, 2024

from sprinklers_pi.

gargamelonly avatar gargamelonly commented on August 15, 2024

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?

from sprinklers_pi.

nhorvath avatar nhorvath commented on August 15, 2024

from sprinklers_pi.

gargamelonly avatar gargamelonly commented on August 15, 2024

from sprinklers_pi.

gargamelonly avatar gargamelonly commented on August 15, 2024

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?

from sprinklers_pi.

nhorvath avatar nhorvath commented on August 15, 2024

from sprinklers_pi.

gargamelonly avatar gargamelonly commented on August 15, 2024

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

from sprinklers_pi.

nhorvath avatar nhorvath commented on August 15, 2024

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)

from sprinklers_pi.

gargamelonly avatar gargamelonly commented on August 15, 2024

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.

from sprinklers_pi.

nhorvath avatar nhorvath commented on August 15, 2024

from sprinklers_pi.

nhorvath avatar nhorvath commented on August 15, 2024

from sprinklers_pi.

gargamelonly avatar gargamelonly commented on August 15, 2024

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?

from sprinklers_pi.

nhorvath avatar nhorvath commented on August 15, 2024

from sprinklers_pi.

fivad avatar fivad commented on August 15, 2024

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.

from sprinklers_pi.

nhorvath avatar nhorvath commented on August 15, 2024

from sprinklers_pi.

gargamelonly avatar gargamelonly commented on August 15, 2024

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.

from sprinklers_pi.

gargamelonly avatar gargamelonly commented on August 15, 2024

@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?

from sprinklers_pi.

fernplant avatar fernplant commented on August 15, 2024

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?

from sprinklers_pi.

nhorvath avatar nhorvath commented on August 15, 2024

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.

from sprinklers_pi.

fernplant avatar fernplant commented on August 15, 2024

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)

from sprinklers_pi.

nhorvath avatar nhorvath commented on August 15, 2024

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.

from sprinklers_pi.

gargamelonly avatar gargamelonly commented on August 15, 2024

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.

from sprinklers_pi.

nhorvath-bowery avatar nhorvath-bowery commented on August 15, 2024

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.

from sprinklers_pi.

fernplant avatar fernplant commented on August 15, 2024

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

from sprinklers_pi.

fernplant avatar fernplant commented on August 15, 2024

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

from sprinklers_pi.

nhorvath avatar nhorvath commented on August 15, 2024

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.

from sprinklers_pi.

nhorvath avatar nhorvath commented on August 15, 2024

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.

from sprinklers_pi.

fernplant avatar fernplant commented on August 15, 2024

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

from sprinklers_pi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.