Coder Social home page Coder Social logo

dan-in-ca / sip Goto Github PK

View Code? Open in Web Editor NEW
355.0 61.0 156.0 5.23 MB

A highly customizable DIY irrigation/sprinkler controller based on Raspberry Pi

Python 89.11% HTML 8.01% JavaScript 1.60% CSS 1.22% Shell 0.06%
irrigation drip-irrigation hydroponics sprinkler-controller water-usage raspjberry-pi

sip's Introduction

SIP

Sustainable Irrigation Platform

SIP is a free Raspberry Pi based Python program for controlling irrigation systems ( sprinkler, drip, hydroponic, etc ). It uses web technology to provide an intuitive user interface (UI) in several languages. The UI can be accessed in your favorite browser on desktop, laptop, and mobile devices. SIP has also been used to control pumps, lights, and other Irrigation related equipment.

The core program is very versatile and there is a growing number of available plugins for added functionality.

Software support:

Starting with version 5, SIP runs under Python 3. Python 2.x support has been removed.
Most of the required Python packages and modules such as web.py and Cheroot are included in SIP's GitHub repository.
Installing SIP by cloning from GitHub enables easy upgrades via git pull on the command line or by using the included System_Update plugin.

To install, simply clone SIP into the /home/pi/ directory of your Raspberry Pi:
sudo git clone https://github.com/Dan-in-CA/SIP.git
Or use the install script described in the documentation wiki.

If you are running Raspberry Pi OS Lite you may need to install git first with:
sudo apt-get install git.
For complete setup and usage instructions see the SIP documentation wiki.

Hardware support:

SIP is developed and tested on Raspberry Pi although there is limited support for Beagle Bone Black and Odroid-C2. It has been tested on most Raspberry Pi models including Pi Zero.

There are a number of options for connecting SIP to an irrigation system including relay boards and hats connected directly to the Pi's GPIO pins as well as OpenSprinkler boards and a simple DIY interface that can support a large number of stations while using only 4 GPIO pins.

Communication with other systems

  • SIP can be controlled and monitored using HTTP GET commands.
  • With the addition of available plugins SIP can communicate with other systems via MQTT.
  • there is a Node-RED plugin included with SIP that allows Node-RED flows to control SIP and receive status information from SIP.
  • SIP can also issue Linux shell commands when a station is turned on or off. This is useful for controlling wireless remote devices and for I2C relay hats and boards.
  • There is also a mobile_app plugin shipped with SIP that transmits and receives SIP settings and status information in json format.
  • The Blinker package that is shipped with SIP sends messages to other Python modules such as plugins to report changes in status. See the signaling_examples.py file in SIP's plugins folder for examples.

Get involved

The motivation for developing SIP is to enable a very low cost yet sophisticated solution for the efficient use of irrigation water, an increasingly scarce resource world wide.

SIP has been greatly improved by contributions, large and small, from the user community.
For example all the UI language translations have been contributed by users. If you would like to contribute a language translation or update an existing one please see the translation instructions on the wiki. It is rather easy.

To report a bug or contribute to the SIP project open an issue or pull request.

To ask question, make suggestions and learn more about SIP please see the Discussions tab in this repository or visit the SIP Forum


GNU GPL License

sip's People

Contributors

bkoblenz avatar cbright avatar dan-in-ca avatar dannf avatar duanemay avatar embak avatar geo-sot avatar geosot avatar heegard avatar hmoffatt avatar imharris avatar jonathan-marsh avatar jzapater avatar knesch avatar martinpihrt avatar materdaddy avatar mekenthompson avatar mihugo avatar mikedevita avatar noschvie avatar pelado-mat avatar rimco avatar salbahra avatar sbruggeman avatar scottshaffer avatar teodoryantcheff avatar thep33t avatar trevorhobson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sip's Issues

Relative path for email plugin

When the email plugin attempts to open the log to email it assumes an absolute path so fails if ospi is not installed there. Consider making this path relative.

self.try_mail(subject, body, "/home/pi/ospi/data/log.json")

Use a symbolic link for sip.py

I think the instructions are right on the money suggesting that users use the init.d mechanism for starting and stopping OSPi (SIP). I would suggest that users use a symbolic link rather than moving a copy of sip.py to /etc/init.d. That way, if improvements are released to sip.py, users will get to take advantage of them right away (especially if they use the upgrade plugin to keep their install fresh).

