Page 1 of 1

Weather information on your Control Panel.

Posted: Thu Mar 11, 2004 7:35 pm
by gorfllub
Now I am sure there are other ways to do this, but me not being a coder of any sort figured this out:



To get weather info to display on your software remote screen do the following:



Find a weather service or site that has your information graphically. I used http://www.theweathernetwork.com since I am in Canada.



Find your city. Right click on the image that comes up (the one the shows temp an current conditions etc.)



Set this image as an Active Desktop item.



Make a transparent hole in your software remote panel so you can see this active desktop image, and line things up....



Voila! Active desktop automatically updates this image with your local weather info!





If anyone has a better way, I am dying to know, especially how to attach weather info to a floating panel..... With my above idea, the panel MUST remain fixed, otherwise if you move the panel, you dont see your active desktop item anymore!!!



This Idea could be used for any type of active desktop data. Sports Scores, Stocks, Etc......

Posted: Fri Mar 12, 2004 11:07 am
by acheslow
Jim is working on a plugin called WeatherReport - http://www.cebotics.com/phpbb2/viewtopi ... eport#1282



I also put together a quick script to download weather data from TWC (free registration required) and display images on my remote as dynamic images. This isn't documented so you'll have to read through the code to figure out how to setup a 'Weather' device but you should get the general idea.

Code: Select all

'	Set folder location of Weather.com icons and downloaded images
DestFolder = "c:\Program Files\HouseBot\Config\Themes\Common\weather\"

'	Weather.com partner ID
WeatherComPar = "xxxxxxxx"

'	Weather.com key
WeatherComKey = "xxxxxxxx

'	Get weather for this postal code
WeatherComZip = "xxxxx"


Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
Const adSaveCreateNotExist = 1 

Set xml = CreateObject("Microsoft.XMLHTTP")
set oStream = createobject("Adodb.Stream")
oStream.type = adTypeBinary

Set MSXML = CreateObject("MSXML.DOMDocument")
MSXML.Async = False
MSXML.preserveWhiteSpace = False
MSXML.validateOnParse = True
MSXML.resolveExternals = False
XMLURL = "http://xoap.weather.com/weather/local/" + WeatherComZip + "?cc=*&prod=xoap&par=" + WeatherComPar + "&key=" + WeatherComKey + "&dayf=5"


'	Get weather images and update device properties
'	(customize this for your own use)
getImage "http://image.weather.com/web/radar/us_atl_metroradar_large_usen.jpg", "W_radar"
getImage "http://image.weather.com/images/sat/regions/southeast_sat_720x486.jpg", "W_sat"

set oStream = nothing
Set xml = Nothing


Loaded = MSXML.Load(XMLURL)
If (Loaded) Then
	SetPropertyValue "Weather.W_cc_lsup", MSXML.SelectSingleNode("/weather/cc/lsup").text
	SetPropertyValue "Weather.W_cc_tmp", MSXML.SelectSingleNode("/weather/cc/tmp").text + "°F"
	SetPropertyValue "Weather.W_cc_flik", MSXML.SelectSingleNode("/weather/cc/flik").text + "°F"
	SetPropertyValue "Weather.W_cc_t", MSXML.SelectSingleNode("/weather/cc/t").text
	SetPropertyValue "Weather.W_cc_icon", DestFolder + MSXML.SelectSingleNode("/weather/cc/icon").text + ".png"
	SetPropertyValue "Weather.W_cc_bar_r", MSXML.SelectSingleNode("/weather/cc/bar/r").text
	SetPropertyValue "Weather.W_cc_bar_d", MSXML.SelectSingleNode("/weather/cc/bar/d").text
	SetPropertyValue "Weather.W_cc_wind", "From the " + MSXML.SelectSingleNode("/weather/cc/wind/t").text + " at "+ MSXML.SelectSingleNode("/weather/cc/wind/s").text + " mph"
	SetPropertyValue "Weather.W_cc_hmid", MSXML.SelectSingleNode("/weather/cc/hmid").text + "%"
	SetPropertyValue "Weather.W_cc_vis", MSXML.SelectSingleNode("/weather/cc/vis").text
	SetPropertyValue "Weather.W_cc_uv", MSXML.SelectSingleNode("/weather/cc/uv/i").text + " " + MSXML.SelectSingleNode("/weather/cc/uv/t").text
	SetPropertyValue "Weather.W_cc_dewp", MSXML.SelectSingleNode("/weather/cc/dewp").text + "°F"
	SetPropertyValue "Weather.W_dayf_lsup", MSXML.SelectSingleNode("/weather/dayf/lsup").text

	Set NodeList = MSXML.documentElement.selectNodes("/weather/dayf/day") 
	For Each Node In NodeList
		SetPropertyValue "Weather.W_dayf_day" + Node.attributes.getNamedItem("d").nodeValue + "_t", Node.attributes.getNamedItem("t").nodeValue
		SetPropertyValue "Weather.W_dayf_day" + Node.attributes.getNamedItem("d").nodeValue + "_dt", Node.attributes.getNamedItem("dt").nodeValue
		SetPropertyValue "Weather.W_dayf_day" + Node.attributes.getNamedItem("d").nodeValue + "_hi", Node.selectSingleNode("hi").text + "°F"
		SetPropertyValue "Weather.W_dayf_day" + Node.attributes.getNamedItem("d").nodeValue + "_low", Node.selectSingleNode("low").text + "°F"

		set PartList = Node.selectNodes("part")
		For Each Part In PartList
			SetPropertyValue "Weather.W_dayf_day" + Node.attributes.getNamedItem("d").nodeValue + "_part" + Part.attributes.getNamedItem("p").nodeValue + "_icon", DestFolder + Part.selectSingleNode("icon").text + ".png"
			SetPropertyValue "Weather.W_dayf_day" + Node.attributes.getNamedItem("d").nodeValue + "_part" + Part.attributes.getNamedItem("p").nodeValue + "_t", Part.selectSingleNode("t").text
			SetPropertyValue "Weather.W_dayf_day" + Node.attributes.getNamedItem("d").nodeValue + "_part" + Part.attributes.getNamedItem("p").nodeValue + "_wind_s", Part.selectSingleNode("wind/s").text + "mph"
			SetPropertyValue "Weather.W_dayf_day" + Node.attributes.getNamedItem("d").nodeValue + "_part" + Part.attributes.getNamedItem("p").nodeValue + "_wind_gust", Part.selectSingleNode("wind/gust").text
			SetPropertyValue "Weather.W_dayf_day" + Node.attributes.getNamedItem("d").nodeValue + "_part" + Part.attributes.getNamedItem("p").nodeValue + "_wind_d", Part.selectSingleNode("wind/d").text
			SetPropertyValue "Weather.W_dayf_day" + Node.attributes.getNamedItem("d").nodeValue + "_part" + Part.attributes.getNamedItem("p").nodeValue + "_wind_t", Part.selectSingleNode("wind/t").text
			SetPropertyValue "Weather.W_dayf_day" + Node.attributes.getNamedItem("d").nodeValue + "_part" + Part.attributes.getNamedItem("p").nodeValue + "_ppcp", Part.selectSingleNode("ppcp").text + "%"
			SetPropertyValue "Weather.W_dayf_day" + Node.attributes.getNamedItem("d").nodeValue + "_part" + Part.attributes.getNamedItem("p").nodeValue + "_hmid", Part.selectSingleNode("hmid").text + "%"
		Next
	Next

