Forum Replies Created
-
AuthorPosts
-
RonRN18ParticipantI ***finally*** have a working LCD that automatically updates itself (every 30 seconds) with the latest status of OpenSprinkler. You can see my work at [github](https://github.com/RonRN18/ospiLCD-mqtt). My software may not be the most elegant and I found that I got MUCH better help from ChatGPT than from the Python forums. I found that I was met with rude attitudes when asking for help on the Python forums and people assumed I had more knowledge than I do. ChatGPT has its issues too. It was adding irrelevant variables while removing important variables but I could tell, in context, how to accomplish what I was trying to do. In my
get_data
function, I named many more variables than I needed because I have a plan to change my code to show other information in the future. The current display is equivalent to the microcontroller version and many of the items on the display are drastically shortened so that it all fits on the display, all the time. My thought is to change it up a bit and allow for lines that scroll. For example, instead of the line saying something like “MC:1_________”, I could have it say: “Front Yard is running”. That is greater than 20 characters long, so the line will be buffered and scrolled along the line. It would determine which station is running and instead of just showing the station number, it would show the station name… however long it may be. One of my favorite features of OpenSprinkler in general is the departure of needing to know what each station number is and continue referring to it as a number and instead, using logical names for each zone.
RonRN18ParticipantI’ve made a baby step forward in getting
ospiLCD-mqtt.py
to work. It still doesn’t work but I’ve gotten it to move forward to the next problem. TheTypeError: a bytes-like object is required, not 'str'
issue is related to the variable namedmqttPort
. On line #32, the script uses quotations around the port number, which makes the value a string-type variable as opposed to a number. so changing line 32 from reading:mqttPort = "1883"
tomqttPort = 1883
gets rid of the error. Unfortunately, it still does not work. I now get:`
/home/bigron/./ospiLCD-mqtt.py:256: DeprecationWarning: Callback API version 1 is deprecated, update to latest version
client = mqtt.Client()
[Connected with result code 5]
[Connected with result code 5]
`
The LCD display has changed from:
`
Connecting to
MQTT broker…
`
to:
`
MQTT Connected
Requesting Info
`
As you can see from the error now seen,
[Connected with result code 5]
, it is a connection refused error. I believe that it is related to it trying to use MQTT version 1, which has been deprecated. I am learning how to fix this issue now. I just thought I’d share the progress I’ve made.
RonRN18ParticipantI have finished my enclosure that includes the LCD, https://www.thingiverse.com/thing:6632131, so now I’m trying to focus on getting the display to actually work. I see that “Sirkus7” made a correction in the MQTT version of his Python code, which is line #75, which reads:
data = data.replace("\"pass\":", "\"password\":") # Replace protected keyword "pass" with acceptable term "password"
I have inserted this in between lines #45 & #46. If you were to export your OpenSprinkler settings to file, you will see that it is a JSON file and in that file, there are the MQTT server username and password. Instead of using the word “password”, it is shortened to “pass”, which is a protected word. In line 45 of “ospiLCD.py”, it basically loads that JSON into a variable called “data”. This line does a “find & replace” of the word “pass:” with the word “password:” so that it does not create the ValueError. Unfortunately, inserting that line doesn’t solve everything. I now get at TypeError.
TypeError: a bytes-like object is required, not 'str'
Despite changing the word “pass:” to “password:” something within the JSON appears as a string when it should be a “byte-like object”. I am currently at a loss as to how to fix this.
RonRN18ParticipantI have added my design to Thingiverse for my OSPi. It is https://www.thingiverse.com/thing:6632131
RonRN18ParticipantThanks for the info. I kind of had a suspicion that it might be some type of proprietary thing but hoped maybe it could be used.
RonRN18ParticipantI am currently in the process of designing an OSPi enclosure that will also have a 20-character per line, 4-line, LCD. I too plan on using Ethernet wiring and will open up the right side for full access to the Ethernet and USB ports. I design in OpenSCAD and will eventually upload my design to Thingiverse, including the SCAD files so people can modify it if need be. I like to use heat-set threaded inserts for screws. As I’m in the design phase, any input may be helpful. My photos were too large for the attachments limitation, so I have a web server I use for hosting my photos with links to 3 views of my current design.
https://we6bb.net/images/OSPi/View1.jpg
https://we6bb.net/images/OSPi/View2.jpg
https://we6bb.net/images/OSPi/View3.jpg
RonRN18ParticipantI realize the original posting was a year ago and I too am not very good at Python but I’m muddling through with altering the code of the original “ospiLCD.py” code to address changes from what I believe was Python2 to Python3. I’ve made a few changes that were fairly easy, such as the requirement that a print command have the line to be printed within parenthesis. For example, you used to be able to say { print “Hello World” } but it now must be { print(“Hello World”) }. Another fix was a change in a variable name… at the moment, I forgot it but I saw it discussed in another thread. My current issue I’m trying to figure out is about obtaining the device’s IP address. Somehow, there are issues about the format and type of data that is stored in the variable. I believe that the original variable calls for the IP address and verifies that it is at least 7 characters long, to determine if it is a real IP address or not. Then it needs to put that number in a print command but the number must be converted from I believe an integer to a string so that it can be concatenated on a line of text with other characters. I will be using the 20-character/4-line display (2004a).
RonRN18ParticipantIs there any way to get the one side piece with an Ethernet jack cut-out? I really don’t want to carve it with a Dremel… that will never look good. At the moment, I will have to just not install that piece.
RonRN18ParticipantI already have access to everything in my father’s network; I have a VPN set-up between our networks.
RonRN18ParticipantI just had a thought (only a thought)… do you have NTP running? This polls NTP time servers every little bit. If the WiFi dongle goes offline due to inactivity, maybe this could be a cure if you don’t have it running. I’m wondering if it may have something to do with your initial board not having networking on it… has to be done via USB.
RonRN18ParticipantI have just built an OpenSprinkler controller to give to my father for Christmas and I’m currently trying to trouble-shoot any potential problems before I give it to him and install it for him. I have not had the problem you have mentioned, but want to see if we did anything different from each other. Just to mention what I have done, I started off with the latest Raspberry Pi 2 and the latest OpenSprinkler Pi (Plus). I then installed the Raspbian Jessie. I have performed
sudo apt-get update
,sudo apt-get dist-upgrade
andsudo rpi-update
. If I now type inuname –a
, I getLinux OpenSprinkler 4.1.13-v7+ #826 SMP PREEMPT Fri Nov 13 20:19:03 GMT 2015 armv7l GNU/Linux
. I then went into my~/Downloads
directory and did agit clone https://github.com/OpenSprinkler/OpenSprinkler-Firmware.git
followed by./build.sh ospi
.For WiFi, I’m using a Etekcity® AR5 USB WiFi dongle I purchased a year or so ago. This was my first time setting up wifi from command-line on a Raspberry Pi so I followed the instructions at https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md. To make matters more confusing, the security of MY home network uses a Radius server for WPA2, requiring both a username and password instead of the typical passphrase. This meant that I had to add the following to my /etc/wpa_supplicant/wpa_supplicant.conf file:
network={ ssid="MYSSID" scan_ssid=1 key_mgmt=WPA-EAP pairwise=CCMP TKIP group=CCMP TKIP eap=PEAP identity="MYUSERNAME" password="MYPASSWORD" id_str="MYHOME" } network={ ssid="DADS SSID" psk="DADS Passphrase" id_str="Dad" }
With this setup, everything appears to be working the way it is supposed to. The reason I am making this for my father is he has a HUGE garden. When I was at his place last, I saw 4 cheap sprinkler controllers with each showing a different time. I could tell that each of them were kind of difficult to program and none of the zones were labeled, meaning he just had to know what valve was controlled by what zone number by what controller. With this OpenSprinkler, he will be able to have one simple to program controller that he can label each zone for what it is.
I currently have one based on the BeagleBone Black… if I were to do it again, I’d definitely go Raspberry Pi. I only have two zones at my house but I did it primarily for weather-based watering. I also ran Ethernet cabling to my controller so Wi-Fi was a non-issue.
RonRN18ParticipantI’m sorry for my misunderstanding, but I just wanted to make sure that this is for the non-Linux-based OpenSprinklers? I have the OpenSprinkler BeagleBone Black device. Under “About”, on my web interface, I see “App Version: 1.4.6”, “Firmware: 2.1.5 (1)” and “Hardware: OSBo (AC)”. It was my understanding that when there was a firmware update, I’d use a “git pull” and re-run the build script.
RonRN18ParticipantI just want to make sure I understand this correctly. I want the sprinklers to come on one hour before sunrise on Friday. Weather Underground reports that sunrise on Friday is at 5:41 AM. If I program the sprinklers to turn on 1 hour before sunrise and run for 30 minutes, the sprinklers should turn on at 4:41 AM and turn off at 5:11 AM? When I change the program to that, the program preview currently shows that will start at ~6:22 AM and turn off at ~6:52 AM, but that is wrong? Soon this should be a moot point and it will show the correct time in the program preview?
RonRN18ParticipantWell, I finally got it working.
I ended up imaging Ubuntu 14.04.2 onto the internal memory of my BBB. After updating Ubuntu, I followed the instructions at https://github.com/adafruit/adafruit-beaglebone-io-python to ensure that was setup… I don’t know if that step was important before installing the Unified firmware at https://github.com/OpenSprinkler/OpenSprinklerGen2 . At least it works now. Because I did not use the normal Opensprinkler image, I unfortunately do not have the “demos” folder… I’m not sure if I really need it though.
RonRN18ParticipantI finally built my OpenSprinkler Beaglebone device. Once physically set-up, I booted up the device and got all the updates and got everything programmed via my computer. It appears as if everything works properly. I grabbed a solenoid and connected one lead to the common and one to station 1. I then set it to manually run station 1. Again, it appears as if everything works properly, but nothing happens. I’ve made an educated guess that ~24 VAC should be detected between common and an activated station… is that a correct guess? There is no voltage between between either of the common pins to any of the station pins as I manually change stations from one to the next. Interestingly, there is ~29 VAC between either of the common pins to either of the rain-sensor pins. I’m at a loss as to what to do next.
-
AuthorPosts