Forum Replies Created
-
AuthorPosts
-
mstormoMember@Dan in CA wrote:
@mstormo, I didn’t intend to imply that the bug you found was obscure, only that even obscure bugs are worth fixing.
Heh no worries, even I felt it looked a bit obscure (who sets an empty string in a name field anyways?! I do, apparently), which is why I thought it would be good to just explain how I got there.
@Dan in CA wrote:
I’m a little hesitant to make any major changes to the current UI until we see how his UI develops. That’s why I have been concentrating on the plugin system and bug fixes in the core program.
I think that’s a wise choice. Let’s get both branches stabilized and merged first.
Btw, idea for a simple plugin: Temperature threshold. Once temperature hits a certain low, disable all zones. (Maybe simply overriding the current watering level to 0%?)
mstormoMember@Dan in CA wrote:
I am thinking about changing the snames.txt file to json format. That should allow more free form names.
Right, and probably better overall design, since you can parse those directly without any regexp magic.
However, scottsh was referring to the log file, which is in CSV format. Even with snames.txt in json format, you still have that problem, unless you just say the log file isn’t CSV but just plain text..
mstormoMember@Dan in CA wrote:
@scottsh, The point was that having a blank station name could cause the entire program to stop working under certain conditions. Even the most obscure bugs are worth fixing.
Not so obscure really, I was using the sprinkler_pi application which was on the pre-configured SD card. It had zone 1 hardcoded to Master Valve, and since I didn’t need any master valve, I simply used zones 2-8. So, when I moved to your application, I didn’t bother to move all the terminals, but just removed the Zone 1 name, to make it a little cleaner to look at, instead of S1 or “Master Valve”. 🙂
But I guess this segways over to scottsh’s original question, should the UI be tweaked to allow for showing less zones than bulks of 8 per expansion board?
Personally, if I had the opportunity to enable/disable zones in the UI so the disabled ones wouldn’t show, I would probably do that, to keep things as clean as possible. I do the same with the home automation system. It has a ton of possible options, but I only show what use the most, and which makes it easier for the wifey. Happy wife, happy life..
mstormoMember@Dan in CA wrote:
Still needed work. The zone names in the log were not correct. This is why the regex was there.
changed “zones=re.findall(r”‘(.+?)'”,gv.snames)” to “zones=re.findall(r”‘(.*?)'”,gv.snames)” on line ~89Awesome, works for me now!
Thank you Dan!Btw, with your last change you’re outputting all the zone names to stdout on every Zone Off, intentional or debug output left behind? 🙂
Again, thanks!
mstormoMemberDan,
Saw the commit come through, and looks reasonable indeed. Will check it tomorrow.
Really appreciate the work!
Thanks!
mstormoMember@salbahra wrote:
Also, for what it’s worth, I am not able to reproduce this error.
…
1) Stations: Set station 1 to blank, save
2) Switch to manual mode
3) Turn station 8 on, no error
4) Turn station 8 off, no error
5) Repeat 4 and 5 in tandem 4 times, no errorHuh, odd.. You wouldn’t see any error in the web interface though, except that zones are not getting enabled anymore. But this works for you?
@salbahra wrote:
Errors are both web and python output.
/me not parse. You mean you see no error neither on web nor python output? Very odd..
mstormoMember@salbahra wrote:
I wasn’t suggesting, by any means, we ignore the blank station issue. Anyways, you understood my point.
Indeed 🙂 Yes, to protect it, yes to support blank zones.
Here’s an idea: Maybe a control system like this should be two processes: One really small kernel, only responsible for changing the zone states, and “watch-dog” checking iff any zone is currently on, how long it has been since the zone state has changed. If zone-state has not changed in say (configurable) 60 minutes, turn off all zones and stop the kernel. Then a separate process will do all the rest, keeping schedules, communicating with apps, weather checking etc etc. If the second process does something unthinkable and crashes, at least the kernel will detect an issue after 60 minutes and kill the flow.
Obviously you have HW watchdogs etc, but a HW watchdog wouldn’t work in the case we’ve seen right now. The Pi didn’t crash, the control program didn’t crash, it just didn’t change the states anymore.
*shrug*
mstormoMember@Dan in CA wrote:
With the system in ‘fail’ mode, could you post a cat of the file OSPi/data/snames.txt ?
That may be where the problem is.
I get when the first name is blank.pi@ospi ~/OSPi/data $ cat snames.txt
Yes, that’s what I see on my side. If first entry is blank, and you click Zone 8 on and off again, **poof**
mstormoMember@salbahra wrote:
Maybe wrap the log write within a try? Or anything interacting with the SD card?
While that would technically solve the issue, it’s more hiding a symptom rather than fixing the cause. Really, empty zone names should be fine, as zone names are just convenience for humans. The control system shouldn’t care about the name, and just report it as is, empty or not. However, log files missing entries because the zone name happens to be empty is not so good.
I’m not saying the logging functionality shouldn’t be protected by a try/catch. Obviously, having the control system barf due to an issue with logging isn’t good. I’m just afraid that try/catch can make a programmer lazy 🙂
mstormoMemberOk, just set first zone to ”, and click zone 8 on/off in manual mode, and *poof*. Reproducable 100% 🙂
mstormoMember@Dan in CA wrote:
I’ve been trying but have not been able to get the system to fail as you describe.
I’ve tested a bit more, and it seems to only happen when Zone 0 has an empty name? At least that’s when it’s reproducible for me.
pi@ospi ~/OSPi/data $ cat snames.txt
@Dan in CA wrote:
On thing that is interesting is the fact that the log entries are stopping and not showing all data. SD cards have a limited number of write cycles. The recommendation is to use something else like a flash drive to store log data.
Sorry, I meant that when the ospi daemon starts failing it also stops logging anything. The card is fine, and I have an 8GB High Performance (30MB/s) SanDisk card in there.
pi@ospi ~/OSPi/static/log $ cat water_log.csv
Program, Zone, Duration, Finish Time, Date
# Back to original setup, got failure again
Manual, ,, 0m7s, 19:18:07, Tue. 29 Apr 2014
Manual, ,, 0m6s, 19:17:58, Tue. 29 Apr 2014
Manual, ,, 0m5s, 19:17:50, Tue. 29 Apr 2014
Manual, ,, 0m5s, 19:17:44, Tue. 29 Apr 2014
Manual, ,, 0m5s, 19:17:38, Tue. 29 Apr 2014
Manual, ,, 0m5s, 19:17:31, Tue. 29 Apr 2014
Manual, ,, 0m5s, 19:17:24, Tue. 29 Apr 2014
Manual, ,, 0m4s, 19:17:17, Tue. 29 Apr 2014
Manual, ,, 0m5s, 19:17:11, Tue. 29 Apr 2014
Manual, ,, 0m5s, 19:17:05, Tue. 29 Apr 2014
Manual, ,, 0m4s, 19:16:59, Tue. 29 Apr 2014
# Changes Zone 0 to ‘Master Valve’, even if I don’t use it
# Couldn’t reproduce the issue in this setup
Manual, Front left, 0m10s, 19:13:49, Tue. 29 Apr 2014
Manual, Front right, 0m16s, 19:13:37, Tue. 29 Apr 2014
Manual, Curb, 0m4s, 19:13:16, Tue. 29 Apr 2014
Manual, Front left, 0m12s, 19:13:09, Tue. 29 Apr 2014
Manual, Curb, 0m11s, 19:13:05, Tue. 29 Apr 2014
Manual, Drive way, 0m9s, 19:12:52, Tue. 29 Apr 2014
Manual, Curb, 0m6s, 19:12:38, Tue. 29 Apr 2014
Manual, Front right, 0m15s, 19:12:30, Tue. 29 Apr 2014
Manual, Front left, 0m12s, 19:12:12, Tue. 29 Apr 2014
Manual, Curb, 0m6s, 19:11:54, Tue. 29 Apr 2014
Manual, Curb, 0m5s, 19:11:46, Tue. 29 Apr 2014
Manual, Curb, 0m4s, 19:11:39, Tue. 29 Apr 2014
Manual, Curb, 0m5s, 19:11:32, Tue. 29 Apr 2014
Manual, Curb, 0m5s, 19:11:25, Tue. 29 Apr 2014
Manual, Curb, 0m4s, 19:11:15, Tue. 29 Apr 2014
Manual, Curb, 0m4s, 19:11:08, Tue. 29 Apr 2014
Manual, Curb, 0m4s, 19:11:01, Tue. 29 Apr 2014
Manual, Curb, 0m7s, 19:10:55, Tue. 29 Apr 2014
Manual, Curb, 0m8s, 19:10:45, Tue. 29 Apr 2014
# Orignal setup, with a blank Zone 0
Manual, ,, 0m28s, 16:41:20, Tue. 29 Apr 2014
Manual, ,, 0m13s, 16:40:41, Tue. 29 Apr 2014
Manual, ,, 0m15s, 16:40:23, Tue. 29 Apr 2014
Manual, ,, 0m6s, 16:40:03, Tue. 29 Apr 2014
Manual, ,, 0m6s, 16:39:52, Tue. 29 Apr 2014
Manual, ,, 0m7s, 16:39:41, Tue. 29 Apr 2014
Manual, ,, 0m9s, 16:39:29, Tue. 29 Apr 2014
Manual, ,, 0m7s, 16:39:14, Tue. 29 Apr 2014
Manual, ,, 0m6s, 16:39:01, Tue. 29 Apr 2014
Manual, ,, 0m6s, 16:38:51, Tue. 29 Apr 2014
Manual, ,, 0m11s, 16:38:07, Tue. 29 Apr 2014
As you can see from the log, when I have a blank name for Zone 0, the log file always says , ,, and I think that’s key to the problem, and when you suddenly get Index Out of Range issues.
mstormoMemberAh, here we go! Ok, ran the ospi.py directly with console output, and here’s what I got
pi@ospi ~/OSPi $ sudo python ospi.py
plugins loaded:
[]
Starting timing loophttp://0.0.0.0:8080/
10.0.0.29:1837 – – [29/Apr/2014 19:16:47] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1837 – – [29/Apr/2014 19:16:47] “HTTP/1.1 GET /static/scripts/java/svc1.8.3/home.js” – 304 Not Modified
10.0.0.29:1835 – – [29/Apr/2014 19:16:47] “HTTP/1.1 GET /static/images/icons/svc_options.png” – 304 Not Modified10.0.0.29:1839 – – [29/Apr/2014 19:16:47] “HTTP/1.1 GET /static/images/icons/svc_log.png” – 304 Not Modified10.0.0.29:1836 – – [29/Apr/2014 19:16:47] “HTTP/1.1 GET /static/images/icons/svc_edit.png” – 304 Not Modified10.0.0.29:1838 – – [29/Apr/2014 19:16:47] “HTTP/1.1 GET /static/images/icons/svc_cal.png” – 304 Not Modified10.0.0.29:1837 – – [29/Apr/2014 19:16:47] “HTTP/1.1 GET /static/images/icons/svc_reset.png” – 304 Not Modified
10.0.0.29:1835 – – [29/Apr/2014 19:16:47] “HTTP/1.1 GET /static/images/icons/svc_rain.png” – 304 Not Modified10.0.0.29:1840 – – [29/Apr/2014 19:16:47] “HTTP/1.1 GET /static/scripts/java/svc1.8.3/manualmode.js” – 304 Not Modified10.0.0.29:1839 – – [29/Apr/2014 19:16:47] “HTTP/1.1 GET /static/images/icons/svc_start.png” – 304 Not Modified10.0.0.29:1836 – – [29/Apr/2014 19:16:47] “HTTP/1.1 GET /static/images/icons/svc_auto.png” – 304 Not Modified
10.0.0.29:1838 – – [29/Apr/2014 19:16:47] “HTTP/1.1 GET /static/images/icons/svc_reboot.png” – 304 Not Modified
10.0.0.29:1839 – – [29/Apr/2014 19:16:57] “HTTP/1.1 GET /sn7=1&t=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:16:57] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:00] “HTTP/1.1 GET /sn7=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:00] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:02] “HTTP/1.1 GET /sn7=1&t=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:02] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:06] “HTTP/1.1 GET /sn7=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:06] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:09] “HTTP/1.1 GET /sn7=1&t=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:09] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:12] “HTTP/1.1 GET /sn7=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:12] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:15] “HTTP/1.1 GET /sn7=1&t=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:15] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:19] “HTTP/1.1 GET /sn7=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:19] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:22] “HTTP/1.1 GET /sn7=1&t=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:22] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:25] “HTTP/1.1 GET /sn7=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:25] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:28] “HTTP/1.1 GET /sn7=1&t=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:28] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:32] “HTTP/1.1 GET /sn7=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:32] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:35] “HTTP/1.1 GET /sn7=1&t=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:35] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:39] “HTTP/1.1 GET /sn7=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:39] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:42] “HTTP/1.1 GET /sn7=1&t=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:42] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:45] “HTTP/1.1 GET /sn7=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:45] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:48] “HTTP/1.1 GET /sn7=1&t=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:48] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:51] “HTTP/1.1 GET /sn7=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:51] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:55] “HTTP/1.1 GET /sn7=1&t=0” – 303 See Other
10.0.0.29:1839 – – [29/Apr/2014 19:17:55] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1839 – – [29/Apr/2014 19:17:59] “HTTP/1.1 GET /sn7=0” – 303 See Other
10.0.0.29:1852 – – [29/Apr/2014 19:17:59] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1852 – – [29/Apr/2014 19:18:03] “HTTP/1.1 GET /sn6=1&t=0” – 303 See Other
10.0.0.29:1852 – – [29/Apr/2014 19:18:03] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1852 – – [29/Apr/2014 19:18:09] “HTTP/1.1 GET /sn6=0” – 303 See Other
10.0.0.29:1852 – – [29/Apr/2014 19:18:09] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1852 – – [29/Apr/2014 19:18:11] “HTTP/1.1 GET /sn8=1&t=0” – 303 See Other
10.0.0.29:1852 – – [29/Apr/2014 19:18:11] “HTTP/1.1 GET /” – 200 OK
Unhandled exception in thread started by
Traceback (most recent call last):
File “ospi.py”, line 249, in timing_loop
log_run()
File “ospi.py”, line 98, in log_run
‘s, ‘+time.strftime(“%H:%M:%S, %a. %d %b %Y”, time.gmtime(gv.now))+’n’)
IndexError: list index out of range
# !!!!!
# After this none of the zones would trigger anymore, even though server reports ok, web page does indicate that zones don’t change
# !!!!!
10.0.0.29:1852 – – [29/Apr/2014 19:18:21] “HTTP/1.1 GET /sn8=0” – 303 See Other
10.0.0.29:1852 – – [29/Apr/2014 19:18:21] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1852 – – [29/Apr/2014 19:18:28] “HTTP/1.1 GET /sn7=1&t=0″ – 303 See Other
10.0.0.29:1852 – – [29/Apr/2014 19:18:28] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1852 – – [29/Apr/2014 19:18:34] “HTTP/1.1 GET /sn7=1&t=0″ – 303 See Other
10.0.0.29:1852 – – [29/Apr/2014 19:18:34] “HTTP/1.1 GET /” – 200 OK
10.0.0.29:1852 – – [29/Apr/2014 19:18:38] “HTTP/1.1 GET /sn7=1&t=0″ – 303 See Other
10.0.0.29:1852 – – [29/Apr/2014 19:18:38] “HTTP/1.1 GET /” – 200 OK
mstormoMember@Dan in CA wrote:
I just pushed an update to GitHub (master branch only) that should fix this problem.
Try updating and let me know how it goes.Great! The zone are now off when the system starts up.
However, I’ve noticed some instabilities in the state handling. To test the system I’ve been running the zones manually, but after a certain time (not sure if it’s time or state change based) the system will not react to manual changes. Even if I use commands such as Stop Operations, Manual Off, etc I cannot change the current state. My only choice is to reboot 😯 (or terminate the daemon and restart it).
It happens consistently for me, and one time it stopped while one of my zones were on, and I couldn’t shut it off..
The log file is not helping, as it stops logging when I get to this state. Also, my first zone is “”, since I don’t use it due to having used Sprinkler_pi before and it uses Zone 0 as Master Valve. Maybe it’s due to that, but my log file does not indicate which zones I have been triggering, it’s always empty:
Program, Zone, Duration, Finish Time, Date
Manual, ,, 0m28s, 16:41:20, Tue. 29 Apr 2014
Manual, ,, 0m13s, 16:40:41, Tue. 29 Apr 2014
Manual, ,, 0m15s, 16:40:23, Tue. 29 Apr 2014
Manual, ,, 0m6s, 16:40:03, Tue. 29 Apr 2014
Manual, ,, 0m6s, 16:39:52, Tue. 29 Apr 2014
Manual, ,, 0m7s, 16:39:41, Tue. 29 Apr 2014
Manual, ,, 0m9s, 16:39:29, Tue. 29 Apr 2014
Manual, ,, 0m7s, 16:39:14, Tue. 29 Apr 2014
Manual, ,, 0m6s, 16:39:01, Tue. 29 Apr 2014
Manual, ,, 0m6s, 16:38:51, Tue. 29 Apr 2014
Manual, ,, 0m11s, 16:38:07, Tue. 29 Apr 2014The log file only contains this many entries, even though the settings says 999?
My last run had the following zone changes until it hung:
Zone 2: Toggle x 20 times
Zone 5: Toggle x 1 time
Zone 7: Toggle x 1 time
Now if I try to toggle zone 6 it won’t change the state. The daemon is operational, and I can change the site pages. The same happens when I use the Mobile App against the OpenSprinkler Pi Interval daemon, it stops responding and the mobile app gets out of sync.I’m not a Python expert, so not sure how to debug this in more detail. If you want to populate a branch with tons of printf’s or other instrumentations, I be willing to run that for you to figure out what’s going on 😆
Might be prudent to have some sort of test framework in place, as these sort of failures can get very expensive if someone is not home to monitor the water usage..
Thanks!
mstormoMember@Dan in CA wrote:
I just pushed an update to GitHub (master branch only) that should fix this problem.
Try updating and let me know how it goes.Thanks Dan,
I’ve give it a go tomorrow!
January 15, 2014 at 2:51 am in reply to: sprinklers_pi – An alternative sprinkler control program #25042
mstormoMemberRichard,
Awesome software! I just replaced the “dumb” box (a Hunter X-Core, 8-zone) with sprinklers_pi, and it feels liberating!
A couple of questions:
- 1. How do you cancel a Quick Schedule? Rest System on the Advanced page? 😆
- 2. How about showing how long a manual zone has been running on the main page? Right now it just says –:–
- 3. How about taking “tomorrow’s” weather into account as well? I’d hate for it to run a full soak on my lawn when there’s 80% of a Thunderstorm the next day. (I live in Houston Texas, it pours here!)
Again, thank you for your efforts!
-
AuthorPosts