Getting weather data from Weather Display

Posted on
Mon Feb 08, 2010 4:57 am
bbruck offline
Posts: 279
Joined: Oct 05, 2008

Getting weather data from Weather Display

JimM has been helping me on the Weather Display forums get my weather station to talk to my Mac, and then output a report that can be turned into Indigo variables. He wrote an applescript that takes the txt file and populates Indigo variables with it, but it doesn't work for me. I'm wondering if anyone might be able to assist...

I've cut down the files to show just one variable. Weather Display updates this indigoreport.txt file every 5 minutes:

OutsideHum:96<br>

This is the applescript in a time/date action:

set filePath to "/Library/Application Support/wdisplay/webfiles/indigoreport.txt"

--Outside Humidity
set bolIn to "OutsideHum:"
set eolIn to "<br>"
set varHum to "wxOutsideHum"


-- set [...] script "sed" [...] "//'" should be on one line
-- broken for legibility no other edits should be needed below
tell application "IndigoServer"
    set value of variable varHum to do shell script "sed -n '/" & bolIn & "/p' " & filePath & " | sed 's/" & bolIn & "//' | sed 's/" & eolIn & "//'"
end tell


The variable has been created and displays in the variable list, but with no value.
Any notion why this doesn't work to populate it with 96, in this case?

Posted on
Mon Feb 08, 2010 8:25 am
jay (support) offline
Site Admin
User avatar
Posts: 9104
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Getting weather data from Weather Display

bbruck wrote:
JimM has been helping me on the Weather Display forums get my weather station to talk to my Mac, and then output a report that can be turned into Indigo variables. He wrote an applescript that takes the txt file and populates Indigo variables with it, but it doesn't work for me. I'm wondering if anyone might be able to assist...

I've cut down the files to show just one variable. Weather Display updates this indigoreport.txt file every 5 minutes:

OutsideHum:96<br>

This is the applescript in a time/date action:

set filePath to "/Library/Application Support/wdisplay/webfiles/indigoreport.txt"

--Outside Humidity
set bolIn to "OutsideHum:"
set eolIn to "<br>"
set varHum to "wxOutsideHum"


-- set [...] script "sed" [...] "//'" should be on one line
-- broken for legibility no other edits should be needed below
tell application "IndigoServer"
    set value of variable varHum to do shell script "sed -n '/" & bolIn & "/p' " & filePath & " | sed 's/" & bolIn & "//' | sed 's/" & eolIn & "//'"
end tell


The variable has been created and displays in the variable list, but with no value.
Any notion why this doesn't work to populate it with 96, in this case?


No idea why it wouldn't work - but I'm most definitely not a sed expert. Here's an AppleScript that should do the trick:

Code: Select all
set filePath to POSIX file "/Library/Application Support/wdisplay/webfiles/indigoreport.txt"

set theLines to paragraphs of (read filePath)

repeat with theLine in theLines
   set AppleScript's text item delimiters to ":"
   set theVarName to text item 1 of theLine
   set theVarValueAndTrash to text item 2 of theLine
   set AppleScript's text item delimiters to "<"
   set theVarValue to text item 1 of theVarValueAndTrash
   tell application "IndigoServer"
      set indigoVarName to "wx" & theVarName
      if not (exists variable indigoVarName) then
         make new variable with properties {name:indigoVarName, value:theVarValue}
      else
         set value of variable indigoVarName to theVarValue
      end if
   end tell
end repeat


The nice thing about this script is that it will create the variables if they don't already exist by prepending "wx" to the variable name from the file. I don't have a full version of the file to test with, but it should work as long as there are no odd characters in the variable name (no spaces for instance). The script would be even easier if the "<br>" weren't appended to each line (i.e. if it were just "VarName:Value"), but this works fine.

I wouldn't make this an embedded script however - just make it a script file and call it from your time/date action. That way, if something goes wrong, it doesn't hang up the server.

Jay (Indigo Support)
Twitter | Facebook

Posted on
Mon Feb 08, 2010 11:01 am
bbruck offline
Posts: 279
Joined: Oct 05, 2008

Re: Getting weather data from Weather Display

Humm - I'm getting an error:

error "Can’t get text item 1 of \"\"." number -1728 from text item 1 of ""

Here's the indigoreport.txt file.

