public function execute($_options = array()) { if ($this->getLogicalId() == 'refresh') { weather::cron30($this->getEqLogic_id()); } else { $eqLogic_weather = $this->getEqLogic(); $weather = $eqLogic_weather->getWeatherFromYahooXml(); if (!is_array($weather)) { sleep(1); $weather = $eqLogic_weather->getWeatherFromYahooXml(); if (!is_array($weather)) { return false; } } if ($this->getConfiguration('day') == -1) { if ($this->getConfiguration('data') == 'condition') { return $weather['condition']['text']; } if ($this->getConfiguration('data') == 'temp') { return $weather['condition']['temperature']; } if ($this->getConfiguration('data') == 'humidity') { return $weather['atmosphere']['humidity']; } if ($this->getConfiguration('data') == 'pressure') { return $weather['atmosphere']['pressure']; } if ($this->getConfiguration('data') == 'wind_speed') { return $weather['wind']['speed']; } if ($this->getConfiguration('data') == 'wind_direction') { return $weather['wind']['direction']; } if ($this->getConfiguration('data') == 'sunrise') { return $weather['astronomy']['sunrise']; } if ($this->getConfiguration('data') == 'sunset') { return $weather['astronomy']['sunset']; } } if ($this->getConfiguration('data') == 'condition') { return $weather['forecast'][$this->getConfiguration('day')]['condition']; } if ($this->getConfiguration('data') == 'low') { return $weather['forecast'][$this->getConfiguration('day')]['low_temperature']; } if ($this->getConfiguration('data') == 'high') { return $weather['forecast'][$this->getConfiguration('day')]['high_temperature']; } return false; } }