本文整理汇总了PHP中IPS_SetVariableProfileIcon函数的典型用法代码示例。如果您正苦于以下问题:PHP IPS_SetVariableProfileIcon函数的具体用法?PHP IPS_SetVariableProfileIcon怎么用?PHP IPS_SetVariableProfileIcon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IPS_SetVariableProfileIcon函数的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: Create
public function Create()
{
// Diese Zeile nicht löschen.
parent::Create();
//Config Form
$this->RegisterPropertyInteger("TimerEventObject");
$this->RegisterPropertyInteger("TimerEventObjectOff");
$this->RegisterPropertyInteger("DiffTimeOff", 30);
//Variablenprofil anlegen
if (!IPS_VariableProfileExists("Timer.Time")) {
IPS_CreateVariableProfile("Timer.Time", 1);
IPS_SetVariableProfileIcon("Timer.Time", "Clock");
IPS_SetVariableProfileAssociation("Timer.Time", 0, "00:00");
IPS_SetVariableProfileAssociation("Timer.Time", 1, "00:15");
IPS_SetVariableProfileAssociation("Timer.Time", 2, "00:30");
IPS_SetVariableProfileAssociation("Timer.Time", 3, "00:45");
IPS_SetVariableProfileAssociation("Timer.Time", 4, "01:00");
}
//Variablen anlegen
$this->RegisterVariableInteger("CreateEventTime", "Zeitpunkt", "Clock");
}
示例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_SetVariableProfileAssociation
IPS_SetVariableProfileAssociation('ControlMode.HM', 2, 'Urlaub', '', 0x3366ff);
IPS_SetVariableProfileAssociation('ControlMode.HM', 3, 'Boost', '', 0xffff99);
}
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) {
示例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: 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);
}
示例8: 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);
}
示例9: RegisterProfileBoolean
protected function RegisterProfileBoolean($Name, $Icon)
{
if (!IPS_VariableProfileExists($Name)) {
IPS_CreateVariableProfile($Name, 0);
} else {
$profile = IPS_GetVariableProfile($Name);
if ($profile['ProfileType'] != 0) {
throw new Exception("Variable profile type does not match for profile " . $Name);
}
}
IPS_SetVariableProfileIcon($Name, $Icon);
IPS_SetVariableProfileAssociation("{$Name}", 1, "Lueften erlaubt", "", 0xff00);
IPS_SetVariableProfileAssociation("{$Name}", 0, "Lueften verboten", "", 0xff0000);
}
示例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: Create
/**
* overload internal IPS_Create($id) function
*/
public function Create()
{
// Diese Zeile nicht löschen.
parent::Create();
//Hint: $this->debug will not work in this stage! must use IPS_LogMessage
//props
$this->RegisterPropertyString('Category', 'TE923 Devices');
$this->RegisterPropertyInteger('ParentCategory', 0);
//parent cat is root
$this->RegisterPropertyInteger('RainPerCount', self::rc_to_mm);
$this->RegisterPropertyInteger('UpdateInterval', 600);
$this->RegisterPropertyString('URL', 'http://raspberry/cgi-bin/get_data.cgi');
$this->RegisterPropertyString('LogFile', '');
$this->RegisterPropertyBoolean('AutoCreate', true);
$this->RegisterPropertyBoolean('Debug', false);
$this->RegisterPropertyBoolean('Active', false);
//Vars
$this->RegisterVariableInteger('NewDayRainCounter', 'Rain Counter at new Day', "", -1);
$this->RegisterVariableInteger('LastRainCounter', 'Last Rain Counter', "", -2);
$this->RegisterVariableInteger('TimeStamp', 'Device Timestamp', 'UnixTimestamp', -3);
IPS_SetHidden($this->GetIDForIdent('LastRainCounter'), true);
IPS_SetHidden($this->GetIDForIdent('NewDayRainCounter'), true);
//reinit timer
$this->RegisterTimer('Update', 0, $this->module_data["prefix"] . '_UpdateEvent($_IPS[\'TARGET\']);');
if (!IPS_VariableProfileExists('TE923_Storm')) {
IPS_CreateVariableProfile('TE923_Storm', 0);
//boolean
IPS_SetVariableProfileValues('TE923_Storm', 0, 1, 0);
//status is inverted because a 0 value is every time marked red, regardless of color
IPS_SetVariableProfileAssociation('TE923_Storm', 1, "Not this", "Ok", -1);
IPS_SetVariableProfileAssociation('TE923_Storm', 0, "Save your dog", "Warning", 16711680);
IPS_SetVariableProfileIcon('TE923_Storm', "Warning");
}
//Forecast
$forecast = array(0 => array('Heavy Snow', 'Snowflake'), 1 => array('Little Snow', 'Snowflake'), 2 => array('Heavy Rain', 'Rainfall'), 3 => array('Little Rain', 'Drops'), 4 => array('Cloudy', 'Cloud'), 5 => array('some Clouds', 'Cloud'), 6 => array('Sunny', 'Sun'));
if (!IPS_VariableProfileExists('TE923_Forecast')) {
IPS_CreateVariableProfile('TE923_Forecast', 1);
//integer
IPS_SetVariableProfileValues('TE923_Forecast', 0, 6, 0);
for ($i = 0; $i < 7; $i++) {
IPS_SetVariableProfileAssociation('TE923_Forecast', $i, $forecast[$i][0], $forecast[$i][1], -1);
}
}
if (IPS_GetKernelRunlevel() == self::KR_READY) {
if ($this->isActive()) {
$this->SetStatus(self::ST_AKTIV);
$i = $this->GetUpdateInterval();
$this->SetTimerInterval('Update', $i * 1000);
//ms
$this->debug(__FUNCTION__, "Starte Timer {$i} sec");
} else {
$this->SetStatus(self::ST_INACTIV);
}
}
}
示例13: 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);
}
示例14: 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", "");
}
示例15: 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}");
}
}
}