June 22, 2015 at 2:15 pm #38611
I’m moving my old hacked-together sprinkler system to opensprinkler pi. I’d written a system that used node.js to call to an arduino over wifi, turning on and off my sprinkler zones. I’d like to be able to port that system over to opensprinkler with a minimal amount of effort.
Is there some technical documentation about how to turn off zones programatically? Is it as simple as writing HIGH/LOW to specific GPIO ports? Or is it more convoluted? I’ve seen https://www.npmjs.com/package/ospi, and it seems to work great for writing values, but there’s no good way to query what the current status of the zones are.
Is there any documentation about how all this works?June 22, 2015 at 2:46 pm #38613
The OS API documentation is in the support section of opensprinkler.comJune 22, 2015 at 3:31 pm #38618
I was kind of hoping for something lower level than the API. It looks to me like the API requires running the python software somehow, and I’d prefer to manage that myself.June 22, 2015 at 7:47 pm #38622
The API is available and documented for everyone to use. If you wish to control the GPIO directly, you are more than welcome to do so. Also, you may use the existing Python or C++ code to see how stations are toggled. For example, the relevant code is contained here in the Unified firmware: https://github.com/OpenSprinkler/OpenSprinklerGen2/blob/master/OpenSprinkler.cpp#L545-604.June 23, 2015 at 5:45 pm #38642
Please pardon my ignorance on this. I’m still struggling to figure this all out without just giving up and running the python interval program.
I’ve cloned https://github.com/OpenSprinkler/OpenSprinklerGen2 onto my raspberry pi and followed the build instructions (./build.sh ospi). This generated an OpenSprinkler executable in that folder.
When I run that executable nothing seems to be happening. That may be ok, I’m not certain. Then I went to the firmware documentation at https://opensprinkler.freshdesk.com/support/solutions/articles/5000632570-api-documentation-firmware-2-1-5-current-. It looks like it uses http for the transport layer, so on my raspberry pi I ran “curl http://localhost/jc?pw=dev” I get the message that it cannot connect to host. Is
Does running this application actually enable the API? If so, does it do it on port 80?June 23, 2015 at 6:59 pm #38647
Have you read the OSPi user manual? If not, it might help with all of the confusion. It is available here:
That link also has two other articles:
- Creation of SD image preinstalled with the Unified firmware you already installed
- Updating or removing the Unified firmware
To answer your immediate question, the default port is 8080 and the default password is opendoor. Please note if you use the app instead of just the API, the password will instead be hashed (not clear text).June 24, 2015 at 8:53 am #38662
Thank you, I think this clears everything up now. I just had a hard time, where my brain didn’t understand the concept of “Firmware” on the raspberry pi as just another application being run, but in the context of OpenSprinkler it makes sense.
I understand the system and have all the tools I need now thanks to your help.June 25, 2015 at 6:39 pm #38718
@jakestevenson, I think you may be confusing the low-level code that sends data to the shift register vs. the web API that tells the controller to open a station through the HTTP command. For the former, OpenSprinkler uses shift register to control stations / sprinkler solenoids, the reason is this makes it much easier to expand to multiple stations without having to occupy more microcontroller GPIO pins. The code that implements the shift register operation is all in apply_all_station_bits() function in OpenSprinkler.cpp. In addition, you can check the following link to see examples of how to get Arduino to work with shift register:
The web API is explained in the Firmware API document. This allows you to open/close a station by sending an HTTP command.
- You must be logged in to reply to this topic.