I started the morning writing a test script and starting the debug process which I expected to go quickly. About 4 hours later I had the software working the way I expected it to run. Most of the problems I encountered stemmed from my very rusty familiarity with the Python language and its use.
For anyone out there thinking about building one of these contraptions, bear in mind that the MaxSonarTTY.py file is intended to be imported, not run as a stand alone script. It contains the function “measure(portName)” that does all the heavy lifting and returns a measurement from the sensor. The trouble that I ran into (silly me) was mostly because initially I was trying to call MaxSonarTTY directly through pysftp rather than calling a script that actually used the measure function correctly.
The next step will be to install the new service into the WeeWX program that I use for the current weather station data and hopefully start collecting real snow depth data before snow actually comes our way. To do that I have run a direct bury Ethernet cable from inside where the snow measurement Raspberry Pi is located out to the snow pole. Tomorrow I plan on building the mount, soldering up the sensor to the outside end of the cable, and begin testing with whole “real” setup.
I am waiting on a couple answers regarding the service installation before I proceed with that. If all goes well, I hope to have the service up and running by the end of the weekend. To start with, once I’m satisfied that things are working, I will probably create a new menu item on the BigTreesTech home page much like the Detailed Weather Information that I added recently. Eventually I hope to have the snow measurement data presented right along with all the other weather data.