View unanswered posts | View active topics It is currently Wed May 22, 2013 2:54 am



Reply to topic  [ 79 posts ]  Go to page: 1, 2, 3, 4, 5, 6  Next
 AccuWeather Attachment Script 
Author Message
User avatar

Joined: Dec 29, 2005
Posts: 585
Location: Third byte on the right
Post AccuWeather Attachment Script
Threadhead made a NOAA Weather Script a while ago, but I can't use it for the Netherlands.
So I decided to write my own script, based on Tigers Weather widget.

It fetches the temperature from any location that the Weather widget supports and stores it into an Indigo variable. It can be extended to fetch other info as well, such as humidity, wind direction, visibility etc..

Installing it requires a bit of work, but that should only take a couple of minutes.

AccuWeather Attachment

Have fun!

_________________
"I tawt I taw a puddy tat!" Tweety


Sat Aug 12, 2006 1:52 am
Profile WWW
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11689
Location: Texas
Post Re: AccuWeather Attachment Script
Great idea and script -- thanks for sharing.

Regards,
Matt


Sat Aug 12, 2006 9:07 am
Profile WWW
User avatar

Joined: Dec 29, 2005
Posts: 585
Location: Third byte on the right
Post 
The script stopt working today because XML parsing failed.
Somehow the XML data returning from AccuWeather was using the LATIN1 encoding, which the XML parser can't handle.
My guess is that they changed the XML output at the AccuWeather site.
So before parsing the XML, I change the encoding to UTF-8 using a simple string-replace.

Version 1.1 has been released to solve this problem.

AccuWeather Attachment

To update from version 1.0 to 1.1, the best thing to do is to copy the URL you use for the AccuWeather site from the old script and paste it into the new script. Then reload attachments and everything should be working again.

_________________
"I tawt I taw a puddy tat!" Tweety


Wed Sep 13, 2006 5:24 pm
Profile WWW

Joined: Aug 25, 2006
Posts: 15
Post 
I am getting a weird error about a variable.

This is from Log file.

Time/Date Action Fetch Temperature
Error script error: The variable responseText is not defined.
Error script error: The variable responseText is not defined.


I am applescript ignorant or I would really try to solve.

Thanks for the help.


Sat Sep 16, 2006 1:23 pm
Profile
User avatar

Joined: Dec 29, 2005
Posts: 585
Location: Third byte on the right
Post 
I used a wrong variable name in the code, hence the error message.
Version 1.1.1 can be downloaded at the link shown above.
Same upgrade rules apply.

Sorry for the inconvenience, but I'm doing the right thing now: installing a proper test environment for my Indigo stuff.

_________________
"I tawt I taw a puddy tat!" Tweety


Sat Sep 16, 2006 2:14 pm
Profile WWW

Joined: Jul 05, 2006
Posts: 54
Location: Paris (France)
Post 
Good job Macpro !
I have a question : is it possible to retrieve the weather (cloudy, sunny, rainy) in a variable too ?
Thanks !


Mon Sep 18, 2006 5:15 pm
Profile
User avatar

Joined: Dec 29, 2005
Posts: 585
Location: Third byte on the right
Post 
Yes, that can be done.
I'll post some instructions on how to do this tonight.

_________________
"I tawt I taw a puddy tat!" Tweety


Mon Sep 18, 2006 11:29 pm
Profile WWW
User avatar

Joined: Dec 29, 2005
Posts: 585
Location: Third byte on the right
Post 
Version 1.2 has been released so it's a bit easier to get extra info.

In the ReadMe, you'll find this new section at the end:

I need more info!
If you need more info, you can change the AccuWeather script yourself and decide what you want to see in Indigo variables.
Just double-click on the AccuWeather.scpt file to open it in ScriptEditor. Then scroll to the section labeled
--===== Start of user choosen extra field ===== --

There you'll find lots of extra fields which you can choose to be stored into Indigo variables.
It will even fetch air and pollen info, so you know when you will get red eyes, sneeze all day and feel bad.

After you have made your choices, save the script. And don't forget to reload the attachments in Indigo, or you will not see the new variables.


AccuWeather Attachment 1.2

To update from prior versions to 1.2, the best thing to do is to copy the URL you use for the AccuWeather site from the old script and paste it into the new script. Then reload attachments and everything should be working again.

_________________
"I tawt I taw a puddy tat!" Tweety


Tue Sep 19, 2006 12:31 pm
Profile WWW