I would also suggest putting the "Recommended Method" above the "Detailed Instructions", or maybe moving the "Detailed Instructions" to a "How to Develop" page. I don't want to make it harder for developers, just easier for the folks that just want to download and get their lawns watered.

I'd make the changes myself, but I'm not sure of the moderation policy/process. Hope this helps.

More of a Question

I have a Raspberry Pi B+ and a Sainsmart 5v 8 Channel relay module. Is it possible to use OPSi with this setup?

using modern web technologies like bootstrap

Have you ever thought about using modern client-side web technologies like bootstrap and some sort of client-side framework like angular for the sprinkler webui?

It'd clean things up quite a bit and make the code more maintainable. I'd be happy to fork and make an attempt if its something you'd consider merging it in.

send email plugin, check pressure plugin

Hi Dan,
a) I need to send email (for example, via smtp google) if it starts raining and when finished program. I do not know how the plugin to obtain information about the running program
b) I need a plugin that checks the pressure in the pipe (if the water) on the GPIO input. Again, I do not know how to determine whether the plugin is running a master when there is no pressure to 20 sec and stop all station error and send email.

Thanks for any advice. I had something similar in my ospi 1.8.3 and I would like to use the new UI 2.xx (as a plugin) ....

Thank you Martin

Plugin permissions

I have been getting reports of my app not working with OSPi. I started to troubleshoot this issue and noticed after cloning the repo no plugins get loaded.

plugins loaded:
[]
Starting timing loop 
http://0.0.0.0:8080/

Is there anyway to prevent this or at least make an exception for provided plugins?

Programs are running for twice the time they were set for

Steps:
_Create a new station
*_Start Time: 6:00am
*_Duration: 60m
*_Choose Monday/station
*_Select Single Pass
*_Save

_View the expected program:
*_Hit "Home"
**Go to the next Monday

Note:
The stations is now set to run for double the original time (ie: 2 runs of 60m)

I've been wasting twice the water over this :/.

Adds temperature for beaglebone black

This seems to be the cpu's temp. Various post claim that it's not very accurate, but it might be better than nothing.

--- a/ospi.py
+++ b/ospi.py
@@ -105,8 +105,12 @@ def clear_mm():
 def CPU_temperature():
     """Returns the temperature of the Raspberry Pi's CPU."""
     try:
-        res = os.popen('vcgencmd measure_temp').readline()
-        return(res.replace("temp=","").replace("'C\n",""))
+        if gv.platform == 'bo':
+            res = os.popen('cat /sys/class/hwmon/hwmon0/device/temp1_input').readline()
+            return (str(int(float(res)/1000)))
+        else:
+            res = os.popen('vcgencmd measure_temp').readline()
+            return(res.replace("temp=","").replace("'C\n",""))
     except:
         pass

Pickle error on 2.0.1

Hello,

I know I have discussed the pickle error when multiple requests come in to OSPi. My understanding was that the code that generated this error was older and not used on the main branch which I think was true. However, on version 2.0.1 I am noticing the pickle errors when using the mobile app (which issues 5 simultaneous requests to the firmware). These are causing intermittent errors leading to app failure. Just wanted to bring this to your attention in case this is something that can be addressed.

Thank you!

Installed but doesn't run correctly

I installed the software per the directions but I am getting error messages after it starts.

The http address at the beginning shows as http://0.0.0.0:8080/ (Not as an error)

After the "Starting timing loop" line I get the following:

Traceback (most recent call last):
File "ospi.py", line 204, in
app.run()
File "ospi.py", line 157, in run
return web.httpserver.runsimple(func, ('0.0.0.0', port))
File "/home/pi/OSPi/web/httpserver.py", line 157, in runsimple
server.start()
File "/home/pi/OSPi/web/wsgiserver/init.py", line 1753, in start
raise socket.error(msg)
socket.error: No socket could be created

This is on a new installation of Raspberry PI Noobs. Network is using WIFI adapter and is online.

Default port

Hey, thanks for the great port os OS to Python! As someone new to OS/OSPi I followed the instructions:
http://rayshobby.net/mediawiki/index.php/Python_Interval_Program_for_OSPi#Installation

