IPSUtils_Include ("IPSWeatherForcastAT_Constants.inc.php",     "IPSLibrary::app::modules::Weather::IPSWeatherForcastAT");
	IPSUtils_Include ("IPSWeatherForcastAT_Configuration.inc.php", "IPSLibrary::config::modules::Weather::IPSWeatherForcastAT");
	IPSUtils_Include ("IPSWeatherForcastAT_Utils.inc.php",         "IPSLibrary::app::modules::Weather::IPSWeatherForcastAT");
	IPSUtils_Include ("IPSLogger.inc.php",                         "IPSLibrary::app::core::IPSLogger");

	if (Sys_Ping(IPSWEATHERFAT_EXTERNAL_IP, 100)) {
		IPSLogger_Trc(__file__, "Refresh Weather Data");
		
		$stationGoogle   = IPSWEATHERFAT_GOOGLE_PLACE."-".IPSWEATHERFAT_GOOGLE_COUNTRY;
		$urlGoogle       = "http://www.google.com/ig/api?weather=".$stationGoogle."&hl=".IPSWEATHERFAT_GOOGLE_LANG;
		$DaySourceArray  = array('Mo.','Di.','Mi.','Do.','Fr.','Sa.','So.');
		$DayDisplayArray = array('Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag','Sonntag');

		$api = simplexml_load_string(utf8_encode(@Sys_GetURLContent($urlGoogle)));
		echo $urlGoogle;

		IPSWeatherFAT_SetValue('LastRefreshDateTime', date("Y-m-j H:i:s"));
		IPSWeatherFAT_SetValue('LastRefreshTime', date("H:i"));

		// Aktuelles Wetter
		IPSWeatherFAT_SetValue('TodayForecastShort', (string)$api->weather->current_conditions->condition->attributes()->data);
		IPSWeatherFAT_SetValue('TodayTempCurrent',   (string)$api->weather->current_conditions->temp_c->attributes()->data);
		IPSWeatherFAT_SetValue('AirHumidity',        str_replace("Feuchtigkeit", "rel.Luftfeuchte", $api->weather->current_conditions->humidity->attributes()->data));
		IPSWeatherFAT_SetValue('Wind',               (string)$api->weather->current_conditions->wind_condition->attributes()->data);
		IPSWeatherFAT_SetValue('TodayIcon',          str_replace(".gif", ".png", str_replace(IPSWEATHERFAT_ICONS_GOOGLE1, IPSWEATHERFAT_ICONS_LARGE, $api->weather->current_conditions->icon->attributes()->data)));

		// Wettervorhersage heute, morgen, in zwei und in drei Tagen ($wetter[1] bis $wetter[4])
		$i = 1;
		foreach($api->weather->forecast_conditions as $weather)
Esempio n. 2
0
 private function SetCover()
 {
     $CoverID = @IPS_GetObjectIDByIdent('CoverIMG', $this->InstanceID);
     if ($CoverID === false) {
         $CoverID = IPS_CreateMedia(1);
         IPS_SetParent($CoverID, $this->InstanceID);
         IPS_SetIdent($CoverID, 'CoverIMG');
         IPS_SetName($CoverID, 'Cover');
         IPS_SetPosition($CoverID, 27);
         IPS_SetMediaCached($CoverID, true);
         IPS_SetMediaFile($CoverID, "media" . DIRECTORY_SEPARATOR . "Cover_" . $this->InstanceID . ".png", False);
     }
     $ParentID = $this->GetParent();
     if (!($ParentID === false)) {
         $Host = IPS_GetProperty($ParentID, 'Host') . ":" . IPS_GetProperty($ParentID, 'Webport');
         $Size = $this->ReadPropertyString("CoverSize");
         $PlayerID = rawurlencode($this->Address);
         $CoverRAW = @Sys_GetURLContent("http://" . $Host . "/music/current/" . $Size . ".png?player=" . $PlayerID);
         if (!($CoverRAW === false)) {
             IPS_SetMediaContent($CoverID, base64_encode($CoverRAW));
         }
     }
     return;
 }
Esempio n. 3
0
 private function FeaturePreCheck($feature)
 {
     $IP = $this->ReadPropertyString("Enigma2IP");
     $WebPort = $this->ReadPropertyInteger("Enigma2WebPort");
     if ($this->GetPowerState() != 0) {
         $url = "http://" . $IP . ":" . $WebPort . "/web/" . $feature;
         $check = @Sys_GetURLContent($url);
         if ($check === false) {
             return false;
         } else {
             return true;
         }
     }
 }