Is it possible to pull in weather temperature from the internet and use it as an actual value for turning something on and off? We will have quite a few Gas Compressors that need to activate a dump valve when the weather temperature gets down to a certain temperature to prevent condensate freezing. I know we could install RTD’s outside of each compressor and pull in that value, but we were asked if there was a way to use the temperature reported by the internet to avoid having to install them. I know you can pull the weather temps in and display them within ignition, but I don’t think it is possible to use the reported temp value as a string to use. So just thought I would ask…
Can this be done with WOEID API perhaps?
That would be a cool feature to have. I was thinking the same! There is a way, you could create a tag that to get the weather value and then create an expression tag to turn the value (tag) on. I will like to hear it from someone else to see how they did it.
yes, you could, but I would lean to using rtd’s at the local site.
These units are all going to be within 10-15 mile radius of our city. So our city’s temperature is not going to fluctuate to much within 10 - 15 miles to make much of a difference. It does not have to be exact temperature of where they are located, so I would really like to know how to do it via pulling the temp value reported on internet to do this. It would save a lot of money on putting RDT’s on every unit + we already have the ability to manually set dump time intervals and remote dumps from SCADA if need be. So if anyone knows how to do this it wold be much appreciated with an example.
I borrowed the code form one of our good friends in the user submitted comments section. This should get you started. If I was going to do something like this, at the minimum, I would get readings from more than 1 service and make sure there isnt more than a few degree difference before writing a value.
If you stick this on a button, it will write the temperature to tag called “Temp” in a “Weather” folder
#get the data
zipcode = '70570'
response = system.net.httpGet("http://xml.weather.yahoo.com/forecastrss?p=%s" % zipcode)
#put it in the dom
dom1 = xml.dom.minidom.parseString(response)
#get the tag for current conditions
for node in dom1.getElementsByTagName("yweather:condition"):
#get the attributes, and write the tags
Thanks Diat, Ill give it a shot when i get a little free time and let you know who it works out. Thanks again for your help.