Comments (35)
from sprinklers_pi.
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.
Hi Nick,
I see 3 possible scenarios to check:
- Wifi connection down-up with connection resumed.
- Only internet connection not available (controller ip still valid and wifi did not drop).
- 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.
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.
from sprinklers_pi.
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.
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.
from sprinklers_pi.
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.
from sprinklers_pi.
from sprinklers_pi.
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.
from sprinklers_pi.
At what time in the morning does sprinklers_pi grab the weather report?
from sprinklers_pi.
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.
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.
from sprinklers_pi.
from sprinklers_pi.
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.
from sprinklers_pi.
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.
from sprinklers_pi.
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.
@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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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)
- Temperate Area Weather Adjustments - eg UK HOT 11
- Wunderground & Openweather currently broken HOT 1
- Problem with AM/PM setting upon Make HOT 3
- Zone status change report to Telegram bot (help wanted) HOT 5
- Schedule name length HOT 3
- add weather forecast source from weatherbit.io HOT 6
- add weather forecast source from tomorrow.io
- Is there a way to clear log entries? HOT 7
- DarkSky Depreciation HOT 6
- OpernWeather API call fails HOT 1
- Seems to not be loading Styles? HOT 3
- Comunication error HOT 6
- munication error with sprinkler-pi
- Openweather API fails, no free historical data for new users? HOT 3
- Comparison against opensprinkler HOT 7
- Cannot run more than one zone at once HOT 1
- Confused with how Sprinklers works. HOT 5
- WiringPi error RaspberryPi 4 HOT 3
- OW move from 2.5 to 3.0 call HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sprinklers_pi.