OutsideTemp:24<br>
OutsideHum:94<br>
WindSpeed: 3<br>
WindGustSpeed:3.5<br>
RainToday:0.0<br>
DayswithnoRain:2<br>
RainLast7Days:0.169<br>
WeatherReportMetar:Dry<br>
WeatherConditionsStation:Dry<br>
FWI:0.1<br>
ExtraTemp3:30.2<br>
ExtraTemp4:30.2<br>
ExtraTemp5:331.7<br>
IconNumber:5<br>
RainLastHour:0.0<br>

It's actually generated from the indigo.txt file, which I could change which would change the delimiters as desired:

indigo.txt:

OutsideTemp:%tempnodp%<br>
OutsideHum:%hum%<br>
WindSpeed:%avnodp%<br>
WindGustSpeed:%1mingustwind%<br>
RainToday:%todayraininmm%<br>
DayswithnoRain:%dayswithnorain%<br>
RainLast7Days:%raincurrentweek%<br>
WeatherReportMetar:%weatherreport%<br>
WeatherConditionsStation:%weathercond%<br>
FWI:%FWIfwi%<br>
ExtraTemp3:%extratemp3%<br>
ExtraTemp4:%extratemp4%<br>
ExtraTemp5:%extratemp5%<br>
IconNumber:%iconnumber%<br>
RainLastHour:%rainlasthourmm%<br>

Posted on
Mon Feb 08, 2010 12:09 pm
artpics offline
Posts: 185
Joined: Feb 24, 2009
Location: Calabasas CA

Re: Getting weather data from Weather Display

i cannot help with the script. but i get my variables with this method from WD

viewtopic.php?f=5&t=5187&start=15

Posted on
Mon Feb 08, 2010 2:21 pm
jay (support) offline
Site Admin
User avatar
Posts: 9104
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Getting weather data from Weather Display

bbruck wrote:
Humm - I'm getting an error:

error "Can’t get text item 1 of \"\"." number -1728 from text item 1 of ""

Here's the indigoreport.txt file.

OutsideTemp:24<br>
OutsideHum:94<br>
WindSpeed: 3<br>
WindGustSpeed:3.5<br>
RainToday:0.0<br>
DayswithnoRain:2<br>
RainLast7Days:0.169<br>
WeatherReportMetar:Dry<br>
WeatherConditionsStation:Dry<br>
FWI:0.1<br>
ExtraTemp3:30.2<br>
ExtraTemp4:30.2<br>
ExtraTemp5:331.7<br>
IconNumber:5<br>
RainLastHour:0.0<br>

It's actually generated from the indigo.txt file, which I could change which would change the delimiters as desired:

indigo.txt:

OutsideTemp:%tempnodp%<br>
OutsideHum:%hum%<br>
WindSpeed:%avnodp%<br>
WindGustSpeed:%1mingustwind%<br>
RainToday:%todayraininmm%<br>
DayswithnoRain:%dayswithnorain%<br>
RainLast7Days:%raincurrentweek%<br>
WeatherReportMetar:%weatherreport%<br>
WeatherConditionsStation:%weathercond%<br>
FWI:%FWIfwi%<br>
ExtraTemp3:%extratemp3%<br>
ExtraTemp4:%extratemp4%<br>
ExtraTemp5:%extratemp5%<br>
IconNumber:%iconnumber%<br>
RainLastHour:%rainlasthourmm%<br>


The text file probably has a blank line as the last line. I'd change the indigo.txt file and just remove the <br> text. Then use this script which should work even if there's a blank line in the file:

Code: Select all
set filePath to POSIX file "/Library/Application Support/wdisplay/webfiles/indigoreport.txt"

set theLines to paragraphs of (read filePath)

set AppleScript's text item delimiters to ":"
repeat with theLine in theLines
   if (theLine as string) is not equal to "" then
      set theVarName to text item 1 of theLine
      set theVarValue to text item 2 of theLine
      tell application "IndigoServer"
         set indigoVarName to "wx" & theVarName
         if not (exists variable indigoVarName) then
            make new variable with properties {name:indigoVarName, value:theVarValue}
         else
            set value of variable indigoVarName to theVarValue
         end if
      end tell
   end if
end repeat

Jay (Indigo Support)
Twitter | Facebook

Posted on
Mon Feb 08, 2010 4:27 pm
jimM offline
Posts: 46
Joined: Jun 16, 2008
Location: Canada