End If


Sub getImage(URL, PropName)
	DirArray = Split(URL, "/")
	ImageFile = DirArray(UBound(DirArray))
	xml.Open "GET", URL, False
	xml.Send
	oStream.open
	oStream.write xml.responseBody
	oStream.savetofile DestFolder & ImageFile, adSaveCreateOverWrite
	oStream.close
	SetPropertyValue "Weather." + PropName, DestFolder + ImageFile
End Sub


Click these thumbnails for bigger pictures:

Image Image

Posted: Fri Mar 12, 2004 9:21 pm
by gorfllub
That is Fantastic! That is pretty much exactly what I want to do (Except that site isnt set up well for Canada)





Anyhow, Knowing absolutey nothing about scripts, I have a couple of questions:





1st, can you advise an FAQ somewhere to get the lowdown on scripting?



2nd, What type of file would that script be? I save it as an .EXE and I have tried a .JAR and it does some things when I execute it, but always comes up with errors and such......



I understand this scripting thing is a long conversation in its own self, but I certainly appreciate any knowledge that can be passed along.



Thanks

Posted: Sat Mar 13, 2004 6:25 am
by kbosscawen
acheslow - I agree with gorfllub - This is a great script, and I plan to use it until the plug in is ready. I have a question on the Weather device set up, though...



When you set up the device, did you add properties to HB's property list, or just use the User definable ones that are already there. From the script it looks like there are many, many properties - I'm not sure I can find that many user definable already in HB.



Would you be willing to export your Weather device and either post it here or email it to me ([email protected])?



Scott: What do you think of having a script area where people can post scripts that may be useful for those of us who either only have VBS available to us or aren't that programmatically inclined?

Posted: Sat Mar 13, 2004 11:14 am
by ScottBot
kbosscawen wrote:Scott: What do you think of having a script area where people can post scripts that may be useful for those of us who either only have VBS available to us or aren't that programmatically inclined?
I'm open to changing the site to meet whatever demands HouseBot needs. There's only been a small handful of great scripts that I've seen (this is one of them). Many times the script works directly with another Device or specific Properties, so it may be better to actually do a configuration export of the Script Device (and script file). I can include the export file in the existing configuration sample section.



If user contributions increase, I may add a method for users to simply upload their work directly to the site. That has its advantages and disadvantages as you might be able to guess. For now, just let me know if you want to share something and send it to me.

Posted: Sat Mar 13, 2004 4:32 pm
by acheslow
Ok give me a little time and I'll do an export of the configuration including the script and hopefully a little documentation. Look for it hopefully by early next week.

Posted: Tue Mar 16, 2004 4:58 pm
by acheslow
OK here is a link to the export. Scott, feel free to download this and put it in your site somewhere. I'll continue to host it on my site as well. I hope this works out OK, please let me know if anyone has any problems or needs help.

Posted: Wed Mar 17, 2004 9:55 am
by ScottBot
Alan,



Thanks! I made one minor modification to the export (hope you don't mind). Your path to the script file included your machine name so the export process didn't escape it with the HouseBot path (something it does to resolve differences in file locations between different machines).



I've posted it in the configuration samples.



Thanks again.

Posted: Wed Mar 17, 2004 10:03 am
by acheslow
Thanks Scott, I updated the download on my site too.

Posted: Mon Mar 22, 2004 2:56 pm
by acheslow
I've updated the download on my site to include a sample theme which makes use of many of the Weather device properties.



http://www.cheslow.com/modules.php?op=m ... load&cid=3