Forum Replies Created
-
AuthorPosts
-
Dan in CAParticipantThat’s a pretty old version. You might want to update the program. See the wiki for instructions.
http://rayshobby.net/mediawiki/index.php/Python_Interval_Program_for_OSPi#From_an_earlier_version
Dan
Dan in CAParticipantWhat version of the software are you using?
Dan
Dan in CAParticipantThe module you need is now in the repository. You should do:
git pull
from the OSPi directory. That should fix the problem.
Another user just reported that everything is working.
Dan
Dan in CAParticipantI am in the middle of an update that will add multiple language support.
The problems you are having are related to that. It is working properly on my test system. I’m looking for the cause.
EDIT: The i18n.py file is now in the repository. If you do
git pull
from the OSPi directory it should fix the problem.
Dan
Dan in CAParticipantYour original question brings up some interesting possibilities.
the monthly adjust plugin was originally written as a quick example plugin when the plugin system was first introduced. It adjusts a variable that controls the amount of time each zone runs on a global basis.
I think it would be fairly easy to modify the plugin to control a single zone. If your turf’s schedule is in it’s own program, the modified plugin could adjust the irrigation time for that program on a monthly basis.
Let me think about it a bit more.
EDIT:
We have been testing a new feature that can cause a plugin to run a function when an event occurs in the main program including when zones are turned on or off. A plugin could check if a particular zone has been turned on and adjust the irrigation time for that zone (I think).
Dan
Dan in CAParticipantmejutty,
Thanks for reporting this.
I updated the file on GitHub. It should work properly now.
Dan
Dan in CAParticipantIan,
Thanks for the update and documentation.
In order to test MQTT I have installed both IA92
http://www-01.ibm.com/support/docview.wss?uid=swg24006006
Old but still useful like me and also MQTT-spy
https://code.google.com/p/mqtt-spy/
on my Windows system. They are both java based and should run on any OS with a JRE installed. This enables me to monitor the messages from the MQTT broker.
I have been testing the addition of the Blinker module to the OSPi distribution. It looks like both Blinker and the Mosquitto client can be added without licensing problems. This will eliminate the need for users to install the modules as a separate step.
I also plan to add a data payload to the signals that Blinker provides which can be used in the MQTT message to provide a bit more specific information about the state of the system after a change. there may also be some additional activity in the core program that would be worth reporting via Blinker.
Thanks for your contributions to the project. This will make plugin creation much easier.
Dan
November 8, 2014 at 10:39 am in reply to: program preview (or scheduled run time) shifts days (interval program) #34522
Dan in CAParticipantI will take a look.
It is a problem with the timeline display on the home page and should not effect the actual irrigation schedule.
The problem may show up at different times of day. I think it has to do with how timezones are handled.
Thanks for providing an example program. The fact that it starts at 8:00 p.m. is clue.
Dan
Dan in CAParticipant@ Ian,
Thanks for the files. I will take a look as soon as I have a chance.
The best source of info on Git is the Pro Git book available for free download:
On my windows system I find tortoisegit very helpful:
https://code.google.com/p/tortoisegit/
Strange that it is on Google Code.
Some good Python resources are:
http://www.tutorialspoint.com/python/
http://www.python-course.eu/course.php
and if you are doing a google search for Python… be sure to look for StackOverflow links.
If you are moving from a recent rev of the Arduino OpenSprinkler, it has a new feature that allows individual run times to be set within a single program. It is on the todo list for ospi but is not available yet. You can make a program for each zone which actually gives you more flexibility. For example you can more easily change all the settings for a zone and enable/disable individual zones on the Programs page of the native UI.
Wow! Doubling top tier rates is a big jump. A vloume/$ limiting plugin seems like a worthwhile project to start ASAP. Or at least one that would display what you are using. It will probably take some fiddling to get to something that is really practical but if we don’t start…
Does hollerith code ring a bell? I learned system 360 programming in 1969 but spent the next 16 years in the (plant) nursery business.
Dan
Dan in CAParticipantThe functions in the notify_change.py plugin are really just stubs. They print a message to the console in order to demonstrate that they work. They can/should be extended to send messages to an MQTT broker, do data manipulation etc. The python-mosquitto client modules seem like they could work here.
The blinker signals can also include a data payload. When a user performs an action such as selecting an option, the UI sends a GET request with a query string containing the selected option to a URL which triggers some processing. The blinker signal from such an event could include a Python dictionary object containing the elements of the query string, providing more specific data about the change. I ‘m just learning abut MQTT but it seems like sending the entire contents of the gv.sd dictionary with each change is a bit of overkill. It would require further processing to figure out what the change actually was was.
This new signalling feature will certainly make writing plugins a lot easier and eliminate most of the looping/polling that is now necessary to get data about the state of the system. It has the potential to enhance performance by eliminating HTTP REST calls:
https://mobilebit.wordpress.com/2013/05/03/rest-is-for-sleeping-mqtt-is-for-mobile/
Ian,
The idea of using MQTT for the sensor network crossed my mind but there are some reasons I want to at least try modprobe. There is a separate thread on that so I won’t go into it here.
https://opensprinkler.com/forums/topic/who-accept-a-challenge-to-write-plugin-with-soil-moisture/
Dan
Dan in CAParticipantIan and munnecke,
There is a new branch on the OSPi GitHub repository named Blinker_test. You can pull an update from the repository then
git checkout Blinker_test
to switch to the new branch.
It includes a new plugin named notify_change.py. You may need to set the permissions to executable to make it load. You will also need to have the blinker Python module installed (see previous post). If you run the ospi program from the command line and make some changes to the program in the UI, such as running a run-once program you will see the changes reported in the console.
This is just a test of Blinker’s signalling but it reports most changes a user can make in the main program. Take a look at the code in notify_change.py for more information. The other changes are in webpages.py and gpio_pins.py.
I think it would be good to have this capability as a standard feature of the ospi program. Especially if we can get it talking to Node-red through MQTT. I have been watching some intro MQTT videos on YouTube and some people claim it is the state of the art for the internet of things.
Thanks for starting this thread.
Dan
Dan in CAParticipantJust an FYI.
I have started testing the Blinker Python module:
https://pythonhosted.org/blinker/
It enables message sending when an event occurs rather than by polling. It can even include a data payload with the message. I have a working proof of concept plugin that prints a message to the python console whenever a zone is turned on or off. It is only 5 lines of code plus 3 lines in the gpio_pins.py file:
from blinker import signal zone_change = signal('zone_change') and at the end of the set_output() function: zone_change.send()
This requires installing a non-standard Python module, something I have avoided in the main program code. I was able to install Blinker on both my OSPi test rig and my Windows development system with
"pip install blinker"
It looks like there are about 6-8 places in the main program code where changes are handled. these could have messaging code added that would be ignored if the blinker module was not present.
One possibility for detecting if the Pi is up and running is to simply ping the URL. A heartbeat would be trivial to implement in the ospi software.
Dan
Dan in CAParticipantmunnecke,
You are right that the gv module is a repository for global variables which can be shared among the main program and other modules such as plugins just by importing it. You can assign new vars to it if needed.
There are some existing sources of state data. For example, the mobile_app plugin provides the “/jx” urls such as ‘/js’ which returns the current state of stations. There is also an /’api/status’ URL which returns some state info but these return the information only when requested via an HTTP Get request. I am looking into ways to broadcast status data when a change occurs. Any ideas in this regard are welcome. Your list of things you want to track is very helpful.
I ‘m also experiencing the drought (Sacramento area). There are dead lawns everywhere. A recent study released by (I think) U.C. Riverside concluded that one of the most effective water conservation measures is tiered pricing. The state of CA even has an Urban-Drought-Guidebook that recommends “large per billing unit price increases” to water suppliers to help reduce usage. I am thinking about writing a plugin that will allow a user to set a cost/volume restriction on irrigation. It would require the irrigation system to be calibrated by e.g. running each zone for a specific time and determining the amount of water used by taking water meter readings before and after. This should become useful as the cost of water goes up.
Another project on my workbench is an Arduino based system for connecting soil moisture sensors to the OSPi. My plan is to use the modbus protocol over RS-485 serial. It could be used for other types of sensors as well. The Raspberry Pi can easily communicate with an Arduino via serial using a USB cable.
Anyway, this is a fun and useful project.
Dan
Dan in CAParticipantIan,
I couldn’t get the text you first posted to import into Node-red but the file you uploaded worked like a charm. You mentioned that the text file was a notepad file so I’m guessing you use a Windows system. Are you familiar with WinSCP?
http://winscp.net/eng/docs/introduction
With it you can easily copy files between the Raspi and your windows system. You could export a Node-red flow to the “library” in Node-red then copy the resulting .json file from /home/pi/node-red/lib/flows on the Pi to your Windows system for transfer to the forum or send via email etc. It would work in the other direction as well.
Your plan to develop a plugin for ospi is the way to go. It would allow someone to add these features to an installation without worrying about which distribution of the main program to use. I have not had time to document the plugin system yet but I plan to work on that in the next few weeks. in the mean time there is a little info on the wiki:
http://rayshobby.net/mediawiki/index.php/Python_Interval_Program_for_OSPi
And of course you can always ask questions here and I will try to help. That will also help me with the documentation.
Dan
Dan in CAParticipantIan,
This is really exciting. I too was not aware of node-red until reading your first post although I have had a bit of experience with flow based programming:
http://www.fireflyexperiments.com/#home
@munnecke, your comments add even more interesting avenues to explore.My original goal when I started working with Python and OpenSprinkler was to develop a platform for experimenting, and something that can be easily customized. I am now looking for ways to integrate node-red into the ospi distribution which has the possibility of allowing even more users to create custom functionality without having to learn all the details of hand coding a programming language.
Dan
Dan in CAParticipant@ steppi,
As I mentioned in the announcement of the last update to the Python program the version number (2.1.0) refers specifically to the Python project and it is not identical to the micro-controller version of OpenSprinkler with the same number.
Adding the feature you requested is on my todo list but because I develop the program on a volunteer basis in my spare time there is no set schedule for implementing it.
I actually prefer to make a separate program for each zone/station because it allows a lot more flexibility such as setting them for different days and I can turn a zone on or off by simply turning the program on or off.
Dan
Dan in CAParticipantHi Ian,
I marked the previous message private to test that feature of the new forum software. I’m still exploring what it can do.
The API for the Arduino based OpenSprinkler is partly supported on the Pi version by the mobile_app.py plugin as far as reading the status. The functions for controlling the program can be added.
Keep us posted on your progress.
Dan
Dan in CAParticipantIan,
This is opening up a lot of possibilities. Now that I have looked into Node-red I have a better understanding of what you are doing.
Question: you mention you have been reading “the web api document”. Could you be a bit more specific? I see there is a generic API client node for node-red.
Have you looked at the mobile-app plugin? It has a set of URLs which provide an API for working with the ospi, e.g. [ospi URL]/jn rerutns station information. There is also an API from the built in UI, [ospi URL]/api/status which returns a bunch of status information.
Thanks.
Dan
Dan in CAParticipantHi Ian,
This sounds very interesting.
You should be able to make a plugin that does what you want without modifying the log_run function.
The email_adj.py plugin contains some code that could give you some ideas. It checks each station once a second to determine when a change happens. Actually there is an easier way. The list gv.srvals holds the state of the stations/zones (see gv_reference.txt in the OSPi directory for more.). You could copy that list then use a loop to check when a change happens:
import time from gv import srvals, lrun zone_state = srvals[:] while zone_state == srvals: time.sleep(1)
The list gv.lrun holds the data that is used to create log entries in log_run(). You could use that even if logging is disabled.
As far as the Android app goes, I think it uses it’s own logging functions separate from the one in ospi. There are some issues with the logging in ospi that will be addressed soon so log_run() will likely change in the near future.
Dan
Dan in CAParticipantLet’s try this one more time since I can’t edit the previous post and there does not seem to be a preview option for posts.
http://rayshobby.net/mediawiki/index.php?title=Secure_Remote_Access
Dan in CAParticipant
Dan in CAParticipantrichpuch,
The weather-based water level plugin was written to use metric units. There is currently no way to easily switch to inches (imperial units). It looks like it would require a major rewrite.
Dan
Dan in CAParticipantThanks for the clarification Samer.
@Phil,
See this post:
viewtopic.php?f=28&t=945#p6237for info about the bug fix.
Dan
Dan in CAParticipantOK. I just pushed a new rev to GitHub to fix the stop stations bug. If you are running version 2.1.2 you already have the bug fix.
If you already updated to version 2.1.1 you can use
git pull
from the OSPi directory to get the bug fix. Otherwise use the instructions from the wiki mentioned in the original announcement.
@ pierantonio,
Just want to mention that the ospi program does not use the apache web server but a server built into the web.py framework.Dan
-
AuthorPosts