Closed tingweil closed 6 years ago
Updates?
The weather forecast still not showing up, but i can live with it..
That is so weird. You can test that this is working or not by going directly to the code that provides that info (in your case that will be) http://tingliang-photo.com/thermo2/get_instant_forecast.php And I can see that indeed it's not working.
Try this.
http://api.wunderground.com/api/WWWWW/conditions/q/J5R2X8.xml
Where WWWWW is your API key for weatherunderground.
You've got your key in the config.php file in the section that looks like
$weatherConfig = array(
'useWeather' => TRUE, // TRUE, FALSE (Flag to use external temperature for all stats)
'useForecast' => TRUE, // TRUE, FALSE (Flag to show forecast on dashboard))
'type' => 'weatherunderground', // weatherunderground, noaa, weatherbug
'units' => 'F', // F, C
'api_key' => '0000000000000000', // Registered API key
// api_loc needs work - it is relied upon by noaa code, but the others pretty much ignore it.
'api_loc' => NULL // NULL (but NEVER blank ''), http://w1.weather.gov/xml/current_obs/KUZA.xml
// URL - User Specific
// See http://www.wunderground.com/weather/api/d/docs
// http://weather.weatherbug.com/desktop-weather/api-documents.html
// http://w1.weather.gov/xml/current_obs/
);
If you do not have an api key, you can get one for free http://www.wunderground.com/weather/api/ Click the "Sign up for Free" button - choose the "Developer" version.
Using my API key I saw that data for your zip code is available. Ifyou already have an API key, then I'm not sure why it is not working and will have to dig deeper.
That is really weird, I'll check the xml on that and see if it is a different format than the one I get.
Oh wait, my mistake on the URL. Should be this (forecast, not conditions) http://api.wunderground.com/api/12bc462cc3714030/forecast/q/J5R2X8.xml
But it still works.
I've archived your XML here for reference. There are some odd blank lines. I might need to make sure that those are not messing up the parsing.
<response>
<version>0.1</version>
<termsofService>http://www.wunderground.com/weather/api/d/terms.html</termsofService>
<features>
<feature>forecast</feature>
</features>
<forecast>
<txt_forecast>
<date>7:00 PM EST</date>
<forecastdays>
<forecastday>
<period>0</period>
<icon>partlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/partlycloudy.gif</icon_url>
<title>Saturday</title>
<fcttext><![CDATA[Clear in the morning, then mostly cloudy. High of 39F with a windchill as low as 19F. Breezy. Winds from the SW at 10 to 20 mph.]]></fcttext>
<fcttext_metric><![CDATA[Clear in the morning, then mostly cloudy. High of 4C with a windchill as low as -7C. Windy. Winds from the SW at 20 to 30 km/h.]]></fcttext_metric>
<pop>0</pop>
</forecastday>
<forecastday>
<period>1</period>
<icon>clear</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/clear.gif</icon_url>
<title>Saturday Night</title>
<fcttext><![CDATA[Clear. Low of 21F with a windchill as low as 14F. Winds from the WSW at 10 to 15 mph.]]></fcttext>
<fcttext_metric><![CDATA[Clear. Low of -6C with a windchill as low as -10C. Breezy. Winds from the WSW at 20 to 25 km/h.]]></fcttext_metric>
<pop>0</pop>
</forecastday>
<forecastday>
<period>2</period>
<icon>partlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/partlycloudy.gif</icon_url>
<title>Sunday</title>
<fcttext><![CDATA[Overcast. High of 32F with a windchill as low as 12F. Breezy. Winds from the WSW at 15 to 20 mph.]]></fcttext>
<fcttext_metric><![CDATA[Overcast. High of 0C with a windchill as low as -11C. Windy. Winds from the WSW at 25 to 30 km/h.]]></fcttext_metric>
<pop>0</pop>
</forecastday>
<forecastday>
<period>3</period>
<icon>partlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/partlycloudy.gif</icon_url>
<title>Sunday Night</title>
<fcttext><![CDATA[Clear in the evening, then mostly cloudy. Low of 9F with a windchill as low as 3F. Winds from the WSW at 10 to 15 mph.]]></fcttext>
<fcttext_metric><![CDATA[Clear in the evening, then mostly cloudy. Low of -13C. Breezy. Winds from the WSW at 15 to 20 km/h.]]></fcttext_metric>
<pop>0</pop>
</forecastday>
<forecastday>
<period>4</period>
<icon>mostlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/mostlycloudy.gif</icon_url>
<title>Monday</title>
<fcttext><![CDATA[Overcast. High of 19F with a windchill as low as 1F. Breezy. Winds from the West at 15 to 20 mph.]]></fcttext>
<fcttext_metric><![CDATA[Overcast. High of -7C with a windchill as low as -17C. Windy. Winds from the West at 25 to 30 km/h.]]></fcttext_metric>
<pop>0</pop>
</forecastday>
<forecastday>
<period>5</period>
<icon>partlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/partlycloudy.gif</icon_url>
<title>Monday Night</title>
<fcttext><![CDATA[Partly cloudy. Low of 9F with a windchill as low as -2F. Winds from the West at 10 to 15 mph.]]></fcttext>
<fcttext_metric><![CDATA[Partly cloudy. Low of -13C with a windchill as low as -19C. Breezy. Winds from the West at 15 to 20 km/h.]]></fcttext_metric>
<pop>0</pop>
</forecastday>
<forecastday>
<period>6</period>
<icon>partlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/partlycloudy.gif</icon_url>
<title>Tuesday</title>
<fcttext><![CDATA[Partly cloudy in the morning, then overcast. High of 18F with a windchill as low as 0F. Winds from the West at 10 to 15 mph.]]></fcttext>
<fcttext_metric><![CDATA[Partly cloudy in the morning, then overcast. High of -8C with a windchill as low as -18C. Breezy. Winds from the West at 15 to 25 km/h.]]></fcttext_metric>
<pop>0</pop>
</forecastday>
<forecastday>
<period>7</period>
<icon>mostlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/mostlycloudy.gif</icon_url>
<title>Tuesday Night</title>
<fcttext><![CDATA[Mostly cloudy in the evening, then overcast. Low of 7F. Winds less than 5 mph.]]></fcttext>
<fcttext_metric><![CDATA[Mostly cloudy in the evening, then overcast. Low of -14C. Winds less than 5 km/h.]]></fcttext_metric>
<pop>0</pop>
</forecastday>
</forecastdays>
</txt_forecast>
<simpleforecast>
<forecastdays>
<forecastday>
<date>
<epoch>1393124400</epoch>
<pretty_short>10:00 PM EST</pretty_short>
<pretty>10:00 PM EST on February 22, 2014</pretty>
<day>22</day>
<month>2</month>
<year>2014</year>
<yday>52</yday>
<hour>22</hour>
<min>00</min>
<sec>0</sec>
<isdst>0</isdst>
<monthname>February</monthname>
<monthname_short>Feb</monthname_short>
<weekday_short>Sat</weekday_short>
<weekday>Saturday</weekday>
<ampm>PM</ampm>
<tz_short>EST</tz_short>
<tz_long>America/Montreal</tz_long>
</date>
<period>1</period>
<high>
<fahrenheit>39</fahrenheit>
<celsius>4</celsius>
</high>
<low>
<fahrenheit>21</fahrenheit>
<celsius>-6</celsius>
</low>
<conditions>Partly Cloudy</conditions>
<icon>partlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/partlycloudy.gif</icon_url>
<skyicon>mostlysunny</skyicon>
<pop>0</pop>
<qpf_allday>
<in>0.00</in>
<mm>0.0</mm>
</qpf_allday>
<qpf_day>
<in>0.00</in>
<mm>0.0</mm>
</qpf_day>
<qpf_night>
<in>0.00</in>
<mm>0.0</mm>
</qpf_night>
<snow_allday>
<in>0</in>
<cm>0</cm>
</snow_allday>
<snow_day>
<in>0</in>
<cm>0</cm>
</snow_day>
<snow_night>
<in>0</in>
<cm>0</cm>
</snow_night>
<maxwind>
<mph>18</mph>
<kph>29</kph>
<dir>WSW</dir>
<degrees>241</degrees>
</maxwind>
<avewind>
<mph>14</mph>
<kph>22</kph>
<dir>SW</dir>
<degrees>235</degrees>
</avewind>
<avehumidity>65</avehumidity>
<maxhumidity>87</maxhumidity>
<minhumidity>61</minhumidity>
</forecastday>
<forecastday>
<date>
<epoch>1393210800</epoch>
<pretty_short>10:00 PM EST</pretty_short>
<pretty>10:00 PM EST on February 23, 2014</pretty>
<day>23</day>
<month>2</month>
<year>2014</year>
<yday>53</yday>
<hour>22</hour>
<min>00</min>
<sec>0</sec>
<isdst>0</isdst>
<monthname>February</monthname>
<monthname_short>Feb</monthname_short>
<weekday_short>Sun</weekday_short>
<weekday>Sunday</weekday>
<ampm>PM</ampm>
<tz_short>EST</tz_short>
<tz_long>America/Montreal</tz_long>
</date>
<period>2</period>
<high>
<fahrenheit>32</fahrenheit>
<celsius>0</celsius>
</high>
<low>
<fahrenheit>9</fahrenheit>
<celsius>-13</celsius>
</low>
<conditions>Partly Cloudy</conditions>
<icon>partlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/partlycloudy.gif</icon_url>
<skyicon>partlycloudy</skyicon>
<pop>0</pop>
<qpf_allday>
<in>0.00</in>
<mm>0.0</mm>
</qpf_allday>
<qpf_day>
<in>0.00</in>
<mm>0.0</mm>
</qpf_day>
<qpf_night>
<in>0.00</in>
<mm>0.0</mm>
</qpf_night>
<snow_allday>
<in>0</in>
<cm>0</cm>
</snow_allday>
<snow_day>
<in>0</in>
<cm>0</cm>
</snow_day>
<snow_night>
<in>0</in>
<cm>0</cm>
</snow_night>
<maxwind>
<mph>17</mph>
<kph>27</kph>
<dir>WSW</dir>
<degrees>249</degrees>
</maxwind>
<avewind>
<mph>12</mph>
<kph>19</kph>
<dir>WSW</dir>
<degrees>245</degrees>
</avewind>
<avehumidity>72</avehumidity>
<maxhumidity>76</maxhumidity>
<minhumidity>63</minhumidity>
</forecastday>
<forecastday>
<date>
<epoch>1393297200</epoch>
<pretty_short>10:00 PM EST</pretty_short>
<pretty>10:00 PM EST on February 24, 2014</pretty>
<day>24</day>
<month>2</month>
<year>2014</year>
<yday>54</yday>
<hour>22</hour>
<min>00</min>
<sec>0</sec>
<isdst>0</isdst>
<monthname>February</monthname>
<monthname_short>Feb</monthname_short>
<weekday_short>Mon</weekday_short>
<weekday>Monday</weekday>
<ampm>PM</ampm>
<tz_short>EST</tz_short>
<tz_long>America/Montreal</tz_long>
</date>
<period>3</period>
<high>
<fahrenheit>19</fahrenheit>
<celsius>-7</celsius>
</high>
<low>
<fahrenheit>9</fahrenheit>
<celsius>-13</celsius>
</low>
<conditions>Mostly Cloudy</conditions>
<icon>mostlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/mostlycloudy.gif</icon_url>
<skyicon>mostlycloudy</skyicon>
<pop>0</pop>
<qpf_allday>
<in>0.00</in>
<mm>0.0</mm>
</qpf_allday>
<qpf_day>
<in>0.00</in>
<mm>0.0</mm>
</qpf_day>
<qpf_night>
<in>0.00</in>
<mm>0.0</mm>
</qpf_night>
<snow_allday>
<in>0</in>
<cm>0</cm>
</snow_allday>
<snow_day>
<in>0</in>
<cm>0</cm>
</snow_day>
<snow_night>
<in>0</in>
<cm>0</cm>
</snow_night>
<maxwind>
<mph>18</mph>
<kph>29</kph>
<dir>West</dir>
<degrees>270</degrees>
</maxwind>
<avewind>
<mph>14</mph>
<kph>22</kph>
<dir>West</dir>
<degrees>265</degrees>
</avewind>
<avehumidity>70</avehumidity>
<maxhumidity>86</maxhumidity>
<minhumidity>63</minhumidity>
</forecastday>
<forecastday>
<date>
<epoch>1393383600</epoch>
<pretty_short>10:00 PM EST</pretty_short>
<pretty>10:00 PM EST on February 25, 2014</pretty>
<day>25</day>
<month>2</month>
<year>2014</year>
<yday>55</yday>
<hour>22</hour>
<min>00</min>
<sec>0</sec>
<isdst>0</isdst>
<monthname>February</monthname>
<monthname_short>Feb</monthname_short>
<weekday_short>Tue</weekday_short>
<weekday>Tuesday</weekday>
<ampm>PM</ampm>
<tz_short>EST</tz_short>
<tz_long>America/Montreal</tz_long>
</date>
<period>4</period>
<high>
<fahrenheit>18</fahrenheit>
<celsius>-8</celsius>
</high>
<low>
<fahrenheit>7</fahrenheit>
<celsius>-14</celsius>
</low>
<conditions>Partly Cloudy</conditions>
<icon>partlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/partlycloudy.gif</icon_url>
<skyicon>partlycloudy</skyicon>
<pop>0</pop>
<qpf_allday>
<in>0.01</in>
<mm>0.3</mm>
</qpf_allday>
<qpf_day>
<in>0.01</in>
<mm>0.3</mm>
</qpf_day>
<qpf_night>
<in>0.00</in>
<mm>0.0</mm>
</qpf_night>
<snow_allday>
<in>0</in>
<cm>1</cm>
</snow_allday>
<snow_day>
<in>0</in>
<cm>1</cm>
</snow_day>
<snow_night>
<in>0</in>
<cm>0</cm>
</snow_night>
<maxwind>
<mph>14</mph>
<kph>22</kph>
<dir>West</dir>
<degrees>271</degrees>
</maxwind>
<avewind>
<mph>9</mph>
<kph>14</kph>
<dir>West</dir>
<degrees>263</degrees>
</avewind>
<avehumidity>68</avehumidity>
<maxhumidity>76</maxhumidity>
<minhumidity>61</minhumidity>
</forecastday>
</forecastdays>
</simpleforecast>
</forecast>
</response>
Here is my XML for reference. Mine has those same blanks in it, so that is not the issue. I have to run now, but with these two files I'll be able to look later (I just did a cut/paste)
<response>
<version>0.1</version>
<termsofService>http://www.wunderground.com/weather/api/d/terms.html</termsofService>
<features>
<feature>forecast</feature>
</features>
<forecast>
<txt_forecast>
<date>9:00 AM CST</date>
<forecastdays>
<forecastday>
<period>0</period>
<icon>partlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/partlycloudy.gif</icon_url>
<title>Saturday</title>
<fcttext><![CDATA[Partly cloudy. High of 75F. Breezy. Winds from the South at 10 to 20 mph.]]></fcttext>
<fcttext_metric><![CDATA[Partly cloudy. High of 24C. Windy. Winds from the South at 15 to 30 km/h.]]></fcttext_metric>
<pop>0</pop>
</forecastday>
<forecastday>
<period>1</period>
<icon>partlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/partlycloudy.gif</icon_url>
<title>Saturday Night</title>
<fcttext><![CDATA[Partly cloudy. Fog overnight. Low of 57F. Winds from the South at 5 to 15 mph.]]></fcttext>
<fcttext_metric><![CDATA[Partly cloudy. Fog overnight. Low of 14C. Breezy. Winds from the South at 10 to 20 km/h.]]></fcttext_metric>
<pop>10</pop>
</forecastday>
<forecastday>
<period>2</period>
<icon>mostlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/mostlycloudy.gif</icon_url>
<title>Sunday</title>
<fcttext><![CDATA[Mostly cloudy. Fog early. High of 66F. Winds from the SSW at 5 to 10 mph shifting to the NNW in the afternoon.]]></fcttext>
<fcttext_metric><![CDATA[Mostly cloudy. Fog early. High of 19C. Winds from the SSW at 10 to 15 km/h shifting to the NNW in the afternoon.]]></fcttext_metric>
<pop>10</pop>
</forecastday>
<forecastday>
<period>3</period>
<icon>mostlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/mostlycloudy.gif</icon_url>
<title>Sunday Night</title>
<fcttext><![CDATA[Mostly cloudy. Low of 46F. Winds from the NE at 10 to 15 mph.]]></fcttext>
<fcttext_metric><![CDATA[Mostly cloudy. Low of 8C. Breezy. Winds from the NE at 20 to 25 km/h.]]></fcttext_metric>
<pop>20</pop>
</forecastday>
<forecastday>
<period>4</period>
<icon>mostlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/mostlycloudy.gif</icon_url>
<title>Monday</title>
<fcttext><![CDATA[Mostly cloudy with rain showers. High of 61F. Winds from the East at 5 to 10 mph. Chance of rain 20%.]]></fcttext>
<fcttext_metric><![CDATA[Mostly cloudy with rain showers. High of 16C. Winds from the East at 10 to 15 km/h.]]></fcttext_metric>
<pop>20</pop>
</forecastday>
<forecastday>
<period>5</period>
<icon>chancetstorms</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/chancetstorms.gif</icon_url>
<title>Monday Night</title>
<fcttext><![CDATA[Mostly cloudy with a chance of rain, then a chance of a thunderstorm and rain after midnight. Low of 54F. Winds from the ESE at 5 to 10 mph. Chance of rain 40%.]]></fcttext>
<fcttext_metric><![CDATA[Mostly cloudy with a chance of rain, then a chance of a thunderstorm and rain after midnight. Low of 12C. Winds from the ESE at 10 to 15 km/h. Chance of rain 40%.]]></fcttext_metric>
<pop>40</pop>
</forecastday>
<forecastday>
<period>6</period>
<icon>chancerain</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/chancerain.gif</icon_url>
<title>Tuesday</title>
<fcttext><![CDATA[Overcast with a chance of rain. High of 57F. Breezy. Winds from the NE at 10 to 20 mph. Chance of rain 50%.]]></fcttext>
<fcttext_metric><![CDATA[Overcast with a chance of rain. High of 14C. Breezy. Winds from the NE at 15 to 30 km/h. Chance of rain 50%.]]></fcttext_metric>
<pop>50</pop>
</forecastday>
<forecastday>
<period>7</period>
<icon>mostlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/mostlycloudy.gif</icon_url>
<title>Tuesday Night</title>
<fcttext><![CDATA[Overcast with a chance of rain. Low of 30F. Breezy. Winds from the NNE at 15 to 20 mph.]]></fcttext>
<fcttext_metric><![CDATA[Overcast with a chance of rain. Low of -1C. Windy. Winds from the NNE at 20 to 35 km/h.]]></fcttext_metric>
<pop>0</pop>
</forecastday>
</forecastdays>
</txt_forecast>
<simpleforecast>
<forecastdays>
<forecastday>
<date>
<epoch>1393124400</epoch>
<pretty_short>9:00 PM CST</pretty_short>
<pretty>9:00 PM CST on February 22, 2014</pretty>
<day>22</day>
<month>2</month>
<year>2014</year>
<yday>52</yday>
<hour>21</hour>
<min>00</min>
<sec>0</sec>
<isdst>0</isdst>
<monthname>February</monthname>
<monthname_short>Feb</monthname_short>
<weekday_short>Sat</weekday_short>
<weekday>Saturday</weekday>
<ampm>PM</ampm>
<tz_short>CST</tz_short>
<tz_long>America/Chicago</tz_long>
</date>
<period>1</period>
<high>
<fahrenheit>75</fahrenheit>
<celsius>24</celsius>
</high>
<low>
<fahrenheit>57</fahrenheit>
<celsius>14</celsius>
</low>
<conditions>Partly Cloudy</conditions>
<icon>partlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/partlycloudy.gif</icon_url>
<skyicon>partlycloudy</skyicon>
<pop>0</pop>
<qpf_allday>
<in>0.00</in>
<mm>0.0</mm>
</qpf_allday>
<qpf_day>
<in>0.00</in>
<mm>0.0</mm>
</qpf_day>
<qpf_night>
<in>0.00</in>
<mm>0.0</mm>
</qpf_night>
<snow_allday>
<in>0</in>
<cm>0</cm>
</snow_allday>
<snow_day>
<in>0</in>
<cm>0</cm>
</snow_day>
<snow_night>
<in>0</in>
<cm>0</cm>
</snow_night>
<maxwind>
<mph>16</mph>
<kph>26</kph>
<dir>South</dir>
<degrees>189</degrees>
</maxwind>
<avewind>
<mph>12</mph>
<kph>19</kph>
<dir>South</dir>
<degrees>182</degrees>
</avewind>
<avehumidity>51</avehumidity>
<maxhumidity>61</maxhumidity>
<minhumidity>34</minhumidity>
</forecastday>
<forecastday>
<date>
<epoch>1393210800</epoch>
<pretty_short>9:00 PM CST</pretty_short>
<pretty>9:00 PM CST on February 23, 2014</pretty>
<day>23</day>
<month>2</month>
<year>2014</year>
<yday>53</yday>
<hour>21</hour>
<min>00</min>
<sec>0</sec>
<isdst>0</isdst>
<monthname>February</monthname>
<monthname_short>Feb</monthname_short>
<weekday_short>Sun</weekday_short>
<weekday>Sunday</weekday>
<ampm>PM</ampm>
<tz_short>CST</tz_short>
<tz_long>America/Chicago</tz_long>
</date>
<period>2</period>
<high>
<fahrenheit>66</fahrenheit>
<celsius>19</celsius>
</high>
<low>
<fahrenheit>46</fahrenheit>
<celsius>8</celsius>
</low>
<conditions>Fog</conditions>
<icon>mostlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/mostlycloudy.gif</icon_url>
<skyicon>mostlycloudy</skyicon>
<pop>10</pop>
<qpf_allday>
<in>0.00</in>
<mm>0.0</mm>
</qpf_allday>
<qpf_day>
<in>0.00</in>
<mm>0.0</mm>
</qpf_day>
<qpf_night>
<in>0.00</in>
<mm>0.0</mm>
</qpf_night>
<snow_allday>
<in>0</in>
<cm>0</cm>
</snow_allday>
<snow_day>
<in>0</in>
<cm>0</cm>
</snow_day>
<snow_night>
<in>0</in>
<cm>0</cm>
</snow_night>
<maxwind>
<mph>13</mph>
<kph>21</kph>
<dir>NNE</dir>
<degrees>29</degrees>
</maxwind>
<avewind>
<mph>10</mph>
<kph>16</kph>
<dir>East</dir>
<degrees>80</degrees>
</avewind>
<avehumidity>58</avehumidity>
<maxhumidity>85</maxhumidity>
<minhumidity>50</minhumidity>
</forecastday>
<forecastday>
<date>
<epoch>1393297200</epoch>
<pretty_short>9:00 PM CST</pretty_short>
<pretty>9:00 PM CST on February 24, 2014</pretty>
<day>24</day>
<month>2</month>
<year>2014</year>
<yday>54</yday>
<hour>21</hour>
<min>00</min>
<sec>0</sec>
<isdst>0</isdst>
<monthname>February</monthname>
<monthname_short>Feb</monthname_short>
<weekday_short>Mon</weekday_short>
<weekday>Monday</weekday>
<ampm>PM</ampm>
<tz_short>CST</tz_short>
<tz_long>America/Chicago</tz_long>
</date>
<period>3</period>
<high>
<fahrenheit>61</fahrenheit>
<celsius>16</celsius>
</high>
<low>
<fahrenheit>54</fahrenheit>
<celsius>12</celsius>
</low>
<conditions>Rain Showers</conditions>
<icon>mostlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/mostlycloudy.gif</icon_url>
<skyicon>mostlycloudy</skyicon>
<pop>20</pop>
<qpf_allday>
<in>0.01</in>
<mm>0.3</mm>
</qpf_allday>
<qpf_day>
<in>0.00</in>
<mm>0.0</mm>
</qpf_day>
<qpf_night>
<in>0.08</in>
<mm>2.0</mm>
</qpf_night>
<snow_allday>
<in>0</in>
<cm>0</cm>
</snow_allday>
<snow_day>
<in>0</in>
<cm>0</cm>
</snow_day>
<snow_night>
<in>0</in>
<cm>0</cm>
</snow_night>
<maxwind>
<mph>9</mph>
<kph>14</kph>
<dir>ENE</dir>
<degrees>70</degrees>
</maxwind>
<avewind>
<mph>6</mph>
<kph>10</kph>
<dir>ESE</dir>
<degrees>116</degrees>
</avewind>
<avehumidity>68</avehumidity>
<maxhumidity>82</maxhumidity>
<minhumidity>63</minhumidity>
</forecastday>
<forecastday>
<date>
<epoch>1393383600</epoch>
<pretty_short>9:00 PM CST</pretty_short>
<pretty>9:00 PM CST on February 25, 2014</pretty>
<day>25</day>
<month>2</month>
<year>2014</year>
<yday>55</yday>
<hour>21</hour>
<min>00</min>
<sec>0</sec>
<isdst>0</isdst>
<monthname>February</monthname>
<monthname_short>Feb</monthname_short>
<weekday_short>Tue</weekday_short>
<weekday>Tuesday</weekday>
<ampm>PM</ampm>
<tz_short>CST</tz_short>
<tz_long>America/Chicago</tz_long>
</date>
<period>4</period>
<high>
<fahrenheit>57</fahrenheit>
<celsius>14</celsius>
</high>
<low>
<fahrenheit>30</fahrenheit>
<celsius>-1</celsius>
</low>
<conditions>Chance of Rain</conditions>
<icon>chancerain</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/chancerain.gif</icon_url>
<skyicon>mostlycloudy</skyicon>
<pop>50</pop>
<qpf_allday>
<in>0.17</in>
<mm>4.3</mm>
</qpf_allday>
<qpf_day>
<in>0.09</in>
<mm>2.3</mm>
</qpf_day>
<qpf_night>
<in>0.01</in>
<mm>0.3</mm>
</qpf_night>
<snow_allday>
<in>0</in>
<cm>0</cm>
</snow_allday>
<snow_day>
<in>0</in>
<cm>0</cm>
</snow_day>
<snow_night>
<in>0</in>
<cm>0</cm>
</snow_night>
<maxwind>
<mph>19</mph>
<kph>30</kph>
<dir>NNE</dir>
<degrees>21</degrees>
</maxwind>
<avewind>
<mph>17</mph>
<kph>27</kph>
<dir>NNE</dir>
<degrees>27</degrees>
</avewind>
<avehumidity>64</avehumidity>
<maxhumidity>79</maxhumidity>
<minhumidity>58</minhumidity>
</forecastday>
</forecastdays>
</simpleforecast>
</forecast>
</response>
I can't explain it. If I substitute your location for my own ZIP code in the config file, it works.
I even tried Celsius to see if that was the problem.
When I visit http://tingliang-photo.com/thermo2/get_instant_forecast.php I get a response with zero bytes.
In your config.php are these flag set TRUE?
$weatherConfig = array(
'useWeather' => TRUE, // TRUE, FALSE (Flag to use external temperature for all stats)
'useForecast' => TRUE, // TRUE, FALSE (Flag to show forecast on dashboard))
Specifically the useForecast flag. Sorry, grasping at straws here.
He had an outside temp. Perhaps they don't do forecasts for his zip code. I've seen different features for those weather stations outputting different XML data. My neighbor has a weather station that gives me all kinds of data if I want the exact info across the street. But his station don't do forecasts of I remember correctly. I had to switch stations before I could get the forecasts. On Feb 23, 2014 1:32 AM, "ThermoMan" notifications@github.com wrote:
When I visit http://tingliang-photo.com/thermo2/get_instant_forecast.php I get a response with zero bytes.
In your config.php is this flag set TRUE?
$weatherConfig = array( 'useWeather' => TRUE, // TRUE, FALSE (Flag to use external temperature for all stats)
Reply to this email directly or view it on GitHubhttps://github.com/ThermoMan/Thermostat-Tracking/issues/40#issuecomment-35825795 .
The XML is the same - it even works for me when I use his ZIP. The only guess I can make is that the useForecast flag is set to FALSE. But even that guess is wild.
The two flag are set to True, i'm currently using the latest codes, but still the same. (API works fine.) http://tingliang-photo.com/thermo4/thermo.php
I have made up a debug version of a couple of files that will add logging statements as the code in the library and the top level function step through. Pull these out and put them in. get_instant_forecast.php (in the application root directory) ExternalWeather.php (in the lib directory)
After loading them, hit up the web page and then post the tail end of the log. It will look something like this.
2014-02-25 13:03:23 - INFO --> get_instant_status: start
2014-02-25 13:03:23 - INFO --> get_instant_forecast: start
2014-02-25 13:03:23 - DEBUG --> get_instant_forecast: Execution path start
2014-02-25 13:03:23 - INFO --> get_instant_status: Connecting to Thermostat ID = (1) uuid = (5cdad4276ec5) ip = (127.0.0.1) name = (Home)
2014-02-25 13:03:23 - DEBUG --> get_instant_forecast: Execution path inside the IF
2014-02-25 13:03:23 - DEBUG --> get_instant_forecast: Execution path inside the first TRY
2014-02-25 13:03:23 - DEBUG --> get_instant_forecast: Execution path inside the FOREACH
2014-02-25 13:03:23 - DEBUG --> get_instant_forecast: Execution path inside the second TRY
2014-02-25 13:03:23 - DEBUG --> get_instant_forecast: Execution path inside the second IF
2014-02-25 13:03:23 - DEBUG --> ExternalWeather: getOutdoorForcast: Execution path start
2014-02-25 13:03:23 - DEBUG --> ExternalWeather: getOutdoorForcast: Execution path config says your type is weatherunderground
2014-02-25 13:03:23 - DEBUG --> ExternalWeather: getOutdoorForcast: Execution path config says Yaaay, weatherunderground.
2014-02-25 13:03:23 - DEBUG --> ExternalWeather: getOutdoorForcast: Execution path config says using DEFAULT location.
2014-02-25 13:03:23 - DEBUG --> ExternalWeather: getOutdoorForcast: Execution path inside FOREACH number 1.
2014-02-25 13:03:23 - DEBUG --> ExternalWeather: getOutdoorForcast: Execution path inside FOREACH number 2.
2014-02-25 13:03:23 - DEBUG --> ExternalWeather: getOutdoorForcast: Execution path inside FOREACH number 2.
2014-02-25 13:03:23 - DEBUG --> ExternalWeather: getOutdoorForcast: Execution path inside FOREACH number 2.
2014-02-25 13:03:23 - DEBUG --> ExternalWeather: getOutdoorForcast: Execution path inside FOREACH number 2.
2014-02-25 13:03:23 - DEBUG --> ExternalWeather: getOutdoorForcast: Execution path all done.
2014-02-25 13:03:23 - DEBUG --> get_instant_forecast: Execution path the forecastData is >>>Array<<<
2014-02-25 13:03:23 - DEBUG --> get_instant_forecast: Execution path inside the third IF
2014-02-25 13:03:23 - DEBUG --> get_instant_forecast: Execution path after first EXECPTION
2014-02-25 13:03:23 - DEBUG --> get_instant_forecast: Execution path after second EXECPTION
2014-02-25 13:03:23 - DEBUG --> get_instant_forecast: Execution path about to ECHO
2014-02-25 13:03:23 - INFO --> get_instant_forecast: execution time was 0.38889288902283 seconds.
Looking at your log file I can see that some of your code has older versions, it is showing messages that have been removed. Specifically the scripts and lib directories. But since those seem to be working, don't update them without keeping a backup copy.
2014-02-26 5:35:59 - INFO --> get_instant_forecast: start 2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path start 2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path inside the IF 2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path inside the first TRY 2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path inside the FOREACH 2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path inside the second TRY 2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path inside the second IF 2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path the forecastData is >>>Array<<< 2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path inside the third IF 2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path after first EXECPTION 2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path inside the FOREACH 2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path inside the second TRY 2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path after first EXECPTION 2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path inside the FOREACH 2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path inside the second TRY 2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path after first EXECPTION 2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path after second EXECPTION 2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path about to ECHO 2014-02-26 5:35:59 - INFO --> get_instant_forecast: execution time was 0.16476798057556 seconds. 2014-02-26 5:36:03 - INFO --> get_instant_forecast: start 2014-02-26 5:36:03 - DEBUG --> get_instant_forecast: Execution path start 2014-02-26 5:36:03 - DEBUG --> get_instant_forecast: Execution path inside the IF 2014-02-26 5:36:03 - DEBUG --> get_instant_forecast: Execution path inside the first TRY 2014-02-26 5:36:03 - DEBUG --> get_instant_forecast: Execution path inside the FOREACH 2014-02-26 5:36:03 - DEBUG --> get_instant_forecast: Execution path inside the second TRY 2014-02-26 5:36:03 - DEBUG --> get_instant_forecast: Execution path inside the second IF 2014-02-26 5:36:04 - DEBUG --> get_instant_forecast: Execution path the forecastData is >>>Array<<< 2014-02-26 5:36:04 - DEBUG --> get_instant_forecast: Execution path inside the third IF 2014-02-26 5:36:04 - DEBUG --> get_instant_forecast: Execution path after first EXECPTION 2014-02-26 5:36:04 - DEBUG --> get_instant_forecast: Execution path inside the FOREACH 2014-02-26 5:36:04 - DEBUG --> get_instant_forecast: Execution path inside the second TRY 2014-02-26 5:36:04 - DEBUG --> get_instant_forecast: Execution path after first EXECPTION 2014-02-26 5:36:04 - DEBUG --> get_instant_forecast: Execution path inside the FOREACH 2014-02-26 5:36:04 - DEBUG --> get_instant_forecast: Execution path inside the second TRY 2014-02-26 5:36:04 - DEBUG --> get_instant_forecast: Execution path after first EXECPTION 2014-02-26 5:36:04 - DEBUG --> get_instant_forecast: Execution path after second EXECPTION 2014-02-26 5:36:04 - DEBUG --> get_instant_forecast: Execution path about to ECHO 2014-02-26 5:36:04 - INFO --> get_instant_forecast: execution time was 0.20669317245483 seconds. 2014-02-26 5:36:08 - INFO --> get_instant_status: start 2014-02-26 5:36:08 - INFO --> get_instant_forecast: start 2014-02-26 5:36:08 - DEBUG --> get_instant_forecast: Execution path start 2014-02-26 5:36:08 - DEBUG --> get_instant_forecast: Execution path inside the IF 2014-02-26 5:36:08 - DEBUG --> get_instant_forecast: Execution path inside the first TRY 2014-02-26 5:36:08 - DEBUG --> get_instant_forecast: Execution path inside the FOREACH 2014-02-26 5:36:08 - DEBUG --> get_instant_forecast: Execution path inside the second TRY 2014-02-26 5:36:08 - DEBUG --> get_instant_forecast: Execution path inside the second IF 2014-02-26 5:36:08 - INFO --> get_instant_status: Connecting to Thermostat ID = (1) uuid = (88308a97f21a) ip = (tingweil.asuscomm.com:2001) name = (Zone 1 Downtairs) 2014-02-26 5:36:09 - DEBUG --> get_instant_forecast: Execution path the forecastData is >>>Array<<< 2014-02-26 5:36:09 - DEBUG --> get_instant_forecast: Execution path inside the third IF 2014-02-26 5:36:09 - DEBUG --> get_instant_forecast: Execution path after first EXECPTION 2014-02-26 5:36:09 - DEBUG --> get_instant_forecast: Execution path inside the FOREACH 2014-02-26 5:36:09 - DEBUG --> get_instant_forecast: Execution path inside the second TRY 2014-02-26 5:36:09 - DEBUG --> get_instant_forecast: Execution path after first EXECPTION 2014-02-26 5:36:09 - DEBUG --> get_instant_forecast: Execution path inside the FOREACH 2014-02-26 5:36:09 - DEBUG --> get_instant_forecast: Execution path inside the second TRY 2014-02-26 5:36:09 - DEBUG --> get_instant_forecast: Execution path after first EXECPTION 2014-02-26 5:36:09 - DEBUG --> get_instant_forecast: Execution path after second EXECPTION 2014-02-26 5:36:09 - DEBUG --> get_instant_forecast: Execution path about to ECHO 2014-02-26 5:36:09 - INFO --> get_instant_forecast: execution time was 0.66998600959778 seconds. 2014-02-26 5:36:09 - INFO --> draw_daily.php: execution time was 0.54202699661255 seconds. 2014-02-26 5:36:12 - INFO --> get_instant_status: Outside Weather for J5R2X8: Temp 11.7 Humidity 59 2014-02-26 5:36:16 - INFO --> get_instant_status: Connecting to Thermostat ID = (2) uuid = (88308a278e3d) ip = (tingweil.asuscomm.com:2002) name = (Zone 2 Upstairs) 2014-02-26 5:36:23 - INFO --> get_instant_status: Connecting to Thermostat ID = (3) uuid = (88308a278f6c) ip = (tingweil.asuscomm.com:2003) name = (Zone 3 LivingRoom) 2014-02-26 5:36:26 - INFO --> get_instant_status: execution time was 17.824627161026 seconds.
Thanks! I'll poke through that and figure out the execution path it's taking to learn why the result is empty. The first thing I see is that it runs three times. It really ought to only go once because the location is the same, so my logic for seeing changes is NOT working.
OK, I see from the logs that the forecast was called three different times and that the logic internal to each one did block a repetition. The line in in the log that says
2014-02-26 5:35:59 - DEBUG --> get_instant_forecast: Execution path the forecastData is >>>Array<<<
shows that some data DID return from the weather web site.
Of note: I think you missed the updated ExternalWeather.php file - it also had log statements added to it - although since an Array was returned, I don't think that the problem is in the low level stuff.
I updated the get_instant_forecast.php with some more logging.
Thanks for your patience!
both php are updated. and here the logs: http://tingliang-photo.com/thermo4/logs/log_2014-02-27.txt
OK, that is a very informative log. Will have to do some serious noodling though as two parts of it are in apparent conflict (which means I'm going to learn something about PHP today I think)
This piece of the shows that it's working
2014-02-27 4:12:11 - DEBUG --> get_instant_forecast: Execution path the forecastData is >>>Array<<<
2014-02-27 4:12:11 - DEBUG --> get_instant_forecast: Execution path inside the third IF
2014-02-27 4:12:11 - DEBUG --> get_instant_forecast: Execution path found a day >>>Thursday<<<
2014-02-27 4:12:11 - DEBUG --> get_instant_forecast: Execution path found a day >>>Friday<<<
2014-02-27 4:12:11 - DEBUG --> get_instant_forecast: Execution path found a day >>>Saturday<<<
2014-02-27 4:12:11 - DEBUG --> get_instant_forecast: Execution path found a day >>>Sunday<<<
and that it has returned from low level communication WITH data intact. (I'll remove my changes to the log file from the low level communication library)
But this line in the log proves that it has lost all the data it was accumulating
2014-02-27 4:12:11 - DEBUG --> get_instant_forecast: Execution path about to ECHO >>><<<
There should have been some text between the >>> and <<<
Aha! Found it.
Because you have three thermostats, the code is presently resetting the reply to blank, but then seeing that the same location is used for all three, it does not repopulate the reply - so the reply is blank.
The quick solution for you is to comment out line 26
//$returnString = '';
In the meantime I'll work up better solution.
On a related note, once this is all done you should re-block web access to your log files. Also, trying this link http://tingliang-photo.com/thermo5/thermo.php#dashboard (note the "5" ) brings up a thing I'd never seen before on a web page. While an extraordinarily helpful feature I think privacy is more important. Perhaps the info on this page might help? https://forum.linode.com/viewtopic.php?t=5479%3E
cool! its working! you are genius to find out that "backdoor", i will check what i can do with the web hosting.
I downloaded the new update scripts and whole package today. but it gives me error when running scripts for updates_temps.php:
2014-03-03 16:35:34 - INFO --> temps: Start. 2014-03-03 16:35:34 - ERROR --> temps: required argument missing. Must send unix timestamp!
http://tingliang-photo.com/thermo5/logs/log_2014-03-03.txt
i haven't update the new scripts since January, do i miss anything to able to run the new update scripts?
There was a new ksh that came with it....
Ooooh, you're on DOS. I forgot about that. Hmm, OK, thinking.
The two lines "NOW= " and "NOW_CHANGED=" are the new things. They solve a problem where the two servers (web server and database server) might have out of sync clocks. I ran into that when my hosting service moved my webserver to a new machine.
#!/usr/bin/ksh
LOC=`dirname $0`
cd ${LOC}
. ../config.ksh
NOW=`date "+%Y-%m-%d %H:%M:%S"`
NOW_CHANGED=${NOW:0:15}"0:00"
/usr/local/bin/php ${LOC}/thermo_update_temps.php "${NOW_CHANGED}"
To get the same thing in DOS you need to edit the BAT file
cd C:\xampp\htdocs\thermo2\
C:\xampp\php\php C:\xampp\htdocs\thermo2\scripts\thermo_update_temps.php
With something like is suggested here http://stackoverflow.com/questions/301108/adding-to-time-variable-in-windows-cmd-script
I'd only be guessing if I put anything in there now. You can probably revert to the previous php file for now.
OK, try this. I'll check this code in. Let me know if it works please (I don't have a Windows setup I can test it on)
cd C:\xampp\htdocs\thermo2\
set NOW=%DATE% %TIME:~0,8%
set NOW_CHANGED=%NOW:~0,15%0:00
C:\xampp\php\php C:\xampp\htdocs\thermo2\scripts\thermo_update_temps.php "%NOW_CHANGED%"
Is this batch file update working for you?
nope, actually i put the program on a unix server. still get the error same as issue #56.
@tingweil Look at my latest response on #56. It should fix your issue too if you moved to unix server and don't have ksh.
If you don't have ksh and have instead just sh, you can change that top line to something like this.
#!/usr/bin/sh
Put in your appropriate path to your sh executable.
Hi, i'm very new... I can't install on my localhost, can some help me.. thanks in advance.
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1045] Access denied for user 'user'@'localhost' (using password: YES)' in C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\data\localweb\projects\thermo2\common.php:121 Stack trace: #0 C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\data\localweb\projects\thermo2\common.php(121): PDO->__construct('mysql:host=loca...', 'user', 'password')
1 C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\data\localweb\projects\thermo2\thermo.php(2): require_once('C:\Program File...')
2 {main} thrown in C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\data\localweb\projects\thermo2\common.php on line 121
EDIT: Removed the hash marks in front of numbers because that forces a link to an "issue number" --ThermoMan