Re: Getting weather data from Weather Display

Hi guys,

Its been a while since I have been around these parts (couldn't find the password lol)

Jay, I really like your script. namely because it auto names the vars in Indigo whereas the one I have declares them and the user must create them, but they are only created once. The way the indigoreport.txt is set up in Weather Display though my script might help due to the naming conventions in the text file.

I believe bbruck's issue is that you may be naming the Indigo variable to the applescript var (from the script) instead of the wx prefixed variable, try that and see. ie varOut corresponds to and updates wxOutsideTemp in Indigo

Here is my script commented, has been running for 19 months now every 2 minutes so very robust and uses a do shell script command to read the indigoreport.txt in from Weather Display.

NOTE that credit for this script (and the past 18 months of reliable integration with my Weather Display!) goes to CharlieParker of this forum) Thanks Charlie!

Code: Select all
set filePath to "/Library/WebServer/Documents/Hosts/HRMWeather/indigoreport.txt"

--SECTION ONE - Define the applescript variables to hold the values for beginning of line, eol, and the Indigo var)
--Outside Temp
set bolOut to "OutsideTemp:" -- ----------beginning of line characters
set eolOut to "<br>" ----------------------------end of line characters
set varOut to "wxOutsideTemp" -----------applescript variable to hold Indigo variable

--Outside Humidity
set bolIn to "OutsideHum:"
set eolIn to "<br>"
set varHum to "wxOutsideHum"

--Windspeed
set bolWin to "WindSpeed:"
set eolWin to "<br>"
set varWin to "wxWindSpeed"

--GustSpeed:
set bolGus to "WindGustSpeed:"
set eolGus to "<br>"
set varGus to "wxWindGustSpeed"

--Today's Rain
set bolDra to "RainToday:"
set eolDra to "<br>"
set varDra to "wxRainToday"

--#Days without rain
set bolDnr to "DayswithnoRain:"
set eolDnr to "<br>"
set varDnr to "wxDayswithnoRain"

--Rain Last7 Days
set bolRlw to "RainLast7Days:"
set eolRlw to "<br>"
set varRlw to "wxRainLast7Days"

-- Weather Report from the Airport
set bolWrm to "WeatherReportMetar:"
set eolWrm to "<br>"
set varWrm to "wxWeatherReportMetar"

-- Weather Report from the Station
set bolWst to "WeatherConditionsStation:"
set eolWst to "<br>"
set varWst to "wxWeatherConditionsStation"

-- Solar Temp
set bolStp to "SolarTemp:"
set eolStp to "<br>"
set varStp to "wxSolarTemp"

-- Icon Number
set bolIcn to "IconNumber:"
set eolIcn to "<br>"
set varIcn to "wxIcon"

--Rain Last Hour
set bolRlh to "RainLastHour:"
set eolRlh to "<br>"
set varRlh to "wxRainLastHour"

--FWI
set bolFWI to "FWI:"
set eolFWI to "<br>"
set varFWI to "wxFWI"

--Solar Description
set bolSld to "SolarDescription:"
set eolSld to "<br>"
set varSld to "wxSolarDescription"

--Solar Percent
set bolSlp to "SolarPercent:"
set eolSlp to " %<br>"
set varSlp to "wxSolarPercent"

--Feels Like
set bolFlk to "FeelsLike:"
set eolFlk to "<br>"
set varFlk to "wxFeelsLike"


