OpenSprinkler › Forums › OpenSprinkler Unified Firmware › Ambient Weather sensor data
- This topic has 57 replies, 4 voices, and was last updated 3 years, 9 months ago by Peter.
May 19, 2019 at 6:36 pm #60503
I have an ambient weather Ws-2000 that reports to ambientweather.net by default and also allows for reporting to pwsweather. Openweathermap is not an option. Does anyone have any creative suggestions on how I can get my weather sensor data to my openspinkler I guess by way of sensor->either the sites mentioned above -> openweathermap? Then of course I can finally let opensprinkler use that weather data for scheduling.May 23, 2019 at 1:05 pm #60588
I am not familiar with the Ambient Weather devices. However, I have been working with some really smart OpenSprinkler collaborators and have found a way to get the data from my Davis Vantage Pro2 fed to OpenSprinkler for the Zimmerman calculation of water level. This involves implementing weather-server on some device, such as a Raspberry Pi, (See https://github.com/OpenSprinkler/OpenSprinkler-Weather) and utilizing existing Davis WeatherLink software capabilities (see the end of this thread: https://github.com/OpenSprinkler/OpenSprinkler-Weather/issues/41. I don’t know whether an approach similar to this will work. There is also another approach, doucumented at the OpenSprinkler-Weather thread, that involves intercepting a TCP/IP feed.May 23, 2019 at 1:36 pm #60592
I missed that I could have the weather service running locally. I have a raspberry pi so that is definitely an option. One thing I am having a hard time finding is where the api calls to openweathermap are. I’m thinking I could just add some code which defines the API calls for pwsweather and then use that but looking at the code it doesn’t look that simple. Does anyone know which specific file(s) I would use to add additional api calls/functionality for another weather service like pwsweather?May 25, 2019 at 12:49 pm #60613
boondocks5, as per Roger’s comment, if you are able to run a local version of the Weather Service then you may be able to stream your PWS data directly to the Weather Service. I think your PWS supports WU format and the local Weather Service can accept that so you might not need to write any code for this. See here for some more information. Happy to help talk you through the process. I currently have my Ambient Weather WS-1400-IP doing this and avoid the cloud all together.May 28, 2019 at 2:05 am #60639
Servus @Peter I spent hours to find information on how to use my own PWS data for my OSPi. The OWM doesn’t work for me at all. I do own a Synology DS215j and a Ventus W830 which reports direct to WU via WiFi. Is there any Step by Step or tutorial available on how to get this work within my local network? I would like to use the NAS as a Webserver and have OSPi using that data. I have basic knowledge on how to use the terminal to install packages or executing command lines pasted in. But for me it’s hard to understand how to get OpenSprinkler Weather Service work. Any advice highly appreciated.
All the best from Austria,
Jürgen.May 28, 2019 at 1:53 pm #60647
Jürgen, there is some good information at this link [CLICK]. But basically, we need to intercept the data that is going from your PWS to WU and send it to a locally running OS Weather Service instead.
I am note sure if the Synology NAS will run NodeJS. This is the underlying platform of the Weather Service and a key dependency. If it does then that would make a good host for the local Weather Service. If not then you could use a cheap raspberry pi (there are instructions in the link above that detail how to get Weather Service running on a raspberry pi).
The next step is to “intercept” the weather data and get it redirected to Synology. How to do this depends on your network setup. Some wifi routers let you setup an “intercept” but most telco provided routers do not. So let me know the make/model of your wifi router and we can go from there.May 28, 2019 at 2:07 pm #60649May 29, 2019 at 2:37 am #60663
Hi Peter, thank you for helping me out. NodeJS is installed on the Synology, WinSCP on my PC and connected to the NAS. Do I have to copy all files from the OpenSprinkler Weather Service to the NAS? The readme.md is telling me that the server.js is the primary file but I don’t find it. How to install Weather Service now on the NAS?
My router is a Huawei HA35-22/AM.May 29, 2019 at 6:38 am #60669
Jurgen, great that you have node.js up and running. If you go back to the OpenSprinkler Weather Service github page above then you should see a section titled “Installing a Local Weather Service onto a Raspberry Pi” that leads to some very detailed command line instructions. You should follow Steps 2-5 to get a service up and running. You can then skip forward to Step 7 to test that the service has been installed correctly. However, from memory, Synology does not use “systemd” to make programmes start-up at reboot so you will need to use an alternative solution for Step 7. I believe Synology uses “upstart” but you may need to do some googling to get the sysntax/file location.
If we can get the local Weather Service working on the NAS then we can move on to the network side of things.
Let me know how you get on.May 29, 2019 at 7:56 am #60670
Hello Peter, getting there 😉
In addition I had to install the Git package on the NAS. Now I was successful in installing the OS Weather Service. Step 3 – compiling is complete. Step 4 is about OWM or Dark Sky API. If I just want to use my own PWS, is this Step necessary?
Jürgen.May 29, 2019 at 8:16 am #60671
Jürgen, great progress, if you just want to use your PWS then you don’t need to register with either OWM or DarkSky so you can skip Step 5.May 29, 2019 at 8:26 am #60672
Jürgen, my apologies, you can only skip some of Step 5. You do need to create the “.env” file and you do need to set the HOST and PORT fields but you should set “WEATHER_PROVIDER=PWS” and ignore the OWM/DARKSKY_API settings. You can then manually run the command “npm start” to start the service and try Step 7 as a test. Note that since you specified PWS as the weather provider and we haven’t yet set up the PWS to send to the Synology then the test results will show a lot of “null” values.May 29, 2019 at 10:00 am #60676
Peter, I set HOST=0.0.0.0 and PORT=3000
The “.env” file was created and will now be edited for PWS.
I did a “npm start” but was not able to connect to IP:3000 I think it’s due to the errors regarding missing information.
Attachments:May 29, 2019 at 10:19 am #60678
OK, so the code base has moved a bit. Looks like you need to change “WEATHER_PROVIDER=PWS” to “WEATHER_PROVIDER=local” and add additional line “PWS=WU”. This should configure the service to accept a “local” feed in the Weather Underground format.May 29, 2019 at 10:34 am #60680
BINGO, now it seems to work. I get a “OpenSprinkler Weather Service v1.0.3” on the screen when opening 10.0.0.38:3000May 30, 2019 at 9:21 am #60695
@Peter I have a Pi Zero W which I will try to use as “man in the middle” just the other way around described at the OpenSprinkler-Weather/docs “Setup a Raspberry Pi To Intercept PWS Information”. I hope to be able to set it up to connect the weather station via WiFi to the Pi and from there to forward the information via ethernet to my router to feed the NAS. Any thoughts?May 30, 2019 at 9:52 am #60697
Step 1 of “Setup a Raspberry Pi To Intercept PWS Information” is completed, now comes the tricky part of reversing further instructions to read the PWS WiFi and to forward it to the router via ethernet. I most likely will need some help to get it work.
Thanks, Jürgen.May 30, 2019 at 9:59 am #60698
Jurgen, you might need to back a step to go forward as reversing is a bit different. Can I suggest that you first set-up the Raspberry Pi Zero W as a WiFi access point connected to your network. There is a good article explaining the setup at this link HERE. You need to scroll down that article as the bit you want starts with the ttitle “Using the Raspberry Pi as an access point to share an internet connection (bridge)”. If you manage to get that set-up then you can connect your PWS to the Raspberry Pi Access Point and your weather data should start flowing through the Raspberry Pi and out to the WU Cloud. Once that is confirmed then we can put the “intercept” logic in place.May 30, 2019 at 11:13 am #60701
Peter, I like your approach via the access point. I already ordered a usb to ethernet adapter which should be delivered latest on Saturday. In the mean time I will prepare the Zero according the article. I keep you posted here once prepared.May 31, 2019 at 8:27 am #60711
Dear @Peter, thanks to your help I got a working Pi Zero W Access Point with my PWS using it. Ready for the “intercept” logic 🙂
Jürgen.May 31, 2019 at 9:50 am #60713
Jurgen, great, assume that the PWS is talking to the WU Cloud through the Raspberry Pi successfully. So can you try the following line, note that I cant test this as I don’t have the network equivalent but 8) …
sudo iptables -t nat -A PREROUTING -p tcp -d rtupdate.wunderground.com --dport 80 -j DNAT --to-destination <Weather Service IP:PORT>
The above is for PWS that are using the Rapid Fire (real-time) interface which most are but if that doesn’t work then you may need the one below instead:
sudo iptables -t nat -A PREROUTING -p tcp -d weatherstation.wunderground.com --dport 80 -j DNAT --to-destination <Weather Service IP:PORT>
This should redirect information heading to the wunderground cloud service and send it toward the local Weather Service instead. You can then test whether the data is getting through by hitting the Weather Service endpoint from a browser to see what watering scale is being reported. It might take 5 mins for data to get into the Weather Service depending on how often your PWS provides updates.
If either of these works then you will still need to make the change persist across a reboot by following most of Step 4 using iptables-save and iptables-restore.May 31, 2019 at 9:57 am #60715
Hi Peter, I will try this out in a minute.May 31, 2019 at 10:28 am #60716
If I am correct there should be some output now on 10.0.0.38:3000 <Weather Service IP:Port> But all I get is a white page with “OpenSprinkler Weather Service v1.0.3”
Do I need to keep the <> or just the plain 10.0.0.38:3000?May 31, 2019 at 10:54 am #60717
Jurgen, yeah I need to tidy up the docs a bit 8) as the current setup doesn’t really give the end-to-end process very well … on my to-do list.
But if you go back to the original “installing a Local Weather Service” page [HERE] then you should see a Step 7 that contains the test/query endpoint. To see if data is being received by the Weather Service then call the following from a browser:
http://<Weather Service IP:PORT>/weather1.py?loc=50,1&wto="h":100,"t":100,"r":100,"bh":70,"bt":59,"br":0
This mimics the call that OSPi will make when calculating watering level. You can swap out the h/t/r values with the Zimmerman percentage weightings and the bh/bt/br values for the baseline shown in the App Zimmerman config popup. The result should look something like:
Where scale is the watering level.May 31, 2019 at 10:58 am #60719
Jurgen, another way of seeing if the data is being received by the Weather Service is to ssh onto the Synology box and manually start the Weather Service “npm start” (you may need to kill the existing process if you have it already running) it then will print out to the console every time it receives some data from your PWS.
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › OpenSprinkler Unified Firmware › Ambient Weather sensor data