Joined: Jul 23, 2006
Posts: 79
Post 
AWESOME! I tried it out. Now I can have more lights come on during the day if it's cloudy or rainy.

Thanks.


Tue Sep 19, 2006 2:23 pm
Profile

Joined: Oct 04, 2006
Posts: 1
Post 
What happens when you using iso-8859-1 instead of UTF-8?

I'm surprised they didn't use the more standard name for the encoding.

I have a perl script and Expat couldn't parse LATIN1 either.

macpro wrote:The script stopt working today because XML parsing failed.
Somehow the XML data returning from AccuWeather was using the LATIN1 encoding, which the XML parser can't handle.
My guess is that they changed the XML output at the AccuWeather site.
So before parsing the XML, I change the encoding to UTF-8 using a simple string-replace.

Version 1.1 has been released to solve this problem.

AccuWeather Attachment

To update from version 1.0 to 1.1, the best thing to do is to copy the URL you use for the AccuWeather site from the old script and paste it into the new script. Then reload attachments and everything should be working again.


Wed Oct 04, 2006 9:31 am
Profile

Joined: Sep 26, 2006
Posts: 61
Location: Nîmes (France)
Post 
Hi macpro, and many thanks for your script !

How to install my weather icon on my website ?
Variable say "1", i understand that the "1.gif" is sunny (for example), but can i put it on my Indigo's website ?

_________________
Mric


Fri Oct 06, 2006 7:43 am
Profile WWW
User avatar

Joined: Dec 29, 2005
Posts: 585
Location: Third byte on the right
Post 
It is possible to add the icons to a control page, but it will take some time. Unfortunately, I don't have the time at the moment, so I'll give you some hints.

First, extract all the icons from the Weather widget.
Place them in Library>Application Support>Perceptive Automation>Indigo 2>IndigoWebServer>Images>controls>variables folder.
Make an empty image and save it in the folder where you placed the other images, for every image you placed there and give it the same name "+true".
So if you have copied "sun.png" to the folder, save an empty image "sun+true.png" in this folder also.
Define for each image a variable with the prefix AWI (AccuWeather Icon) and the value that the AccuWeather widget fetches. So if 1 is an actual value, define the variable AWI1 and so on.
Define a trigger which fires whenever the variable that holds the icon value changes.
Add some AppleScript code to this trigger that puts all AWI*** variables to true, except for the one that corresponds to the actual value.
Define a control page and add a variable to the control page.
Remove the caption and select the correct image for this variable.
Lets say sun is represented by the value 1, then you would add the variable AWI1 and link the image sun.png to it.
Duplicate this variable and modify it to hold the next AWI*** variable and corresponding icon.
Place it on top of the previous variable.
Repeat this for all icons.

That's it! Easy, isn't it? :wink:

Last step: ask Matt to enhance Indigo so we can put image names in an Indigo variable, to make actions like these a lot easier.

_________________
"I tawt I taw a puddy tat!" Tweety


Fri Oct 06, 2006 2:12 pm
Profile WWW

Joined: Sep 26, 2006
Posts: 61
Location: Nîmes (France)
Post 
Matt can you try to put html language into web interface, because i tried to write : if variablelogo = 1 convert in variable variablelogo2=<img> , but my interface don't give me gif :)

So, thank you macpro, i thought that it was an other issue but ... no :?

But i will do it

I will post every logo(+true) in zip file when i will do it :P (tomorrow)

.png files, files name are : 01,02, etc ... as on AccuWeather Website ...

_________________
Mric


Fri Oct 06, 2006 2:20 pm
Profile WWW

Joined: Jul 05, 2006
Posts: 54
Location: Paris (France)
Post 
Hi everybody !

I am translating the weather state in french but I need all of them !
Currently I have :

CLEAR
PARTLY SUNNY
MOSTLY SUNNY
SUNNY
PARTLY CLOUDY
MOSTLY CLOUDY
CLOUDY
FOGGY
GROUND FOG
LIGHT FOG
DENSE FOG
OVERCAST
RAIN
RAINSHOWER

Can you give me the other weather state, please ?

Thanks in advance !


Wed Oct 11, 2006 5:04 pm
Profile

Joined: Jul 23, 2006
Posts: 79
Post 
THUNDERSTORM


Wed Oct 11, 2006 5:49 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 79 posts ]  Go to page: 1, 2, 3, 4, 5, 6  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.