-- SECTION TWO - Do a shell script that reads each line as defined above and set the var (which in turn sets the Indigo var)
tell application "IndigoServer"
    set value of variable varOut to do shell script "sed -n '/" & bolOut & "/p' " & filePath & " | sed 's/" & bolOut & "//' | sed 's/" & eolOut & "//'"
    -- The first command above means to
    -- Set the value of this Applescript variable "varOut" (represents and updates the Indigo variable "wxOutsideTemp" set above)
    -- by reading the line noted in the "do shell script" command between the beginning of line and end of line chars defined above
    -- IMPORTANT - all characters from "set" TO "//'" should be on one line (stretch your window to check this)
    set value of variable varHum to do shell script "sed -n '/" & bolIn & "/p' " & filePath & " | sed 's/" & bolIn & "//' | sed 's/" & eolIn & "//'"
    set value of variable varWin to do shell script "sed -n '/" & bolWin & "/p' " & filePath & " | sed 's/" & bolWin & "//' | sed 's/" & eolWin & "//'"
    set value of variable varGus to do shell script "sed -n '/" & bolGus & "/p' " & filePath & " | sed 's/" & bolGus & "//' | sed 's/" & eolGus & "//'"
    set value of variable varDra to do shell script "sed -n '/" & bolDra & "/p' " & filePath & " | sed 's/" & bolDra & "//' | sed 's/" & eolDra & "//'"
    set value of variable varDnr to do shell script "sed -n '/" & bolDnr & "/p' " & filePath & " | sed 's/" & bolDnr & "//' | sed 's/" & eolDnr & "//'"
    set value of variable varRlw to do shell script "sed -n '/" & bolRlw & "/p' " & filePath & " | sed 's/" & bolRlw & "//' | sed 's/" & eolRlw & "//'"
    set value of variable varWrm to do shell script "sed -n '/" & bolWrm & "/p' " & filePath & " | sed 's/" & bolWrm & "//' | sed 's/" & eolWrm & "//'"
    set value of variable varWst to do shell script "sed -n '/" & bolWst & "/p' " & filePath & " | sed 's/" & bolWst & "//' | sed 's/" & eolWst & "//'"
    set value of variable varStp to do shell script "sed -n '/" & bolStp & "/p' " & filePath & " | sed 's/" & bolStp & "//' | sed 's/" & eolStp & "//'"
    set value of variable varIcn to do shell script "sed -n '/" & bolIcn & "/p' " & filePath & " | sed 's/" & bolIcn & "//' | sed 's/" & eolIcn & "//'"
    set value of variable varRlh to do shell script "sed -n '/" & bolRlh & "/p' " & filePath & " | sed 's/" & bolRlh & "//' | sed 's/" & eolRlh & "//'"
    set value of variable varFWI to do shell script "sed -n '/" & bolFWI & "/p' " & filePath & " | sed 's/" & bolFWI & "//' | sed 's/" & eolFWI & "//'"
    set value of variable varSld to do shell script "sed -n '/" & bolSld & "/p' " & filePath & " | sed 's/" & bolSld & "//' | sed 's/" & eolSld & "//'"
    set value of variable varSlp to do shell script "sed -n '/" & bolSlp & "/p' " & filePath & " | sed 's/" & bolSlp & "//' | sed 's/" & eolSlp & "//'"
    set value of variable varFlk to do shell script "sed -n '/" & bolFlk & "/p' " & filePath & " | sed 's/" & bolFlk & "//' | sed 's/" & eolFlk & "//'"
end tell


Now I'm going to give Jay's a try to see if it's as robust, love it's simplicity... will let you know how it does with the Weather Display file.

All the best

Jim

Posted on
Mon Feb 08, 2010 7:49 pm
jay (support) offline
Site Admin
User avatar
Posts: 9104
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Getting weather data from Weather Display

jimM wrote:
Hi guys,

Its been a while since I have been around these parts (couldn't find the password lol)

Jay, I really like your script. namely because it auto names the vars in Indigo whereas the one I have declares them and the user must create them, but they are only created once. The way the indigoreport.txt is set up in Weather Display though my script might help due to the naming conventions in the text file.

I believe bbruck's issue is that you may be naming the Indigo variable to the applescript var (from the script) instead of the wx prefixed variable, try that and see. ie varOut corresponds to and updates wxOutsideTemp in Indigo

Here is my script commented, has been running for 19 months now every 2 minutes so very robust and uses a do shell script command to read the indigoreport.txt in from Weather Display.

NOTE that credit for this script (and the past 18 months of reliable integration with my Weather Display!) goes to CharlieParker of this forum) Thanks Charlie!

Code: Select all
set filePath to "/Library/WebServer/Documents/Hosts/HRMWeather/indigoreport.txt"

--SECTION ONE - Define the applescript variables to hold the values for beginning of line, eol, and the Indigo var)
--Outside Temp
set bolOut to "OutsideTemp:" -- ----------beginning of line characters
set eolOut to "<br>" ----------------------------end of line characters
set varOut to "wxOutsideTemp" -----------applescript variable to hold Indigo variable

--Outside Humidity
set bolIn to "OutsideHum:"
set eolIn to "<br>"
set varHum to "wxOutsideHum"