But as I did:
sudo python ospi.py
I got:

Traceback (most recent call last):
  File "ospi.py", line 214, in <module>
    app.run()
  File "ospi.py", line 162, in run
    return web.httpserver.runsimple(func, ('0.0.0.0', port))
  File "/home/pi/clouden-master/web/httpserver.py", line 157, in runsimple
    server.start()
  File "/home/pi/clouden-master/web/wsgiserver/__init__.py", line 1753, in start
    raise socket.error(msg)
socket.error: No socket could be created

Which is due to another service using the default port 80 (apache2, of course). So as a suggestion, you can update the instructions to either run OSPi/SIP on a different port by default, or tell the user to issue a:

sudo service apache2 stop

I think apache2 is set to run by default on the latest version of Raspbian, but I'm not 100% sure as I was using the OS image.

Was svc_back.png dropped from v2 intentionally?

The image svc_back.png was dropped from 2.x. Was that intentional?

I was using it in my plug-in and I can carry it myself if it was by design. It just seems strange because it doesn't look like any other of those icons were dropped.

Scott

High CPU Utilization

I pulled version 8d12fac onto a clean Raspbian installation (September 2014 version). All I did before the pull was a few raspi_config tasks (expand partition, reset password, set time zone, change hostname, etc.). Running from the command line (sudo python ospi.py), I am getting rather high CPU utilization rates as displayed by sudo top:

top - 21:52:27 up 11 min,  2 users,  load average: 1.82, 1.13, 0.54
Tasks:  66 total,   1 running,  65 sleeping,   0 stopped,   0 zombie
%Cpu(s): 87.9 us, 12.1 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.0 si,
KiB Mem:    447864 total,    83056 used,   364808 free,    10472 buffer
KiB Swap:   102396 total,        0 used,   102396 free,    38592 cached

  PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND  
 2456 root      20   0  130m  12m 3276 S  97.9  2.9   3:26.22 python   
    7 root      20   0     0    0    0 S   0.7  0.0   0:01.57 rcu_pree 
 2544 root      20   0  4672 1396 1036 R   0.7  0.3   0:00.28 top      

Is this typical? Utilization drops to nothing as soon as I kill OSPi. I'm barking up this tree, because in the few days it was running my prior OSPi installation became progressively more sluggish, laggy, and unresponsive. CPU temperature was stable at about 60C (operating inside a sealed enclosure).

Hardware-wise, I'm running on a Model B Pi with 512 MB or RAM. It's still attached to the OpenSprinker Pi board, but I'm powering it via the USB port with an iPhone charger.

This is the same issue as described on the OpenSprinker forum.

Thanks,
Alex

Internal server error

I updated OSPI this afternoon to version 2.2.46 and now having issues.

First is that when I try to edit programs I get a message :internal server error" I have deleted programs and can't create any new etc. I can run "Run Once" programs and verified that they are working.

And I have tried doing restart and reboot but neither helped. I also purged the OSPi program and deleted the OSPi directory and reinstalled. It did not help either.

plugin weather delay gives error

I was seeing this error

Checking weather status...
Weather-base water level encountered error:
Traceback (most recent call last):
  File "/home/pi/OSPi.nov212014/plugins/weather_level_adj.py", line 85, in run
    history = history_info()
  File "/home/pi/OSPi.nov212014/plugins/weather_level_adj.py", line 320, in history_info
    'humidity': float(day_info['humidity'])
ValueError: could not convert string to float: 

I worked around by changing line 320 in weather_level_adj.py

'humidity': float(day_info['humidity']) if day_info['humidity'].isdigit() else 0

Similar check could be added to other data. Cheers

New install

Currently, on a new install the location is empty and for some reason it outputs as nothing (not even quotes). This triggers a javascript syntax error (loc: ,).

If you kill the app and restart it, it works fine.

OpenSprinkler with relay board

Hello,
Can i used OpenSprinkler with a relay board?
I don't have a OpenSprinkler Pi (OSPi)
what i habe to do for this?

thanks a lot

Mobile Interface

