本文整理汇总了PHP中IPS_SetVariableProfileText函数的典型用法代码示例。如果您正苦于以下问题:PHP IPS_SetVariableProfileText函数的具体用法?PHP IPS_SetVariableProfileText怎么用?PHP IPS_SetVariableProfileText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IPS_SetVariableProfileText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RegisterProfile
protected function RegisterProfile($Name, $VariablenTyp, $Icon, $Prefix, $Suffix, $MinValue, $MaxValue, $StepSize)
{
if (!IPS_VariableProfileExists($Name)) {
IPS_CreateVariableProfile($Name, $VariablenTyp);
} else {
$profile = IPS_GetVariableProfile($Name);
if ($profile['ProfileType'] != $VariablenTyp) {
throw new Exception("Variable profile type does not match for profile " . $Name);
}
}
IPS_SetVariableProfileIcon($Name, $Icon);
IPS_SetVariableProfileText($Name, $Prefix, $Suffix);
IPS_SetVariableProfileValues($Name, $MinValue, $MaxValue, $StepSize);
}
示例2: Create
public function Create()
{
parent::Create();
$this->RegisterPropertyString("Host", "");
$this->RegisterPropertyString("Zone", "Main_Zone");
$this->RegisterPropertyInteger("UpdateInterval", 5);
if (!IPS_VariableProfileExists('Volume.YAVR')) {
IPS_CreateVariableProfile('Volume.YAVR', 2);
}
IPS_SetVariableProfileDigits('Volume.YAVR', 1);
IPS_SetVariableProfileIcon('Volume.YAVR', 'Intensity');
IPS_SetVariableProfileText('Volume.YAVR', "", " dB");
IPS_SetVariableProfileValues('Volume.YAVR', -80, 16, 0.5);
$this->UpdateScenesProfile();
$this->UpdateInputsProfile();
}
示例3: ApplyChanges
public function ApplyChanges()
{
// Diese Zeile nicht löschen
parent::ApplyChanges();
//Variablenprofil anlegen
if (!IPS_VariableProfileExists("Megabyte")) {
IPS_CreateVariableProfile("Megabyte", 2);
IPS_SetVariableProfileValues("Megabyte", 0, 0, 2);
IPS_SetVariableProfileText("Megabyte", "", " MB");
}
if ($this->ReadPropertyString("IPS_Pfad") != "" and $this->ReadPropertyString("Netzwerkkarte") != "") {
//Variablen erstellen
$this->RegisterVariableFloat("CPU_idle", "CPU-Auslastung", "Humidity.F", 1);
$this->RegisterVariableFloat("CPU_volts", "CPU-Spannung", "Volt", 2);
$this->RegisterVariableFloat("CPU_temp", "CPU-Temperatur", "Temperature", 3);
$this->RegisterVariableFloat("HDD_total", "Gesamt Speicherplatz", "Megabyte", 4);
$this->RegisterVariableFloat("HDD_used", "Belegter Speicherplatz", "Megabyte", 5);
$this->RegisterVariableFloat("HDD_percent", "HDD-Belegung", "Humidity.F", 6);
$this->RegisterVariableFloat("HDD_symcon", "IPS-Speicherbelegung", "Megabyte", 7);
$this->RegisterVariableFloat("RAM_total", "Gesamt RAM", "Megabyte", 8);
$this->RegisterVariableFloat("RAM_used", "Benutzer RAM", "Megabyte", 9);
$this->RegisterVariableFloat("RAM_percent", "RAM-Auslastung", "Humidity.F", 10);
$this->RegisterVariableString("System_Info", "System Informationen", "HTMLBox", 11);
//Timer zeit setzen
$this->SetTimerInterval("Update", $this->ReadPropertyInteger("UpdateInterval") * 1000);
} else {
//Instanz ist inaktiv
$this->SetStatus(104);
}
//Variablen Logging Aktivieren / Deaktivieren
$archiveHandlerID = IPS_GetInstanceListByModuleID('{43192F0B-135B-4CE7-A0A7-1475603F3060}')[0];
AC_SetLoggingStatus($archiveHandlerID, $this->GetIDForIdent("CPU_idle"), $this->ReadPropertyBoolean("logCPU_idle"));
AC_SetLoggingStatus($archiveHandlerID, $this->GetIDForIdent("CPU_volts"), $this->ReadPropertyBoolean("logCPU_volts"));
AC_SetLoggingStatus($archiveHandlerID, $this->GetIDForIdent("CPU_temp"), $this->ReadPropertyBoolean("logCPU_temp"));
AC_SetLoggingStatus($archiveHandlerID, $this->GetIDForIdent("HDD_total"), $this->ReadPropertyBoolean("logHDD_total"));
AC_SetLoggingStatus($archiveHandlerID, $this->GetIDForIdent("HDD_used"), $this->ReadPropertyBoolean("logHDD_used"));
AC_SetLoggingStatus($archiveHandlerID, $this->GetIDForIdent("HDD_percent"), $this->ReadPropertyBoolean("logHDD_percent"));
AC_SetLoggingStatus($archiveHandlerID, $this->GetIDForIdent("HDD_symcon"), $this->ReadPropertyBoolean("logHDD_symcon"));
AC_SetLoggingStatus($archiveHandlerID, $this->GetIDForIdent("RAM_total"), $this->ReadPropertyBoolean("logRAM_total"));
AC_SetLoggingStatus($archiveHandlerID, $this->GetIDForIdent("RAM_used"), $this->ReadPropertyBoolean("logRAM_used"));
AC_SetLoggingStatus($archiveHandlerID, $this->GetIDForIdent("RAM_percent"), $this->ReadPropertyBoolean("logRAM_percent"));
IPS_ApplyChanges($archiveHandlerID);
copy(IPS_GetKernelDir() . "modules/IPS_PI_Monitor/PI_Monitor/Raspi-PGB001.png", IPS_GetKernelDir() . "webfront/user/Raspi-PGB001.png");
}
示例4: Create
public function Create()
{
// Diese Zeile nicht löschen.
parent::Create();
$this->RegisterPropertyString("API", "");
$this->RegisterPropertyString("Location", "Menden");
$this->RegisterPropertyInteger("UpdateInterval", 300);
//Variablenprofil anlegen
//$this->RegisterProfileFloat("WindSpeed.Kph", "WindSpeed", "", " kn", 0, 100, 1);
//$this->RegisterProfileInteger("Distance.km", "Distance", "", " km", 0, 150, 1);
if (!IPS_VariableProfileExists("WindSpeed.kt")) {
IPS_CreateVariableProfile("WindSpeed.kt", 2);
// 2 = Float
IPS_SetVariableProfileIcon("WindSpeed.kt", "WindSpeed");
IPS_SetVariableProfileValues("WindSpeed.kt", 0, 100, 1);
IPS_SetVariableProfileText("WindSpeed.kt", "", " kn");
}
if (!IPS_VariableProfileExists("Distance.km")) {
IPS_CreateVariableProfile("Distance.km", 1);
// 1 = Integer
IPS_SetVariableProfileIcon("Distance.km", "Distance");
IPS_SetVariableProfileValues("Distance.km", 0, 999, 1);
IPS_SetVariableProfileText("Distance.km", "", " km");
}
//Eigenschaften festlegen
$this->RegisterVariableString("Condition", "Wetterbedingung");
$this->RegisterVariableString("WindDirectionString", "Windrichtung");
$this->RegisterVariableInteger("AirPressure", "Luftdruck", "AirPressure");
$this->RegisterVariableInteger("Visibility", "Sichtweite", "Distance.km");
$this->RegisterVariableInteger("Humidity", "Luftfeuchtigkeit", "Humidity");
$this->RegisterVariableInteger("WindDirection", "Windrichtung", "WindDirection");
$this->RegisterVariableFloat("Temperature", "Temperatur", "Temperature");
$this->RegisterVariableFloat("Windchill", "Windchill", "Temperature");
$this->RegisterVariableFloat("Dewpoint", "Taupunkt", "Temperature");
$this->RegisterVariableFloat("WindSpeed", "Wind", "WindSpeed.kt");
$this->RegisterVariableFloat("WindSpeedGust", "Wind in Böen", "WindSpeed.kt");
$this->RegisterVariableFloat("UV", "UV Index");
}
示例5: IPS_CreateVariableProfile
}
if (!IPS_VariableProfileExists('DimmerControl.HM')) {
IPS_CreateVariableProfile('DimmerControl.HM', 1);
IPS_SetVariableProfileIcon('DimmerControl.HM', 'Intensity');
IPS_SetVariableProfileAssociation('DimmerControl.HM', -2, '0 %', '', 0xff);
IPS_SetVariableProfileAssociation('DimmerControl.HM', -1, 'Dunkler', '', 0x339966);
IPS_SetVariableProfileAssociation('DimmerControl.HM', 0, 'Stop', '', 0x0);
IPS_SetVariableProfileAssociation('DimmerControl.HM', 1, 'Zurück', '', 0xff0000);
IPS_SetVariableProfileAssociation('DimmerControl.HM', 2, 'Heller', '', 0x339966);
IPS_SetVariableProfileAssociation('DimmerControl.HM', 3, '100 %', '', 0xff);
}
if (!IPS_VariableProfileExists('DimmerSpeed.HM')) {
IPS_CreateVariableProfile('DimmerSpeed.HM', 2);
IPS_SetVariableProfileIcon('DimmerSpeed.HM', 'Intensity');
IPS_SetVariableProfileValues('DimmerSpeed.HM', 0, 30, 2);
IPS_SetVariableProfileText('DimmerSpeed.HM', '', ' s');
}
# ENDE Konfig
$AddOnMappings = array('BLIND' => array('CONTROL' => array('Name Raum' => 'Steuerung', 'Name Gewerk' => 'Steuerung %2$s', 'Profil' => 'BlindControl.HM', 'Action' => 'BLIND_SCRIPT', 'VarTyp' => 1)), 'THERMALCONTROL_TRANSMIT' => array('CONTROL_TEMP' => array('Name Raum' => 'Soll Temperatur Vorwahl', 'Name Gewerk' => 'Soll Temperatur Vorwahl %2$s', 'Profil' => 'ControlTemp.HM', 'Action' => 'CONTROL_TEMP_SCRIPT', 'VarTyp' => 1)), 'CLIMATECONTROL_RT_TRANSCEIVER' => array('CONTROL_TEMP' => array('Name Raum' => 'Soll Temperatur Vorwahl', 'Name Gewerk' => 'Soll Temperatur Vorwahl %2$s', 'Profil' => 'ControlTemp.HM', 'Action' => 'CONTROL_TEMP_SCRIPT', 'VarTyp' => 1)), 'DIMMER' => array('DIMMER_CONTROL' => array('Name Raum' => 'Steuerung', 'Name Gewerk' => 'Steuerung %2$s', 'Profil' => 'DimmerControl.HM', 'Action' => 'DIMMER_SCRIPT', 'VarTyp' => 1), 'RAMP_TIME' => array('Name Raum' => 'Geschwindigkeit', 'Name Gewerk' => 'Geschwindigkeit %2$s', 'Profil' => 'DimmerSpeed.HM', 'Action' => 'DIMMER_SCRIPT', 'VarTyp' => 2)), 'VIRTUAL_DIMMER' => array('DIMMER_CONTROL' => array('Name Raum' => 'Steuerung', 'Name Gewerk' => 'Steuerung %2$s', 'Profil' => 'DimmerControl.HM', 'Action' => 'DIMMER_SCRIPT', 'VarTyp' => 1), 'RAMP_TIME' => array('Name Raum' => 'Geschwindigkeit', 'Name Gewerk' => 'Geschwindigkeit %2$s', 'Profil' => 'DimmerSpeed.HM', 'Action' => 'DIMMER_SCRIPT', 'VarTyp' => 2)));
ini_set('max_execution_time', count($HMCcuAddress) * 120);
//HM Sockets prüfen und einrichten
$nextPort = 5544;
$HMSockets = array_flip($HMCcuAddress);
$HMSocketsOld = IPS_GetInstanceListByModuleID("{A151ECE9-D733-4FB9-AA15-7F7DD10C58AF}");
if (count($HMSocketsOld) > 0) {
foreach ($HMSocketsOld as $HMSocket) {
$HMSocketIDsOld[IPS_GetProperty($HMSocket, 'Host')] = $HMSocket;
$Port = IPS_GetProperty($HMSocket, 'Port');
if ($Port >= $nextPort) {
$nextPort = $Port + 1;
}
示例6: RegisterProfileIntegerEx
protected function RegisterProfileIntegerEx($Name, $Icon, $Prefix, $Suffix, $Associations)
{
if (sizeof($Associations) === 0) {
$MinValue = 0;
$MaxValue = 0;
} else {
$MinValue = $Associations[0][0];
$MaxValue = $Associations[sizeof($Associations) - 1][0];
}
if (!IPS_VariableProfileExists($Name)) {
IPS_CreateVariableProfile($Name, 1);
} else {
$profile = IPS_GetVariableProfile($Name);
if ($profile['ProfileType'] != 1)
throw new Exception("Variable profile type does not match for profile " . $Name);
}
IPS_SetVariableProfileIcon($Name, $Icon);
IPS_SetVariableProfileText($Name, $Prefix, $Suffix);
IPS_SetVariableProfileValues($Name, $MinValue, $MaxValue, 0);
foreach ($Associations as $Association) {
IPS_SetVariableProfileAssociation($Name, $Association[0], $Association[1], $Association[2], $Association[3]);
}
}
示例7: create
/**
* create the variable profile in symcon if it does not exist
*
* @param string $name name of the variable profile
* @param int $type IPS datatype
* @param string $prefix name prefix
* @param string $suffix variable suffix (usually the value unit)
* @param array $assoc value to format associations
* @access private
*/
private function create($name, $type, $prefix = "", $suffix = "", $assoc = NULL)
{
if (!IPS_VariableProfileExists($name)) {
if ($this->debug) {
echo "INFO - variable profile {$name} does not exist. It will be created.\n";
}
IPS_CreateVariableProfile($name, $type);
IPS_SetVariableProfileText($name, $prefix, $suffix);
if (isset($assoc)) {
foreach ($assoc as $a) {
if ($this->debug) {
echo "INFO - variable profile association for variable {$name} and value " . $a["name"] . " does not exist and will be created\n";
}
IPS_SetVariableProfileAssociation($name, $a["val"], $a["name"], $a["icon"], $a["color"]);
}
}
}
}
示例8: RegisterProfileLEDGateway
protected function RegisterProfileLEDGateway($Name, $Icon, $Prefix, $Suffix)
{
if (!IPS_VariableProfileExists($Name)) {
IPS_CreateVariableProfile($Name, 1);
} else {
$profile = IPS_GetVariableProfile($Name);
if ($profile['ProfileType'] != 1) {
throw new Exception("Variable profile type does not match for profile " . $Name);
}
}
$MinValue = 0;
$MaxValue = 4;
$StepSize = 1;
IPS_SetVariableProfileIcon($Name, $Icon);
IPS_SetVariableProfileText($Name, $Prefix, $Suffix);
IPS_SetVariableProfileValues($Name, $MinValue, $MaxValue, $StepSize);
// boolean IPS_SetVariableProfileAssociation ( string $ProfilName, float $Wert, string $Name, string $Icon, integer $Farbe ) Farbwert im HTML Farbcode (z.b. 0x0000FF für Blau). Sonderfall: -1 für transparent
IPS_SetVariableProfileAssociation($Name, 0, "Weiß", "", 0xfffffff);
IPS_SetVariableProfileAssociation($Name, 1, "Blau", "", 0x13adf);
IPS_SetVariableProfileAssociation($Name, 2, "Grün", "", 0x88a08);
IPS_SetVariableProfileAssociation($Name, 3, "Rot", "", 0xfe2e2e);
IPS_SetVariableProfileAssociation($Name, 4, "Aus", "", 0x585858);
}
示例9: RegisterProfileColor
protected function RegisterProfileColor($Name, $Icon, $Prefix, $Suffix)
{
if (!IPS_VariableProfileExists($Name)) {
IPS_CreateVariableProfile($Name, 1);
} else {
$profile = IPS_GetVariableProfile($Name);
if ($profile['ProfileType'] != 1) {
throw new Exception("Variable profile type does not match for profile " . $Name);
}
}
$MinValue = 0;
$MaxValue = 7;
$StepSize = 1;
IPS_SetVariableProfileIcon($Name, $Icon);
IPS_SetVariableProfileText($Name, $Prefix, $Suffix);
IPS_SetVariableProfileValues($Name, $MinValue, $MaxValue, $StepSize);
// boolean IPS_SetVariableProfileAssociation ( string $ProfilName, float $Wert, string $Name, string $Icon, integer $Farbe ) Farbwert im HTML Farbcode (z.b. 0x0000FF für Blau). Sonderfall: -1 für transparent
IPS_SetVariableProfileAssociation($Name, 0, "Rot", "", 0xfe2e2e);
IPS_SetVariableProfileAssociation($Name, 1, "Orange", "", 0xffbf00);
IPS_SetVariableProfileAssociation($Name, 2, "Gelb", "", 0xf7fe2e);
IPS_SetVariableProfileAssociation($Name, 3, "Grün", "", 0x64fe2e);
IPS_SetVariableProfileAssociation($Name, 4, "Cyan", "", 0x81f7f3);
IPS_SetVariableProfileAssociation($Name, 5, "Blau", "", 0xff);
IPS_SetVariableProfileAssociation($Name, 6, "Lila", "", 0xda81f5);
IPS_SetVariableProfileAssociation($Name, 7, "Weiß", "", 0xffffff);
}
示例10: ApplyChanges
public function ApplyChanges()
{
// get instance id
$instanceid = IPS_GetInstance($this->InstanceID)['InstanceID'];
// rename instance
$room = $this->ReadPropertyString("Room");
if ($room != "") {
IPS_SetName($instanceid, $room);
}
// check device
$deviceip = $this->ReadPropertyString("DeviceIP");
$timeout = $this->ReadPropertyString("Timeout");
if ($deviceip != "") {
// check device availability
if ($timeout && Sys_Ping($deviceip, $timeout) != true) {
// throw new Exception("Device ".$deviceip." is not available");
die("Unable to connect to device {$deviceip}");
}
include_once __DIR__ . "/bose_soundtouch_api.php";
$bosedevice = new BoseSoundTouchAPI($deviceip);
$result = $bosedevice->getDeviceNowPlayingAPI();
// get device id for multiroom
$deviceid = $this->ReadPropertyString("DeviceID");
if ($deviceid == "" and $deviceip != "") {
$deviceid = $result['deviceid'];
IPS_SetProperty($instanceid, "DeviceID", "" . $deviceid . "");
if (IPS_HasChanges($instanceid)) {
IPS_ApplyChanges($instanceid);
}
}
}
// never delete this line!
parent::ApplyChanges();
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// create profiles
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//create zone profiles for multiroom
$allboseinstances = IPS_GetInstanceListByModuleID("{4836EF46-FF79-4D6A-91C9-FE54F1BDF2DB}");
// create profile for each instance / device
foreach ($allboseinstances as $key => $instanceid) {
$multiroomprofilename = "bose.Device" . $instanceid . "MasterZones";
// delete zone profiles
if (IPS_VariableProfileExists($multiroomprofilename)) {
IPS_DeleteVariableProfile($multiroomprofilename);
}
IPS_CreateVariableProfile($multiroomprofilename, 1);
// set values for profile
foreach ($allboseinstances as $key => $value) {
if ($instanceid == $value) {
IPS_SetVariableProfileAssociation($multiroomprofilename, "0", "Off", "", 0xff);
} else {
$instancename = IPS_GetName($value);
if ($instancename != "") {
IPS_SetVariableProfileAssociation($multiroomprofilename, "" . ($key + 1) . "", "" . $instancename . "", "", 0xff);
}
}
}
}
// create volume slider profile
$volumesliderprofilename = "bose.VolumeSlider";
if (!IPS_VariableProfileExists($volumesliderprofilename)) {
IPS_CreateVariableProfile($volumesliderprofilename, 1);
}
IPS_SetVariableProfileValues($volumesliderprofilename, 0, 100, 1);
IPS_SetVariableProfileText($volumesliderprofilename, "", "%");
IPS_SetVariableProfileIcon($volumesliderprofilename, "Speaker");
// play pause preset
$playpauseprofilename = "bose.PlayPause";
if (!IPS_VariableProfileExists($playpauseprofilename)) {
IPS_CreateVariableProfile($playpauseprofilename, 1);
}
IPS_SetVariableProfileAssociation($playpauseprofilename, "0", "Pause", "", 0xff);
IPS_SetVariableProfileAssociation($playpauseprofilename, "1", "Play", "", 0xff);
IPS_SetVariableProfileIcon($playpauseprofilename, "HollowArrowRight");
// create presets and radiolocations profiles
$instanceid = IPS_GetInstance($this->InstanceID)['InstanceID'];
$radiostationsprofilename = "bose.Device" . $instanceid . "RadioStations";
if (!IPS_VariableProfileExists($radiostationsprofilename)) {
IPS_CreateVariableProfile($radiostationsprofilename, 1);
}
$radiolocationsprofilename = "bose.Device" . $instanceid . "RadioLocations";
if (!IPS_VariableProfileExists($radiolocationsprofilename)) {
IPS_CreateVariableProfile($radiolocationsprofilename, 1);
}
// get device presets
if ($deviceip != "") {
include_once __DIR__ . "/bose_soundtouch_api.php";
$bosedevice = new BoseSoundTouchAPI($deviceip);
$result = $bosedevice->getDevicePresetsAPI();
for ($i = 0; $i < 6; $i++) {
$value = $i + 1;
$radiostationname = $result->preset[$i]->ContentItem->itemName;
$radiostationlocation = $result->preset[$i]->ContentItem["location"];
IPS_SetVariableProfileAssociation($radiostationsprofilename, "" . $value . "", "" . $radiostationname . "", "", 0xff);
IPS_SetVariableProfileAssociation($radiolocationsprofilename, "" . $value . "", "" . $radiostationlocation . "", "", 0xff);
}
IPS_SetVariableProfileIcon($radiostationsprofilename, "Cloud");
}
// create timer hour profile
$timerhourprofilename = "bose.TimerHour";
//.........这里部分代码省略.........
示例11: CreateFloatProfile
/**
* CreateFloatProfile
* @param string $ProfileName
* @param string $Icon
* @param string $Präfix
* @param string $Suffix
* @param float $MinValue
* @param float $MaxValue
* @param integer $StepSize
* @param integer $Digits
*/
private function CreateFloatProfile($ProfileName, $Icon, $Präfix, $Suffix, $MinValue, $MaxValue, $StepSize, $Digits)
{
$Profile = IPS_VariableProfileExists($ProfileName);
if ($Profile === FALSE) {
IPS_CreateVariableProfile($ProfileName, 2);
IPS_SetVariableProfileIcon($ProfileName, $Icon);
IPS_SetVariableProfileText($ProfileName, $Präfix, $Suffix);
IPS_SetVariableProfileValues($ProfileName, $MinValue, $MaxValue, $StepSize);
IPS_SetVariableProfileDigits($ProfileName, $Digits);
}
}
示例12: Variable_GetOrSet
function Variable_GetOrSet($name, $parent, $value)
{
global $Logging;
$VarID = @IPS_GetVariableIDByName($name, $parent);
if (!$VarID) {
if ($name == "Name" or $name == "Marke" or $name == "ID" or $name == "Anschrift") {
$VarID = IPS_CreateVariable(3);
} elseif ($name == "Geöffnet_von" or $name == "Geöffnet_bis") {
$VarID = IPS_CreateVariable(3);
$ProfilName = "GeoffnetVonBis_Tankstelle_TK";
if (!IPS_VariableProfileExists($ProfilName)) {
IPS_CreateVariableProfile($ProfilName, 3);
IPS_SetVariableProfileText($ProfilName, "", " Uhr");
IPS_SetVariableProfileIcon($ProfilName, "Clock");
}
IPS_SetVariableCustomProfile($VarID, $ProfilName);
} elseif ($name == "Geöffnet") {
$VarID = IPS_CreateVariable(0);
$ProfilName = "Geoeffnet_Tankstelle_TK";
if (!IPS_VariableProfileExists($ProfilName)) {
IPS_CreateVariableProfile($ProfilName, 0);
IPS_SetVariableProfileAssociation($ProfilName, 0, "Geschlossen", "", -1);
IPS_SetVariableProfileAssociation($ProfilName, 1, "Geöffnet", "", -1);
IPS_SetVariableProfileIcon($ProfilName, "Information");
}
IPS_SetVariableCustomProfile($VarID, $ProfilName);
} elseif ($name == "Distanz") {
$VarID = IPS_CreateVariable(2);
$ProfilName = "Distanz_Tankstelle_TK";
if (!IPS_VariableProfileExists($ProfilName)) {
IPS_CreateVariableProfile($ProfilName, 2);
IPS_SetVariableProfileText($ProfilName, "", "km");
IPS_SetVariableProfileDigits($ProfilName, 1);
IPS_SetVariableProfileIcon($ProfilName, "Distance");
}
IPS_SetVariableCustomProfile($VarID, $ProfilName);
} elseif ($name == "Preis" or $name == "Preis_E5" or $name == "Preis_E10" or $name == "Preis_Diesel") {
if ($value === NULL) {
return;
}
$VarID = IPS_CreateVariable(2);
$ProfilName = "Euro_Tankstelle_TK";
if (!IPS_VariableProfileExists($ProfilName)) {
IPS_CreateVariableProfile($ProfilName, 2);
IPS_SetVariableProfileText($ProfilName, "", "€");
IPS_SetVariableProfileDigits($ProfilName, 3);
IPS_SetVariableProfileIcon($ProfilName, "Euro");
}
IPS_SetVariableCustomProfile($VarID, $ProfilName);
if ($Logging) {
$ArchiveHandlerID = IPS_GetInstanceListByModuleID('{43192F0B-135B-4CE7-A0A7-1475603F3060}')[0];
AC_SetLoggingStatus($ArchiveHandlerID, $VarID, true);
IPS_ApplyChanges($ArchiveHandlerID);
}
}
IPS_SetName($VarID, $name);
IPS_SetParent($VarID, $parent);
}
SetValue($VarID, $value);
}
示例13: CreateProfiles
function CreateProfiles() {
@IPS_CreateVariableProfile("IPSLogger_Level", 1);
IPS_SetVariableProfileText("IPSLogger_Level", "", "");
IPS_SetVariableProfileValues("IPSLogger_Level", 0, 0, 0);
IPS_SetVariableProfileDigits("IPSLogger_Level", 0);
IPS_SetVariableProfileIcon("IPSLogger_Level", "");
IPS_SetVariableProfileAssociation("IPSLogger_Level", 0, "Fatal", "", 0xaaaaaa);
IPS_SetVariableProfileAssociation("IPSLogger_Level", 1, "Error", "", 0xaaaaaa);
IPS_SetVariableProfileAssociation("IPSLogger_Level", 2, "Warning", "", 0xaaaaaa);
IPS_SetVariableProfileAssociation("IPSLogger_Level", 3, "Notification", "", 0xaaaaaa);
IPS_SetVariableProfileAssociation("IPSLogger_Level", 4, "Info", "", 0xaaaaaa);
IPS_SetVariableProfileAssociation("IPSLogger_Level", 5, "Debug", "", 0xaaaaaa);
IPS_SetVariableProfileAssociation("IPSLogger_Level", 6, "Communication", "", 0xaaaaaa);
IPS_SetVariableProfileAssociation("IPSLogger_Level", 7, "Trace", "", 0xaaaaaa);
IPS_SetVariableProfileAssociation("IPSLogger_Level", 9, "All", "", 0xaaaaaa);
@IPS_CreateVariableProfile("IPSLogger_MsgCount", 1);
IPS_SetVariableProfileText("IPSLogger_MsgCount", "", " Msg's");
IPS_SetVariableProfileValues("IPSLogger_MsgCount", 5, 100, 5);
IPS_SetVariableProfileDigits("IPSLogger_MsgCount", 0);
IPS_SetVariableProfileIcon("IPSLogger_MsgCount", "");
@IPS_CreateVariableProfile("IPSLogger_MsgId", 1);
IPS_SetVariableProfileText("IPSLogger_MsgId", "", "");
IPS_SetVariableProfileValues("IPSLogger_MsgId", 0, 0, 0);
IPS_SetVariableProfileDigits("IPSLogger_MsgId", 0);
IPS_SetVariableProfileIcon("IPSLogger_MsgId", "");
@IPS_CreateVariableProfile("IPSLogger_Delay", 1);
IPS_SetVariableProfileText("IPSLogger_Delay", "", " Seconds");
IPS_SetVariableProfileValues("IPSLogger_Delay", 0, 600, 30);
IPS_SetVariableProfileDigits("IPSLogger_Delay", 0);
IPS_SetVariableProfileIcon("IPSLogger_Delay", "");
@IPS_CreateVariableProfile("IPSLogger_Days", 1);
IPS_SetVariableProfileText("IPSLogger_Days", "", " Tage");
IPS_SetVariableProfileValues("IPSLogger_Days", 0, 100, 5);
IPS_SetVariableProfileDigits("IPSLogger_Days", 0);
IPS_SetVariableProfileIcon("IPSLogger_Days", "");
@IPS_CreateVariableProfile("IPSLogger_Priority", 1);
IPS_SetVariableProfileText("IPSLogger_Priority", "", "");
IPS_SetVariableProfileValues("IPSLogger_Priority", 0, 10, 1);
IPS_SetVariableProfileDigits("IPSLogger_Priority", 0);
IPS_SetVariableProfileIcon("IPSLogger_Priority", "");
}
示例14: check_profile
/**
* Check profile by name if exists, else create
* @param String $pname Name
* @param integer $typ Variable Typ (0..3)
* @param String $prefix Prefix before value
* @param String $suffix Suffix after value
* @param String $icon Icon Name
* @param integer $min min value
* @param integer $max max value
* @param integer $step step value
* @param integer $digit digits for formatting
* @param boolean $drop drop existing profile first
*/
protected function check_profile($pname, $typ, $prefix, $suffix, $icon, $min, $max, $step, $digit = 0, $drop = false)
{
//use logmessages instead of debug because this isnt available in early stage
if (IPS_VariableProfileExists($pname) && $drop) {
IPS_DeleteVariableProfile($pname);
}
if (!IPS_VariableProfileExists($pname)) {
IPS_LogMessage($this->name, __FUNCTION__ . "(#" . $this->InstanceID . ") Create VariableProfile {$pname}");
if (IPS_CreateVariableProfile($pname, $typ)) {
IPS_SetVariableProfileText($pname, $prefix, $suffix);
if (isset($min) && isset($max) && isset($step)) {
IPS_SetVariableProfileValues($pname, $min, $max, $step);
}
if (isset($digit)) {
IPS_SetVariableProfileDigits($pname, $digit);
}
if ($icon) {
IPS_SetVariableProfileIcon($pname, $icon);
}
} else {
IPS_LogMessage($this->name, __FUNCTION__ . "(#" . $this->InstanceID . ") Cannot Create VariableProfile {$pname}");
}
}
}
示例15: CreateProfile_Duration
function CreateProfile_Duration ($Name, $Start, $Step, $Stop, $Prefix=" Min", $Icon="") {
@IPS_DeleteVariableProfile($Name);
IPS_CreateVariableProfile($Name, 1);
IPS_SetVariableProfileText($Name, "", $Prefix);
IPS_SetVariableProfileValues($Name, $Start, $Stop, $Step);
IPS_SetVariableProfileDigits($Name, 0);
IPS_SetVariableProfileIcon($Name, $Icon);
}