$WaterConfig = get_WateringConfiguration();

	// Wert von Bewässerungs Sensor ermitteln
	$SensorLimit = GetValue(get_ControlId(c_Control_Sensor, $CircleId));
	$SensorValue = false;
	if (array_key_exists(c_Property_Sensor, $WaterConfig[$CircleName])) {
		$SensorPath  = $WaterConfig[$CircleName][c_Property_Sensor];
		if ($SensorPath <> '') {
			$SensorId    = IPSUtil_ObjectIDByPath($SensorPath);
			if ($SensorId===false) {
			   IPSLogger_Wrn(__file__, "Specified Sensor '$SensorPath' could NOT be found");
			} else {
				$SensorValue = GetValue($SensorId);
			}
		}
	}

	if ($SensorValue===false and $SensorLimit>0) {
		IPSLogger_Err(__file__, "Rainfall Sensor NOT defined for Circle '$CircleName'");
		Exit;
	}

	// Bewässerung Starten
	if ($SensorLimit > 0 and $SensorValue!==false and $SensorLimit<=$SensorValue) {
		IPSWatering_LogNoActivationByRainfall($CircleId, $SensorLimit, $Rainfall);
		IPSWatering_CalcNextScheduleDateTime($CircleId);
	} else {
		IPSWatering_SetActive($ControlId, true, c_Mode_StartAutomatic);
	}

?>
Ejemplo n.º 2
0
	function IPSWatering_Refresh() {
		$categoryId_Circles = IPSUtil_ObjectIDByPath('Program.IPSLibrary.data.modules.IPSWatering.WaterCircles');
		$CircleIds          = IPS_GetChildrenIds($categoryId_Circles);
		foreach($CircleIds as $CircleId) {
			if (GetValue(get_ControlId(c_Control_Active, $CircleId))) {
				$Duration        = GetValue(get_ControlId(c_Control_Duration, $CircleId));
				$TimeCurrent     = time();
				$TimeStart       = get_DateTime(get_ControlId(c_Control_LastDate, $CircleId), c_Format_LastDate,
				                                get_ControlId(c_Control_LastTime, $CircleId), c_Format_LastTime);
				$TimeDiff        = $TimeCurrent-$TimeStart;
				$TimeDiffMinutes = floor($TimeDiff/60);
				$TimeDiffSeconds = $TimeDiff % 60;

				SetValue(get_ControlId(c_Control_ToBeDone, $CircleId),
				         GetValue(get_ControlId(c_Control_NextDisplay, $CircleId)).", $TimeDiffMinutes von $Duration Min ($TimeDiffSeconds Sek)");

				if ($TimeDiffMinutes >= $Duration) {
					IPSWatering_SetActive(get_ControlId(c_Control_Active, $CircleId),
												 false,
												 c_Mode_StartAutomatic);
				}
			}
		}
	}
	 * Version 2.50.1, 11.03.2012<br/>
	 *
	 * Script wird für das WebFront um Änderungen an den Variablen vorzunehmen
	 *
	 */

	include_once "IPSWatering.inc.php";

	if ($_IPS['SENDER']=='WebFront') {
		$ControlId   = $_IPS['VARIABLE'];
		$CircleId    = get_CirclyIdByControlId($ControlId);
		$ControlType = get_ControlType($ControlId);
	
		switch($ControlType) {
			case c_Control_Active:
				IPSWatering_SetActive($ControlId, $_IPS['VALUE'], c_Mode_StartManual);
				break;
			case c_Control_StartTime:
			case c_Control_Duration:
			case c_Control_Program:
			case c_Control_Sensor:
			case c_Control_Automatic:
				IPSWatering_SetValue($ControlId, $_IPS['VALUE']);
				break;
			default:
				IPSLogger_Err(__file__, "Error Unknown ControlType $ControlType");
				Exit;
	   }
	}

	/** @}*/