I just finished building a mobile interface that runs 100% in the user's browser (no more PHP). I would like to integrate this into your project now since it should be quite easy. The only thing needed to make the UI work is the JSON output of current variables (ideally, the same output format as the OpenSprinkler). The OpenSprinkler uses the following commands: /jc (settings), /js (station status), /jo (options), /jn (station names), and /jp (programs). More information can be found here: http://rayshobby.net/phpBB3/viewtopic.php?f=2&t=403

If you could replicate these then all that's needed is a check for a mobile browser and redirecting to the mobile html file. The code for my app is posted here: https://github.com/salbahra/OpenSprinkler-Hosted-Controller. Currently, the code is multi-site aware however that can easily be removed and integrated with your python code to provide a seamless mobile UI.

If you are interested, please let me know and I can help with this integration. Thanks!

Provide a way to config the baseurl, and allow https proxied.

I run nginx at home to proxy all of my web traffic, and drop an ssl in front of everything.

if you drop an SSL nginx reverse proxy infront of OSPi two defects occur.

  1. you are redirected to the http://<hostname>/login instead of https://<hostname>/login
  2. some/most of the static assets are loaded via http://, when really they should be loaded with //, this will allow them to be loaded for both https and http.

Steps to reproduce

  1. put an nginx reverse proxy in front of the OSPi interface.
  2. visit the "home" url, it will redirect to http://<hostname>/login
  3. force that URL to be https://<hostname>/login and none of the static assets will load.

I would be happy to fork, and attempt to fix these two things and issue a PR.

OSPi JM_UI

Hello,

I have been having a hard time dealing with support for my mobile app and I finally discovered a lot of people are using the new branch which hides a lot of the variables from the header and also lacks plugin support.

Is there anyway we can update the JM_UI branch to support plugins? I don't need the variables in the various pages so long the plugin works.

Thanks!

Couple spelling errors

i18n\en_US\LC_MESSAGES\ospi_messages.po
line: 358 should be: Access Plugins
two "s"

i18n\en_US\LC_MESSAGES\ospi_messages.po
line: 603 should be: Range address
two "d"

i18n\en_US\LC_MESSAGES\ospi_messages.po
line: 945 extra space

By the way, Dan, I think this project is great. I thank you for your continued work on this. If I ever figure out how to do git / github I will contribute code and help.

missing gmt offset

Just pulled the latest version: 2.2.30 (2015-02-21) and the field for setting the gmt offset is gone. Now time reads gmt instead of what I had set.

I can set the time from ssh but I am assuming most will need to set it from web interface.

Move water_log.csv into data folder?

The model of the data folder is good - runtime settings are localized to prevent sharing, and making it easy to backup and to update the interface without losing the settings.

Why then is the log over in the "static" folder? Could we move the "log" folder to the "data" folder and keep all the files that can change at runtime in one place?