--Windspeed
set bolWin to "WindSpeed:"
set eolWin to "<br>"
set varWin to "wxWindSpeed"

--GustSpeed:
set bolGus to "WindGustSpeed:"
set eolGus to "<br>"
set varGus to "wxWindGustSpeed"

--Today's Rain
set bolDra to "RainToday:"
set eolDra to "<br>"
set varDra to "wxRainToday"

--#Days without rain
set bolDnr to "DayswithnoRain:"
set eolDnr to "<br>"
set varDnr to "wxDayswithnoRain"

--Rain Last7 Days
set bolRlw to "RainLast7Days:"
set eolRlw to "<br>"
set varRlw to "wxRainLast7Days"

-- Weather Report from the Airport
set bolWrm to "WeatherReportMetar:"
set eolWrm to "<br>"
set varWrm to "wxWeatherReportMetar"

-- Weather Report from the Station
set bolWst to "WeatherConditionsStation:"
set eolWst to "<br>"
set varWst to "wxWeatherConditionsStation"

-- Solar Temp
set bolStp to "SolarTemp:"
set eolStp to "<br>"
set varStp to "wxSolarTemp"

-- Icon Number
set bolIcn to "IconNumber:"
set eolIcn to "<br>"
set varIcn to "wxIcon"

--Rain Last Hour
set bolRlh to "RainLastHour:"
set eolRlh to "<br>"
set varRlh to "wxRainLastHour"

--FWI
set bolFWI to "FWI:"
set eolFWI to "<br>"
set varFWI to "wxFWI"

--Solar Description
set bolSld to "SolarDescription:"
set eolSld to "<br>"
set varSld to "wxSolarDescription"

--Solar Percent
set bolSlp to "SolarPercent:"
set eolSlp to " %<br>"
set varSlp to "wxSolarPercent"

--Feels Like
set bolFlk to "FeelsLike:"
set eolFlk to "<br>"
set varFlk to "wxFeelsLike"


-- SECTION TWO - Do a shell script that reads each line as defined above and set the var (which in turn sets the Indigo var)
tell application "IndigoServer"
    set value of variable varOut to do shell script "sed -n '/" & bolOut & "/p' " & filePath & " | sed 's/" & bolOut & "//' | sed 's/" & eolOut & "//'"
    -- The first command above means to
    -- Set the value of this Applescript variable "varOut" (represents and updates the Indigo variable "wxOutsideTemp" set above)
    -- by reading the line noted in the "do shell script" command between the beginning of line and end of line chars defined above
    -- IMPORTANT - all characters from "set" TO "//'" should be on one line (stretch your window to check this)
    set value of variable varHum to do shell script "sed -n '/" & bolIn & "/p' " & filePath & " | sed 's/" & bolIn & "//' | sed 's/" & eolIn & "//'"
    set value of variable varWin to do shell script "sed -n '/" & bolWin & "/p' " & filePath & " | sed 's/" & bolWin & "//' | sed 's/" & eolWin & "//'"
    set value of variable varGus to do shell script "sed -n '/" & bolGus & "/p' " & filePath & " | sed 's/" & bolGus & "//' | sed 's/" & eolGus & "//'"
    set value of variable varDra to do shell script "sed -n '/" & bolDra & "/p' " & filePath & " | sed 's/" & bolDra & "//' | sed 's/" & eolDra & "//'"
    set value of variable varDnr to do shell script "sed -n '/" & bolDnr & "/p' " & filePath & " | sed 's/" & bolDnr & "//' | sed 's/" & eolDnr & "//'"
    set value of variable varRlw to do shell script "sed -n '/" & bolRlw & "/p' " & filePath & " | sed 's/" & bolRlw & "//' | sed 's/" & eolRlw & "//'"
    set value of variable varWrm to do shell script "sed -n '/" & bolWrm & "/p' " & filePath & " | sed 's/" & bolWrm & "//' | sed 's/" & eolWrm & "//'"
    set value of variable varWst to do shell script "sed -n '/" & bolWst & "/p' " & filePath & " | sed 's/" & bolWst & "//' | sed 's/" & eolWst & "//'"
    set value of variable varStp to do shell script "sed -n '/" & bolStp & "/p' " & filePath & " | sed 's/" & bolStp & "//' | sed 's/" & eolStp & "//'"
    set value of variable varIcn to do shell script "sed -n '/" & bolIcn & "/p' " & filePath & " | sed 's/" & bolIcn & "//' | sed 's/" & eolIcn & "//'"
    set value of variable varRlh to do shell script "sed -n '/" & bolRlh & "/p' " & filePath & " | sed 's/" & bolRlh & "//' | sed 's/" & eolRlh & "//'"
    set value of variable varFWI to do shell script "sed -n '/" & bolFWI & "/p' " & filePath & " | sed 's/" & bolFWI & "//' | sed 's/" & eolFWI & "//'"
    set value of variable varSld to do shell script "sed -n '/" & bolSld & "/p' " & filePath & " | sed 's/" & bolSld & "//' | sed 's/" & eolSld & "//'"
    set value of variable varSlp to do shell script "sed -n '/" & bolSlp & "/p' " & filePath & " | sed 's/" & bolSlp & "//' | sed 's/" & eolSlp & "//'"
    set value of variable varFlk to do shell script "sed -n '/" & bolFlk & "/p' " & filePath & " | sed 's/" & bolFlk & "//' | sed 's/" & eolFlk & "//'"
