本文整理汇总了PHP中IPS_LogMessage函数的典型用法代码示例。如果您正苦于以下问题:PHP IPS_LogMessage函数的具体用法?PHP IPS_LogMessage怎么用?PHP IPS_LogMessage使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IPS_LogMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SendCommand
protected function SendCommand($address)
{
$address = $this->ReadPropertyString('Adresse');
IPS_LogMessage("Adresse:", $address);
IPS_LogMessage("Dooya Command:", $command);
$GatewayPassword = $this->GetPassword();
if ($GatewayPassword !== "") {
$gwcheck = file_get_contents("http://" . $this->GetIPGateway() . "/command?XC_USER=user&XC_PASS=" . $GatewayPassword . "&XC_FNC=SendSC&type=RT&data=" . $command . $address);
} else {
$gwcheck = file_get_contents("http://" . $this->GetIPGateway() . "/command?XC_FNC=SendSC&type=RT&data=" . $command . $address);
}
if ($gwcheck == "{XC_SUC}") {
$this->response = true;
} elseif ($gwcheck == "{XC_AUTH}") {
$this->response = false;
echo "Keine Authentifizierung möglich. Das Passwort für das Gateway ist falsch.";
}
return $this->response;
}
示例2: Log
/**
* Log Message
* @param string $Message
*/
protected function Log($Message)
{
if ($this->ReadPropertyBoolean("Log")) {
IPS_LogMessage(__CLASS__, $Message);
}
}
示例3: ProcessHookData
public function ProcessHookData()
{
if ($_IPS['SENDER'] == "Execute") {
echo "This script cannot be used this way.";
return;
}
if (!isset($_POST['deviceName']) || !isset($_POST['deviceType']) || !isset($_POST['deviceFamily'])) {
IPS_LogMessage("ips4WinDeviceRegistration", "Malformed data: " . print_r($_POST, true));
return;
}
$id = str_replace("-", "", utf8_decode($_POST['deviceName']) . utf8_decode($_POST['deviceId']));
$id = str_replace(" ", "", $id);
$deviceID = $this->CreateInstanceByIdent($this->InstanceID, $id, utf8_decode($_POST['deviceName']) . "-" . utf8_decode($_POST['deviceId']));
SetValue($this->CreateVariableByIdent($deviceID, "deviceName", "deviceName", 3), utf8_decode($_POST['deviceName']));
SetValue($this->CreateVariableByIdent($deviceID, "deviceType", "deviceType", 3), utf8_decode($_POST['deviceType']));
SetValue($this->CreateVariableByIdent($deviceID, "deviceId", "deviceId", 3), utf8_decode($_POST['deviceId']));
SetValue($this->CreateVariableByIdent($deviceID, "deviceFamily", "deviceFamily", 3), utf8_decode($_POST['deviceFamily']));
if (isset($_POST['SecChannel'])) {
SetValue($this->CreateVariableByIdent($deviceID, "SecChannelExp", "SecChannelExp", 1, "~UnixTimestamp"), intval(strtotime($_POST['SecChannelExp'])));
SetValue($this->CreateVariableByIdent($deviceID, "SecChannel", "SecChannel", 3), utf8_decode($_POST['SecChannel']));
SetValue($this->CreateVariableByIdent($deviceID, "AccessToken", "AccessToken", 3), utf8_decode($_POST['AccessToken']));
}
if (isset($_POST['geoID'])) {
$geoIDName = str_replace("-", "", utf8_decode($_POST['geoID']));
$geoIDName = str_replace(" ", "", $geoIDName);
$idGeofences = $this->CreateCategoryByIdent($deviceID, "Geofences", "Geofences");
$idGeofence = $this->CreateInstanceByIdent($idGeofences, $geoIDName, utf8_decode($_POST['geoID']));
//SetValue($this->CreateVariableByIdent($idGeofence, "Latitude", "Latitude", 2), floatval($_POST['Latitude']));
//SetValue($this->CreateVariableByIdent($idGeofence, "Longitude", "Longitude", 2), floatval($_POST['Longitude']));
SetValue($this->CreateVariableByIdent($idGeofence, "Timestamp", "Timestamp", 1, "~UnixTimestamp"), intval(strtotime($_POST['date'])));
SetValue($this->CreateVariableByIdent($idGeofence, "LocationState", "Status", 0, "~Presence"), intval($_POST['geoPresence']) > 0);
}
}
示例4: ProcessHookData
/**
* This function will be available automatically after the module is imported with the module control.
* Using the custom prefix this function will be callable from PHP and JSON-RPC through:
*
* LOCATIVE_ProcessHookData($id);
*
*/
public function ProcessHookData()
{
if ($_IPS['SENDER'] == "Execute") {
echo "This script cannot be used this way.";
return;
}
if (IPS_GetProperty($this->InstanceID, "Username") != "" || IPS_GetProperty($this->InstanceID, "Password") != "") {
if (!isset($_SERVER['PHP_AUTH_USER'])) {
$_SERVER['PHP_AUTH_USER'] = "";
}
if (!isset($_SERVER['PHP_AUTH_PW'])) {
$_SERVER['PHP_AUTH_PW'] = "";
}
if ($_SERVER['PHP_AUTH_USER'] != IPS_GetProperty($this->InstanceID, "Username") || $_SERVER['PHP_AUTH_PW'] != IPS_GetProperty($this->InstanceID, "Password")) {
header('WWW-Authenticate: Basic Realm="Locative WebHook"');
header('HTTP/1.0 401 Unauthorized');
echo "Authorization required";
return;
}
}
/**
The following $_POST data are slightly different from Geofency
**/
if (!isset($_POST['device']) || !isset($_POST['id']) || !isset($_POST['trigger'])) {
IPS_LogMessage("Locative", "Malformed data: " . print_r($_POST, true));
return;
}
$trigger = strtolower(isset($_POST["trigger"]) ? $_POST["trigger"] : "");
$name = htmlentities(utf8_decode(isset($_REQUEST["name"]) ? $_REQUEST["name"] : "Home"));
IPS_LogMessage("IPSLocative", print_r($_REQUEST, true));
$deviceID = $this->CreateInstanceByIdent($this->InstanceID, $this->ReduceGUIDToIdent($_POST['device']), "Device");
SetValue($this->CreateVariableByIdent($deviceID, "Latitude", "Latitude", 2), floatval($_POST['latitude']));
SetValue($this->CreateVariableByIdent($deviceID, "Longitude", "Longitude", 2), floatval($_POST['longitude']));
SetValue($this->CreateVariableByIdent($deviceID, "Time", "Time", 1, "~UnixTimestamp"), $_POST['timestamp']);
SetValue($this->CreateVariableByIdent($deviceID, "LastTrigger", "LastTrigger", 3), $trigger);
$varID = $this->CreateVariableByIdent($deviceID, $name, $name, 0, "~Presence");
switch ($trigger) {
case "enter":
SetValue($varID, 1);
echo "Welcome!";
break;
case "exit":
SetValue($varID, 0);
echo "Bye!";
break;
case "test":
$status = isset($_GET["status"]) ? $_GET["status"] == "1" : false;
echo "Test for {$name} received. Status {$status}";
SetValue($varID, $status);
break;
}
}
示例5: CheckSML
function CheckSML($stream, $parentID)
{
for ($i = 1; $i < count(EHz(0, 1)); $i++) {
$var = stristr($stream, EHz($i, 1));
if ($var != false) {
CheckVariable(EHz($i, 0), EHz($i, 2), EHz($i, 3), $parentID);
IPS_LogMessage('EHz', $i);
} else {
IPS_LogMessage('EHz <-> Port:', $stream);
}
}
return true;
}
示例6: CheckParents
private function CheckParents()
{
$result = $this->HasActiveParent();
if ($result) {
$instance = IPS_GetInstance($this->InstanceID);
$parentGUID = IPS_GetInstance($instance['ConnectionID'])['ModuleInfo']['ModuleID'];
if ($parentGUID == '{61051B08-5B92-472B-AFB2-6D971D9B99EE}') {
IPS_DisconnectInstance($this->InstanceID);
IPS_LogMessage('XBee-ZigBee Gateway', 'XB-ZB Gateway has invalid Parent.');
$result = false;
}
}
return $result;
}
示例7: ReceiveData
public function ReceiveData($JSONString)
{
$data = json_decode($JSONString);
//IPS_LogMessage('EHz <- Port:', bin2hex(utf8_decode($data->Buffer)));
$stream = bin2hex(utf8_decode($data->Buffer));
for ($i = 1; $i < EHz(0, 1); $i++) {
$var = stristr($stream, EHz($i, 1));
IPS_LogMessage('EHz', $i);
if ($var != false) {
CheckVariable(EHz($i, 0), EHz($i, 2), EHz($i, 3), $this->InstanceID);
IPS_LogMessage('EHz', $i);
} else {
IPS_LogMessage('EHz <-> Port:', $stream);
}
}
return true;
}
示例8: GetClients
public function GetClients()
{
$this->Login();
$url = $this->baseURL . "/api/s/default/stat/sta";
IPS_LogMessage("GetClients", print_r($this->ch, true));
IPS_LogMessage("GetClients", $url);
curl_setopt($this->ch, CURLOPT_URL, $url);
curl_setopt($this->ch, CURLOPT_POST, 1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, "json={}");
$response = curl_exec($this->ch);
IPS_LogMessage("GetClients", $response);
$this->Logout();
if ($response !== false) {
return json_decode($response);
} else {
return 0;
}
}
示例9: ProcessHookData
/**
* This function will be available automatically after the module is imported with the module control.
* Using the custom prefix this function will be callable from PHP and JSON-RPC through:
*
* GEO_ProcessHookData($id);
*
*/
public function ProcessHookData()
{
//workaround for bug
if (!isset($_IPS)) {
global $_IPS;
}
if ($_IPS['SENDER'] == "Execute") {
echo "This script cannot be used this way.";
return;
}
if (!isset($_POST['device']) || !isset($_POST['id']) || !isset($_POST['name'])) {
IPS_LogMessage("Geofency", "Malformed data: " . print_r($_POST, true));
return;
}
$deviceID = $this->CreateInstanceByIdent($this->InstanceID, $this->ReduceGUIDToIdent($_POST['device']), "Device");
SetValue($this->CreateVariableByIdent($deviceID, "Latitude", "Latitude", 2), floatval($_POST['latitude']));
SetValue($this->CreateVariableByIdent($deviceID, "Longitude", "Longitude", 2), floatval($_POST['longitude']));
SetValue($this->CreateVariableByIdent($deviceID, "Timestamp", "Timestamp", 1, "~UnixTimestamp"), intval(strtotime($_POST['date'])));
SetValue($this->CreateVariableByIdent($deviceID, $this->ReduceGUIDToIdent($_POST['id']), utf8_decode($_POST['name']), 0, "~Presence"), intval($_POST['entry']) > 0);
}
示例10: ApplyChanges
public function ApplyChanges()
{
// Diese Zeile nicht löschen
parent::ApplyChanges();
if (strlen($this->ReadPropertyString("API")) == 16) {
//Instanz ist aktiv
$this->SetStatus(102);
//Script + Timer
$UpdateInterval = $this->ReadPropertyInteger("UpdateInterval");
IPS_LogMessage($_IPS['SELF'], "Update Interval " . $UpdateInterval . " Minuten");
$UpdateWeatherScriptID = @$this->GetIDForIdent("_updateWeather");
if ($UpdateWeatherScriptID === false) {
$UpdateWeatherScriptID = $this->RegisterScript("_updateWeather", "_updateWeather", file_get_contents(__DIR__ . "/_updateWeather.php"), 99);
} else {
IPS_SetScriptContent($UpdateWeatherScriptID, file_get_contents(__DIR__ . "/_updateWeather.php"));
}
IPS_SetHidden($UpdateWeatherScriptID, true);
IPS_SetScriptTimer($UpdateWeatherScriptID, $UpdateInterval);
} else {
//Instanz ist inaktiv
$this->SetStatus(104);
}
}
示例11: SetStatusVariables
/**
* overloaded function to maintain variables and timer
*/
protected function SetStatusVariables()
{
parent::SetStatusVariables();
$caps = $this->GetCaps();
if (count($caps) < 1) {
return;
}
if (!isset($caps['Timer'])) {
$tid = @IPS_GetEventIDByName("DeviceTimer", $this->InstanceID);
if ($tid > 0) {
IPS_LogMessage(__CLASS__, __FUNCTION__ . "Drop DeviceTimer ({$tid})");
IPS_DeleteEvent($tid);
}
}
}
示例12: RGB2HSLmilight
protected function RGB2HSLmilight($R, $G, $B) {
if (($R < 0) or ( $R > 255) or ( $G < 0) or ( $G > 255) or ( $B < 0) or ( $B > 255))
IPS_LogMessage("milight", "Color must be between 0 and 255");
$R = ($R / 255);
$G = ($G / 255);
$B = ($B / 255);
$cMin = min($R, $G, $B);
$cMax = max($R, $G, $B);
$Chroma = $cMax - $cMin;
$L = ($cMax + $cMin) / 2 * 27;
//$V = $maxRGB * 27;
if ($Chroma == 0) {
$H = 0;
} else {
if ($R == $cMin) {
$H = 1 - (($B - $G) / $Chroma);
} elseif ($B == $cMin) {
$H = 3 - (($G - $R) / $Chroma);
} elseif ($G == $cMin) {
$H = 5 - (($R - $B) / $Chroma);
}
$H = $H / 6 * 255;
}
//IPS_LogMessage("rgb2hslmilight", "$R / $G / $B - $H / $L");
return array('Color' => round($H), 'Luminance' => round($L));
}
示例13: SendAPIData
private function SendAPIData(ISCP_API_Data $APIData)
{
$DualType = substr($APIData->APICommand, 3, 1);
$APIData->APICommand = substr($APIData->APICommand, 0, 3);
if ($APIData->Mapping === null) {
$APIData->GetMapping();
}
IPS_LogMessage('SendAPIData', print_r($APIData, 1));
// Variable konvertieren..
switch ($APIData->Mapping->VarType) {
case IPSVarType::vtBoolean:
$APIData->Data = ISCP_API_Commands::$BoolValueMapping[$APIData->Data];
break;
case IPSVarType::vtFloat:
// echo "Float VarType not implemented.";
throw new Exception("Float VarType not implemented.", E_USER_NOTICE);
break;
case IPSVarType::vtInteger:
if ($APIData->Mapping->ValueMapping == null) {
$APIData->Data = strtoupper(substr('0' . dechex($APIData->Data), -2));
} else {
$Mapping = array_flip($APIData->Mapping->ValueMapping);
if (array_key_exists($APIData->Data, $Mapping)) {
$APIData->Data = $Mapping[$APIData->Data];
} else {
$APIData->Data = strtoupper(substr('0' . dechex($APIData->Data), -2));
}
}
break;
case IPSVarType::vtDualInteger:
if ($DualType === false) {
throw new Exception("Error on get DualInteger.", E_USER_NOTICE);
// echo "Error on get DualInteger.";
// return false;
}
$Prefix = array_flip($APIData->Mapping->ValuePrefix)[$DualType];
$Mapping = array_flip($APIData->Mapping->ValueMapping);
if (array_key_exists($APIData->Data, $Mapping)) {
$APIData->Data = $Prefix . $Mapping[$APIData->Data];
} else {
$APIData->Data = strtoupper($Prefix . substr('0' . dechex($APIData->Data), -2));
}
break;
default:
// echo "Unknow VarType.";
// return;
throw new Exception("Unknow VarType.", E_USER_NOTICE);
break;
}
try {
$ret = $this->Send($APIData);
} catch (Exception $exc) {
throw $exc;
}
if ($ret->Data == "N/A") {
throw new Exception("Command (temporally) not available.", E_USER_NOTICE);
// return;
}
switch ($APIData->Mapping->VarType) {
case IPSVarType::vtBoolean:
case IPSVarType::vtInteger:
case IPSVarType::vtFloat:
if ($ret->Data != $APIData->Data) {
IPS_LogMessage('RequestAction', print_r($APIData, 1));
IPS_LogMessage('RequestActionResult', print_r($ret, 1));
throw new Exception("Value not available.", E_USER_NOTICE);
// echo "Value not available.";
// return;
}
break;
case IPSVarType::vtDualInteger:
if (strpos($ret->Data, $APIData->Data) === false) {
IPS_LogMessage('RequestAction', print_r($APIData, 1));
IPS_LogMessage('RequestActionResult', print_r($ret, 1));
throw new Exception("Value not available.", E_USER_NOTICE);
// echo "Value not available.";
// return;
}
break;
}
return $ret;
}
示例14: ForwardData
public function ForwardData($JSONString)
{
// Empfangene Daten von der Device Instanz
$data = json_decode($JSONString);
IPS_LogMessage("ForwardData AIO Gateway Splitter", utf8_decode($data->Buffer));
SetValue($this->GetIDForIdent("CommandOut"), $data->Buffer);
// Hier würde man den Buffer im Normalfall verarbeiten
// z.B. CRC prüfen, in Einzelteile zerlegen
try {
//
} catch (Exception $ex) {
echo $ex->getMessage();
echo ' in ' . $ex->getFile() . ' line: ' . $ex->getLine() . '.';
}
// Weiterleiten zur I/O Instanz
$resultat = $this->SendDataToParent(json_encode(array("DataID" => "{79827379-F36E-4ADA-8A95-5F8D1DC92FA9}", "Buffer" => $data->Buffer)));
//TX GUID
// Weiterverarbeiten und durchreichen
return $resultat;
}
示例15: SetSleeptimer
public function SetSleeptimer(integer $Minuten, string $Aktion, boolean $Aktiv)
{
if ($this->FeaturePreCheck("sleeptimer") === true) {
$IP = $this->ReadPropertyString("Enigma2IP");
$WebPort = $this->ReadPropertyInteger("Enigma2WebPort");
if ($this->GetPowerState() == 1) {
if ($Aktiv === true) {
$Aktiv = "True";
} else {
$Aktiv = "False";
}
$url = "http://" . $IP . ":" . $WebPort . "/web/sleeptimer?cmd=set&time=" . $Minuten . "&action=" . $Aktion . "&enabled=" . $Aktiv;
$xml = @simplexml_load_file($url);
$E2_SleeptimerEnabled = $this->ResultAuswerten(trim($xml->e2enabled));
$E2_SleeptimerMinuten = (int) trim($xml->e2minutes);
$E2_SleeptimerAktion = (string) trim($xml->e2action);
$E2_SleeptimerText = (string) trim($xml->e2text);
$E2_SleeptimerInfo["SleeptimerAktiviert"] = $E2_SleeptimerEnabled;
$E2_SleeptimerInfo["SleeptimerMinuten"] = $E2_SleeptimerMinuten;
$E2_SleeptimerInfo["SleeptimerAktion"] = $E2_SleeptimerAktion;
$E2_SleeptimerInfo["SleeptimerText"] = $E2_SleeptimerText;
if ($this->ReadPropertyBoolean("ErwInformationen") == true) {
$this->SetValueBoolean("SleeptimerAktiviertVAR", $E2_SleeptimerEnabled);
$this->SetValueInteger("SleeptimerMinutenVAR", $E2_SleeptimerMinuten);
$this->SetValueString("SleeptimerAktionVAR", $E2_SleeptimerAktion);
}
return $E2_SleeptimerInfo;
} else {
return false;
}
} else {
IPS_LogMessage("ENIGMA2BY", "Diese Funktion ist mit diesem Receiver/Image nicht verfügbar!");
}
}