(BTW, not suggesting that you need to fix these suggestions, just that it's good to keep track of them somewhere so contributors looking for ideas can pick up something and run with it ;-)

A new clone of master fails

I had a running V2.1.2 system on a OSBo and did a git pull recently, now ospi.py fails to start with a ImportError: no module named i18n. I do see that there is a directory in your master repository, but no file. If I comment that out, other errors are present.

Is your master repository missing files or should I be using something else these days?

Brian

Program runs twice

I'm running on a beaglebone from the JM_UI branch. Although, the preview shows only one instance of the program, it runs twice in succession. The log and history show it has run 2x.

I'd think that if the current time == the program end time, the program shouldn't run.

Steve
The following change fixed the problem:

--- a/ospi.py
+++ b/ospi.py
@@ -143,7 +143,7 @@ def prog_match(prog):
             if lt[2]==31 or (lt[1]==2 and lt[2]==29): return 0
             elif lt[2]%2 !=1: return 0
     this_minute = (lt[3]*60)+lt[4] # Check time match
-    if this_minute < prog[3] or this_minute > prog[4]: return 0
+    if this_minute < prog[3] or this_minute >= prog[4]: return 0
     if prog[5] == 0: return 0
     if ((this_minute - prog[3]) / prog[5]) * prog[5] == this_minute - prog[3]:
         return 1 # Program matched

weather_adj.py scheduling

In the weather_adj plugin, shouldn't
sched.add_cron_job(weather_to_delay, hour=1)
be
sched.add_interval_job(weather_to_delay, hours=1)?

To my understanding, the first statement runs weather_to_delay every day at 01:00 instead of every hour.

Program Data Incorrect in JSON

If you create an interval program on OSPi (current) you will notice different output for the days0 variable (element number 2 in array).

You can compare the /jp output with /vp and notice /vp has it correct.

Any idea why or how to fix?

Example (first program is weekly and second is an interval program):

Output from /vp:

pd=[];pd[0]=[1,21,0,120,600,1439,2520,255,255];pd[1]=[1,128,17,0,1439,1439,3960,255,255];

Output from /jp (what the mobile app uses):

 "pd": [[1, 21, 0, 120, 600, 1439, 2520, 255, 255], [1, 130, 17, 0, 1439, 1439, 3960, 255, 255]]

Original post: http://rayshobby.net/phpBB3/viewtopic.php?f=33&t=626

Rain delay countdown doesn't update display

It looks like this change in templates/home.html broke the screen update.

256                         var remaining = timerValue - devt; //Date.now(); // DK change

Now devt only gets updated when the page is refreshed. The problem with Date.now is that it is in UTC and the rain delay stop time is local time. I'm not much of a javascript hacker, but here is an attempt at fixing it. This will break if the browser is in a different time zone than the controller. Maybe the stop time should be maintained in UTC or the controller time zone offset passed to the browser.

If you have a preferred approach to fixing this, let me know and I'll try to cook up a patch.

Steve

--- a/templates/home.html
+++ b/templates/home.html
@@ -250,9 +254,12 @@ $code:
                });

                function countdownTimer(timerId) {
+                       var time_now = new Date();
+                       var offset = time_now.getTimezoneOffset(); // in minutes
+                       var time_local = time_now.setMinutes(time_now.getMinutes() - offset); // adjust to local time
                        var timerElement = jQuery("#" + timerId);
                        var timerValue = parseFloat(timerElement.attr("data"));
-                       var remaining = timerValue - devt; //Date.now(); // DK change
+                       var remaining = timerValue - time_local;
                        var rHours = Math.floor(remaining/3600000);
                        var rMinutes = Math.floor((remaining%3600000)/60000);
                        if (rHours <=0 && rMinutes <=0) {

Addon feature doesn't work correctly

I'm planning to add flow sensors into my garden irrigation system that's using OSPi so I was just starting to check out the addon stub that's in the existing code. I tried to just access the new web endpoint, /c1, that should be added by code in ospi_addon.py but when I access it in the browser, it says "not found".

I think I've tracked this down to a problem which as to do with how ospi.py and ospi_addon.py import each other. I've written a very simple example that illustrates the problem but basically what's going on is there ends up being two instances of the list variable "urls". One associated with the main script and one associated with the module ospi (which is the name of the main script file). When ospi_addon extends the list of endpoints, it's extending a version of "urls" that is associated with the ospi module but the main ospi program is using the version of urls that's associated with the main script "module" and it doesn't get extended.

Here's a very simplied program, across two files, that illustrates the problem. I've used the same two file names and variable names as is used in the OSPi code base:

file: ospi.py

urls = [1, 2, 3, 4, 5]

print "In " + __name__ + " urls is: " + str(urls)

import ospi_addon

print "Now in " + __name__ + " urls is: " + str(urls)

file: ospi_addon.py

import ospi

ospi.urls.extend([6, 7])

print "Then in " + __name__ + " ospi.urls is: " + str(ospi.urls)

When you execute ospi.py, you get:

In __main__ urls is: [1, 2, 3, 4, 5]
In ospi urls is: [1, 2, 3, 4, 5]
Now in ospi urls is: [1, 2, 3, 4, 5]
Then in ospi_addon ospi.urls is: [1, 2, 3,
Now in __main__ urls is: [1, 2, 3, 4, 5]

What's happening is urls is being defined twice. Once as the main script (ospi.py) executes and once as the ospy.py file is imported as a module into ospi_addon.py. The instance of urls that gets extended is the one associated with the ospi module, but the instance of urls that's used in the main script is not extended.

I'm don't have all that much experience in python but, based on what I've read, the best way to fix this would be to refactor urls into it's own module but perhaps there's a simplier way.

Unfortunately, there doesn't seem to be a way to just reference the main scripts "urls" variable from a module.

Dave

Weather level adjust plugin fails on bad location

If you enter a bad location in system options, the weather based level adjustment plugin gives an error.

I am using 2.2.47 OPSi. I misspelled my town: brommfield. correct is broomfield, co.

Code at line 225 gives: index out of range. I believe the logic flaw is that the wunderground URL call returns a valid json result. But the result is empty.

I'm not a python coder, but I think line 223 should be:

if data is None:
return ""
if data['RESULTS'] is blank, empty, none (I don't know proper code)
return ""
lid = "zmw:"......

I tested the URL and the result for a bad query is:
{ "RESULTS": [ ] }

no plugins loaded

According to wiki any .py files with executable group permission should be loaded.
I have a pull of last master and for example signaling_examples.py and system_update.py which I checked are group executable, do not show up in the web interface menu.

Plugins dropdown shows only "plugins manager" which when clicked does not take one to a manager page (apparently /plugins, according to my page inspection) and "none".

plugin_manager.py is also group executable.

/plugins doesn't make much sense since all other pages are /v?.

Maybe I am missing some setup detail? Would like to get weather plugin going but first need any plugin to work.

Indexing valve, weather adjustment.

I have an indexing valve so in order to go through my zones I need to have my pump (zone 1) turn on and off 5 times to tick through my 5 zones.
so i have a start time of 20:00 with duration of 22 min. and then I have recurring every 24 min until 22:00
So when I look at it on the calendar it will tick through 5 times and stop.

Now I add the wunderground water level and it says it needs to adjust watering 171%. So it has bumped my 22min to 36 min but not adjusted the stop time so it is still stopping at 22:00, hence only 3 zones get watered.
Do you know where i would look (which py file) to fix this?

In the gen2 firmware the UI is a bit cleaner where it just says turn on this zone for X minutes and you can repeat that X times. In that case even if X minutes was adjusted to longer you'd still repeat X times (in my case always 5 to index through my 5 zones). I just like the python program better so would rather get this working for me.

Program appear twice in preview

In master branch.

Same issue with the program running twice bug. The program only runs once, but appears twice in the preview.

--- a/static/scripts/java/svc1.8.3/plotprog.js
+++ b/static/scripts/java/svc1.8.3/plotprog.js
@@ -32,7 +32,7 @@ function check_match(prog,simminutes,simdate,simday) {
       else if ((dt%2)!=1) return 0;
     }
   }
-  if(simminutes<prog[3] || simminutes>prog[4])  return 0; // start and end time checking
+  if(simminutes<prog[3] || simminutes>=prog[4])  return 0; // start and end time checking
   if(prog[5]==0)  return 0;
   if(((simminutes-prog[3])/prog[5]>>0)*prog[5] == (simminutes-prog[3])) { // interval checking
     return 1;

aps scheduler not working

Hi Dan, I have problem with APS scheduler....

  1. I Instal aps scheduler...

^Croot@OpenSprinkler: sudo pip install apscheduler --upgrade
Downloading/unpacking apscheduler from https://pypi.python.org/packages/source/A /APScheduler/APScheduler-3.0.0.tar.gz#md5=9197028946b2b6191ed648c67e7112b2
Downloading APScheduler-3.0.0.tar.gz (73Kb): 73Kb downloaded
Running setup.py egg_info for package apscheduler

Requirement already up-to-date: six>=1.4.0 in /usr/local/lib/python2.7/dist-pack ages (from apscheduler)
Requirement already up-to-date: pytz in /usr/local/lib/python2.7/dist-packages ( from apscheduler)
Requirement already up-to-date: tzlocal in /usr/local/lib/python2.7/dist-package s (from apscheduler)
Requirement already up-to-date: futures in /usr/local/lib/python2.7/dist-package s (from apscheduler)
Installing collected packages: apscheduler
Found existing installation: APScheduler 3.0.0rc1
Uninstalling APScheduler:
Successfully uninstalled APScheduler
Running setup.py install for apscheduler

Successfully installed apscheduler
Cleaning up...

  1. I Run OSPI...
    root@OpenSprinkler:/home/pi/OSPi# sudo python ospi.py
    The Python module apscheduler could not be found.
    Checking rain status...
    Ignoring exception while loading the weather_adj plug-in.
    list index out of range
    The Python module apscheduler could not be found.
    Setting water level to 100%
    plugins loaded:
    ['mobile_app', 'monthly_adj', 'relay']
    Starting timing loop

http://0.0.0.0:8080/

  1. not working aps scheduler (why)... I read WIKI for aps scheduler for your web

Please help, thank you Martin

Issue with setting up 2 units on LAN

I set up one Opensprinkler pi and when I set up the second I get this error when I try and run the sudo python ospi.py

plugins loaded:
mobile_app
monthly_adj
relay
signaling_example
weather_adj
weather_level_adj
Starting timing loop

http://0.0.0.0:8080/
Traceback (most recent call last):
File "ospi.py", line 189, in
app.run()
File "ospi.py", line 152, in run
return web.httpserver.runsimple(func, ('0.0.0.0', port))
File "/home/pi/OSPi/web/httpserver.py", line 157, in runsimple
server.start()
File "/home/pi/OSPi/web/wsgiserver/init.py", line 1753, in start
raise socket.error(msg)
socket.error: No socket could be created

Mobile app displays many decimals

In the mobile app, when a program is running, the mobile app shows many decimals for time remaining:

15:23.99393939991 (and counting down)
I asked the mobile app dev, and he basically stated that the webapp is not sanitizing the values.

tracing this backwards, the mobile_app.py code has cur_settings() /jc and when I display that in browser (user password hash), it showed:

..."ps": [[0, 0], [0, 0], [0, 0], [1, 831.5999999999999]....
And the code is basically passing back the gv.ps string. So, in the main program, gv.ps is being filled with too many decimals.

This happens when I run the weather level plugin. The plugin calls for, say 176.4% watering level. When multiplied by program time of, say 15:00, you get a float.

So, in the main program, after any levels (monthly, weather, etc) or plugins have changed the gv.ps array, that array needs to be sanitized back to seconds as integer, no decimals.

Program appearing twice in preview

Looks like these changes didn't make the new version. It took me a while to realize that the files got cached in my browser.


diff --git a/static/scripts/schedule.js b/static/scripts/schedule.js
index 011399c..caa1f3d 100644
--- a/static/scripts/schedule.js
+++ b/static/scripts/schedule.js
@@ -29,7 +29,7 @@ function scheduledThisDate(pd,simminutes,simdate,simday) { // check if progrm is
       else if (!(dt%2)) return 0; // if even day, do not match
     }
   }
-  if(simminutes<pd[3] || simminutes>pd[4])  return 0; // if simulated time is before start time or after stop time, do not match
+  if(simminutes<pd[3] || simminutes>=pd[4])  return 0; // if simulated time is before start time or after stop time, do not match
   if(pd[5]==0)  return 0; // repeat time missing, do not match
   if(((simminutes-pd[3])/pd[5]>>0)*pd[5] == (simminutes-pd[3])) { // if programmed to run now...
     return 1; // scheduled for displayScheduleDate
diff --git a/templates/schedule.html b/templates/schedule.html
index d3ea9c9..4afc6bf 100644
--- a/templates/schedule.html
+++ b/templates/schedule.html
@@ -75,7 +75,7 @@ $code:
                      else if ((dt%2)!=1) return 0;
                    }
                  }
-                 if(simminutes<prog[3] || simminutes>prog[4])  return 0; // start and end time checking
+                 if(simminutes<prog[3] || simminutes>=prog[4])  return 0; // start and end time checking
                  if(prog[5]==0)  return 0;
                  if(((simminutes-prog[3])/prog[5]>>0)*prog[5] == (simminutes-prog[3])) { // interval checking
                    return 1;

language OSPi

Hello,
I would like to ask you to add support for languages โ€‹โ€‹(such as language folder and en-GB.ini, cs-CZ.ini ....). I try to keep your system up to date on my website (http://www.pihrt.com/elektronika/248-moje-rapsberry-pi-zavlazovani-zahrady) in Czech language. I added in OSPi some extensions (SMS, e-mail, A/D temp/volt ...) and is a crazy job to translate everything from scratch with every version change from 1.8.3 to 2.0 and later...
I would support that language was not a problem when you've released a new version the future. I have already tried to do for Czech http://www.getlocalization.com/accounts/login/?next=/OpenSprinkler/ # and once the support for the language I do translation in CZ.
I would like to thank you for the great work OSPi and applications for tablet (salbahra).
I apologize for my English (google translator).
Thanks MaPi

Log Error

I am noticing some lines in the log.json file end up with quote escaped format and some without the escape. This inconsistency is causing the mobile_app.py plugin to break and return no log data.

Any idea why this might be occurring?

Please see the forum for more detail and user description of error: https://opensprinkler.com/forums/topic/log-display/

Styling for plugin help pages

Not really an issue, but at some point some thought should be put into styling the plug-in help pages. You can see what I mean by clicking the help button in the system update plug in.

I see a couple of options:

  • Help appears in the main application window (not my first choice)
  • Have the help button open a new "help" window and apply an appropriate styling

No initial reset of shift registers

I noticed tonight as I was hacking the code to support an old pcduino that I had lying around that there is no initial reset of the shift registers. If the program should crash while the sprinklers are on and the system gets rebooted via watchdog--or whatever--the sprinklers will stay on until the next automatic cycle.

My suggestion is to add one line to ospi.py to do an initial reset of the shift registers at line 20 right after the first import of set_output. I don't know the code all that well so perhaps there is a more obvious place to stick it.

ospi.py
 -    from gpio_pins import set_output
 >   set_output()

Updated Weather Options

Ok,

Newbie to github, but I updated the Weather add-in webpage and was curious how to get it into the testing/release areas... Note it has updated weather_ad.py and weather_ad.html and added weather_vars.py.

Thanks,

Tom
capture

Socket Issue After Forcing Exit

I have been mostly executing OSPi through SSH. I execute sip.py in a terminal window, do whatever testing I need to do to a plugin, and then close the window once I am done. I know that I really shouldn't be forcing it down like that, so this can be chalked up to user error. I still want to at least note this issue in case someone else is doing something that they shouldn't. I wonder if you could get this same result just by unplugging the system. Occasionally, I run into socket errors when running the program.

plugins loaded:
  mobile_app
  plugin_manager
http://0.0.0.0:80/
 Starting timing loop

Traceback (most recent call last):
  File "sip.py", line 204, in <module>
    app.run()
  File "sip.py", line 157, in run
    return web.httpserver.runsimple(func, ('0.0.0.0', port))
  File "/home/pi/OSPi/web/httpserver.py", line 157, in runsimple
    server.start()
  File "/home/pi/OSPi/web/wsgiserver/__init__.py", line 1753, in start
    raise socket.error(msg)
socket.error: No socket could be created

It doesn't help if I try to remove data files. This error goes away only when I remove the entire OSPi directory and then clone the repo again. I kept a copy of a corrupted clone if you would like to take a look at it.

All relays activated only once after start OSPi code (from cold boot)

Hi
I ran both sprinkler_pi and OSPi code (2.0.1) on the same Opensprinkler setup.. I did a search in the forum, not see to see anyone with the same issue...

From cold boot the Pi, all of my zones will activated a 1 sec (on and then off) .
This does not happen with sprinkler_pi code or if I don't run OSPi code and just boot up the Pi only

As soon as I start OSPi code, all zones activate a brief 1 second only, and it does not happen again, until I reboot the Pi (removed power to the boards), if I just restart the OSPi code, this does not recreate, until i cut power and restart

I tried to change the code around a number of time, but could not figure where in the code that can cause this or a residual latch or something that cause this behavior...after the pin was initialized as input/ output, I tried to disable the EN pin there (which should be a good pratice, but that does not seem to fix this either ... any clue/ hints on where I should look ? Thank you in advance.

Crashing

I am able to run ospi.py when the sprinkler module is not connected. When it is, it simply hangs for about a minute and then stops. Not even sure where to look for evidence.

Run Program Manually When Disabled

I find it somewhat confusing that the "RUN NOW" button under the programs tab in the web view essentially does nothing when the program is disabled. I see under run_now(), the programs page is brought up if the selected program is disabled.

if not p[0]:  # if program is disabled
    raise web.seeother('/vp')

Is there is a reason to do that? Personally, I think that there are some that may want to only run programs manually. At the very least, the "RUN NOW" button should be grayed out on a disabled program in the programs page.

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.