end tell


Now I'm going to give Jay's a try to see if it's as robust, love it's simplicity... will let you know how it does with the Weather Display file.

All the best

Jim


Thanks Jim - I also tried your script and the sed command wasn't returning anything, which is why switched to all AppleScript. I wonder if an OS (and sed) version difference is the issue? I was trying it on 10.6.2.

Anyway, I literally tossed that script together early this morning, so it may not be super robust (it would probably fail if the file didn't exist for instance). The first version also failed because of a blank line, but that's fixed now. Anyway, I'm sure if there are any other issues they could be fixed pretty quickly.

Jay (Indigo Support)
Twitter | Facebook

Posted on
Mon Feb 08, 2010 9:00 pm
artpics offline
Posts: 185
Joined: Feb 24, 2009
Location: Calabasas CA

Re: Getting weather data from Weather Display

Jay thanks for putting the script together works great 100% a lot better than my attempt :D

Posted on
Mon Feb 08, 2010 9:26 pm
jay (support) offline
Site Admin
User avatar
Posts: 9104
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Getting weather data from Weather Display

artpics wrote:
Jay thanks for putting the script together works great 100% a lot better than my attempt :D


If any of you are familiar enough with Weather Display to know if it can post values to a custom URL, then an even more elegant solution is something like I did with LWC - it posts data to an IWS plugin I wrote every 5 minutes. The plugin then populates the data into Indigo variables. It's nice cause there's no intermediary file involved, and you only have to worry about setting the software to "push" the values (vs a push to file and then a pull from the file to Indigo). The LWC plugin is pretty simple really - if WD can do either POST or GET data to a URL then it should be pretty simple to use it as a pattern for a WD plugin. I looked, but I didn't see that ability in WD, although I will admit that the UI totally bewilders me so I could be missing it.

Jay (Indigo Support)
Twitter | Facebook

Posted on
Mon Feb 08, 2010 10:02 pm
artpics offline
Posts: 185
Joined: Feb 24, 2009
Location: Calabasas CA

Re: Getting weather data from Weather Display

i have made a new topic on the WD forum about this. :D

Posted on
Tue Feb 09, 2010 5:30 am
jimM offline
Posts: 46
Joined: Jun 16, 2008
Location: Canada

Re: Getting weather data from Weather Display

Just a comment. I would think that 5 minutes would keep me away from a plugin. That became a big issue here many times in unstable weather here and now I actually run my applescript every 1 minute in the winter as of late, but probably will return to 2 minutes in the summer months.

Also, a big issue will be what tags we can send over to Indigo through a plugin. The basics is boring. I want to know things like rain last 7 days, all time rain rate, Fire Weather Index, as I do now and show on the Indigo page with the applescript. There are 2000 tags in Weather Display, so this would be important to have the capability to receive any of them. That's what separates WD from the rest.

WD does have that capability in the Windows version now, according to Windy the developer over there (which is also running on many Macs through Fusion/Parallels although I prefer the Mac flavor :)). He says it can be added to the Mac. I suggested a Control Panel just for configing info to Indigo. You should contact him. Seeing what he has written in due to user requests, I'm betting this is doable.

Posted on
Tue Feb 09, 2010 6:26 am
jimM offline
Posts: 46
Joined: Jun 16, 2008
Location: Canada

