Earthtools sun forecast
Does anyone use the sample script for determining sunrise/sunset?
I've installed this script into my plugboard directory to implement sunset light switching as an alternative to the IFTTT + twitter version which I have used up to now.
I've changed the Lat/Long to (roughly) my home location and set it running. I've calculated the sunrise/sunset times and also referenced them from wuderground:
http://www.wunderground.com/cgi-bin/findweather/getForecast?query=55.507...
This gives sunrise /sunset of 7:37am / 5:27 pm which agrees with my calculated times.
The applet returns sunrise / sunset times of sunrise=08:13:57 sunset=16:59:34 and the web page set to auto gives sunrise=09:13:57 sunset=17:59:34 for Prestwick airport. Neither of these times seems to have any relationship to the actual sunrise and sunset times.
I can, of course, just fiddle the Lat/Long to give a more acceptable answer but ........
Anyone else encountered this problem?
I guess the request should also get the status code and if this is not 200 (sucess) then just bug out.
local xmlstring,statuscode = http.request(url)
if xmlstring == nil or statuscode ~= 200 then return end
!= is C
~= is LUA Why oh why did they did make up yet another not equals token set.
Brett
Brett
You do have to wonder why they do that sometimes. Is it just for sheer awkwardness or have they never used another language?
The same is true for many of the syntax changes between one language and another.
I guess they want to make a stand, put their own stamp on it :)
Allan
It looks like it's still down so I have defaulted my 'daytime' to no
Mark
Alan did you see my comment? Its a two line code change to fix and when earthtools come back up the applet will kick back into gear.
Brett
Earth tools came back online sometime over night.
Just had plugboard stop with this log
lua: /usr/share/lua/5.1/pl/xml.lua:619: attempt to perform arithmetic on local 'j' (a nil value)
stack traceback:
/usr/share/lua/5.1/pl/xml.lua:619: in function 'parser'
/usr/share/lua/5.1/pl/xml.lua:86: in function 'parse'
/etc/plugboard/sunForecastApplet.lua:40: in function 'callback'
/usr/share/lua/5.1/xap/init.lua:180: in function 'dispatch'
/usr/share/lua/5.1/xap/init.lua:132: in function 'fun'
/usr/share/lua/5.1/pl/List.lua:392: in function 'foreach'
/usr/share/lua/5.1/xap/init.lua:130: in function 'process'
/etc/plugboard/plugboard.lua:68: in main chunk
[C]: ?
It seems www.earthtools.org is down at the moment which sends back a 404 error and thus breaks the xml parsing