Re: Getting weather data from Weather Display

jay wrote:

Thanks Jim - I also tried your script and the sed command wasn't returning anything, which is why switched to all AppleScript. I wonder if an OS (and sed) version difference is the issue? I was trying it on 10.6.2.


Hi Jay, I am on 10.6.2 (Snow Leopard) as well.

I used your script this morning, and first of all love it! Agreed though robustness may be an issue. If you could reset the text item delimiters at the end of the tell it would be a good thing :)

The "sed" command is unchanged between Os's. I wonder out loud if there are extra characters finding there way into the code through posting. You may want to check and ensure the Set commands in the bottom section (per my most recent version) are are on single lines in the embed window (stretching the window to confirm.) I found the shell script command to be 100% robust and reliable and I think that is the key, especially with Applescript's Snow leopard bug, but that only seems to involve the finder app/system events, so it doesn't apply to your script.

I also have to set up each Indigo variable to the name above (prefixed with wx in the applescript)

That said, bbruck, I would highly recommend this script, all you would do is take out the <br> in the indigo.txt file I used as line endings and save it. The rest is automatic with Jay's script. indigoreport.txt will be created, and the variables populated. A plum with Jay's script is you would just add whatever tags you want to go to Indigo, to the indigo.txt file, and they would auto appear in Indigo variables whether you set them up or not. ... whereas with mine there is maintenance required to set up/modify new vars.

Jay, if you could revise the script to reset delimeters to default ( I can't remember the command right off the tip of my head) I will test for another 24 hours, then will this over at the WD forum on success, in my Applescript/Indigo posts and will suggest replacing mine with this script.

Good Stuff

All the best
Jim

Posted on
Tue Feb 09, 2010 8:32 am
jay (support) offline
Site Admin
User avatar
Posts: 9104
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Getting weather data from Weather Display

jimM wrote:
Just a comment. I would think that 5 minutes would keep me away from a plugin. That became a big issue here many times in unstable weather here and now I actually run my applescript every 1 minute in the winter as of late, but probably will return to 2 minutes in the summer months.


I picked 5 minutes because it suited my needs - but that's the beauty of an IWS plugin - the polling is controlled by the sender, so i could configure LWC to send it every 1 minute.

Jay (Indigo Support)
Twitter | Facebook

Posted on
Tue Feb 09, 2010 8:45 am
jay (support) offline
Site Admin
User avatar
Posts: 9104
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Getting weather data from Weather Display

jimM wrote:
I used your script this morning, and first of all love it! Agreed though robustness may be an issue. If you could reset the text item delimiters at the end of the tell it would be a good thing :)


There are two camps about this - one for and one against. I am a member of the latter for several reasons: 1) you should NEVER assume that they are what you want them to be because the default is "" - that's right, none. So, without setting them, you're actually just pulling apart each character. And 2) only scripts that run in the same instance of an AppleScript are effected so it doesn't do anything useful to reset them.

Jay (Indigo Support)
Twitter | Facebook

Posted on
Tue Feb 09, 2010 10:00 am
jimM offline
Posts: 46
Joined: Jun 16, 2008
Location: Canada

Re: Getting weather data from Weather Display

jay wrote:
There are two camps about this - one for and one against. I am a member of the latter for several reasons: 1) you should NEVER assume that they are what you want them to be because the default is "" - that's right, none. So, without setting them, you're actually just pulling apart each character. And 2) only scripts that run in the same instance of an AppleScript are effected so it doesn't do anything useful to reset them.


AHA! I never knew about #2, thought it was a global thing. Thanks for clearing that up.

jay wrote:
I picked 5 minutes because it suited my needs - but that's the beauty of an IWS plugin - the polling is controlled by the sender, so i could configure LWC to send it every 1 minute.


Do you think it could be configured either at the WD end (via POST) or in Indigo as I'm sure users would have many different reasons as I for wanting different intervals. Also, just for my own info, WD does a lot of posting to other websites both through file transfer and through a URL which the user actually selects some parameters as well as the timing, so could the plugin be like a "listener" that once active, just listens for posts from WD to a port (tcp or otherwise) then sets and or creates/sets the variable? or am I way off base here.

Jim

Thanks for the follow ups. Learning a lot from it.

Who is online

Users browsing this forum: No registered users and 2 guests