Mikroalingment

Hallo,

wie in dem beigefügten Bild zu sehen, verschieben sich Einträge in zwei Listen (links und rechts) minimal (sieht man am besten im untersten Eintrag). Hat da jemand irgendeine Idee bzw einen Fix

Danke
gros_ibou

2 „Gefällt mir“

Schau mal hier: Wwx Skin - Wilkware

2 „Gefällt mir“

Hi gros_ibou,

echt coole Profil-Farbwerte - TOP! Kannst Du sie mal veröffentlichen - würde ich gern übernehmen!

Ich hätte da auch etwas Code zum einfachen ausgeben :slight_smile:

$profil = GetVariableProfile("<Hier Profilnamen eingeben>");

function GetVariableProfile ($varprofile) {
    $profil = IPS_GetVariableProfile($varprofile);
    //var_dump($profil);
    echo '$profile = ['.PHP_EOL;
    foreach($profil['Associations'] as $key => $arr) {
        $color = ($arr['Color'] != -1) ? sprintf('0x%06X',$arr['Color']) : -1;
        $value = ($profil['ProfileType'] != 3) ? $arr['Value'] : '\''.$arr['Value'].'\'';
    	echo '    ['.$value.', \''.$arr['Name'].'\', \''.$arr['Icon'].'\', '.$color.'],'.PHP_EOL;
    }
    echo '];'.PHP_EOL;    
}

Danke
Heiko

Für mich als Prog Legastheniker immer toll was alles geht!
Frage: wo landet das dann? Und wie bekommt man es wieder zurück ins Symcon?
Mit „SetVariableProfile“?
Aber wie bekommt man den „dump“ rüber, wenn ich mal annehme dass darin die Daten landen?

Sorry, hat natürlich null mit dem Thema zu tun :frowning:
Cheers Seppm

Here we go:

$profile = [
[6, ‚Off‘, ‚‘, 0x000080],
[15, ‚15°C‘, ‚‘, 0x000080],
[16, ‚16°C‘, ‚‘, 0x333399],
[17, ‚17°C‘, ‚‘, 0x005EC6],
[18, ‚18°C‘, ‚‘, 0x008080],
[19, ‚19°C‘, ‚‘, 0x339966],
[20, ‚20°C‘, ‚‘, 0x58B306],
[21, ‚21°C‘, ‚‘, 0xFFCC00],
[22, ‚22°C‘, ‚‘, 0xFF9900],
[23, ‚23°C‘, ‚‘, 0xFB7720],
[24, ‚24°C‘, ‚‘, 0xD20000],
[25, ‚25°C‘, ‚‘, 0xE60000],
[26, ‚On‘, ‚‘, 0xFF0000],
];

Jemand ne Idee zum ursprünglichen Problem?

Gruß
gros_ibou

2 „Gefällt mir“

Ah super! Hatte ich übersehen!
Danke!

Das Ergebnis ist ein Array, wie gerade @gros_ibou gepostet hat - Vielen Danke @gros_ibou!

Das kann dann meine Helper-Funktionen (CreateProfileInteger) für Profile verarbeiten:

/// Erzeugt ein Variablenprofil vom Typ {type} mit Namen {name} 
function CreateProfile($name, $type)
{
    if(!IPS_VariableProfileExists($name)) {
        IPS_CreateVariableProfile($name, $type);
    }
    else {
    $profile = IPS_GetVariableProfile($name);
        if($profile['ProfileType'] != $type)
            throw new Exception("Variable profile type does not match for profile ".$name);
    }
}

// Erzeugt ein Boolean-Variablenprofil (Boolean-Typ = 0)
function CreateProfileBoolean($name, $icon, $prefix, $suffix, $asso)
{
    CreateProfile($name, 0);
    IPS_SetVariableProfileIcon($name, $icon);
    IPS_SetVariableProfileText($name, $prefix, $suffix);

    if (($asso !== null) && (count($asso) !== 0)) {
        foreach ($asso as $ass) {
            IPS_SetVariableProfileAssociation($name, $ass[0], $ass[1], $ass[2], $ass[3]);
        }
    }
}

// Erzeugt ein Integer-Variablenprofil (Integer-Typ = 1)
function CreateProfileInteger($name, $icon, $prefix, $suffix, $minvalue, $maxvalue, $step, $digits, $asso = null)
{
    CreateProfile($name, 1);
    IPS_SetVariableProfileIcon($name, $icon);
    IPS_SetVariableProfileText($name, $prefix, $suffix);
    IPS_SetVariableProfileDigits($name, $digits);
/*
    if (($asso !== null) && (count($asso) !== 0)) {
        $minvalue = 0;
        $maxvalue = 0;
    }
*/    
    IPS_SetVariableProfileValues($name, $minvalue, $maxvalue, $step);

    if (($asso !== null) && (count($asso) !== 0)) {
        foreach ($asso as $ass) {
            IPS_SetVariableProfileAssociation($name, $ass[0], $ass[1], $ass[2], $ass[3]);
        }
    }
}

// Erzeugt ein Float-Variablenprofil (Float-Typ = 2)
function CreateProfileFloat($name, $icon, $prefix, $suffix, $minvalue, $maxvalue, $step, $digits, $asso = null)
{
    CreateProfile($name, 2);
    IPS_SetVariableProfileIcon($name, $icon);
    IPS_SetVariableProfileText($name, $prefix, $suffix);
    IPS_SetVariableProfileDigits($name, $digits);
    if(($asso == NULL) && (sizeof($asso) == 0)){
        $minvalue = 0;
        $maxvalue = 0;
    } 
    IPS_SetVariableProfileValues($name, $minvalue, $maxvalue, $step);
    if(($asso !== NULL) && (sizeof($asso) !== 0)){
        foreach($asso as $ass) {
            IPS_SetVariableProfileAssociation($name, $ass[0], $ass[1], $ass[2], $ass[3]);
        }
    }
}

// Erzeugt ein String-Variablenprofil (String-Typ = 3)
function CreateProfileString($name, $icon, $prefix, $suffix, $asso)
{
    CreateProfile($name, 3);
    IPS_SetVariableProfileIcon($name, $icon);
    IPS_SetVariableProfileText($name, $prefix, $suffix);

    if (($asso !== null) && (count($asso) !== 0)) {
        foreach ($asso as $ass) {
            IPS_SetVariableProfileAssociation($name, $ass[0], $ass[1], $ass[2], $ass[3]);
        }
    }
}


In dem Fall sieht das dann so aus:

$profile = [
[6, ‚Off‘, ‚‘, 0x000080],
[15, ‚15°C‘, ‚‘, 0x000080],
[16, ‚16°C‘, ‚‘, 0x333399],
[17, ‚17°C‘, ‚‘, 0x005EC6],
[18, ‚18°C‘, ‚‘, 0x008080],
[19, ‚19°C‘, ‚‘, 0x339966],
[20, ‚20°C‘, ‚‘, 0x58B306],
[21, ‚21°C‘, ‚‘, 0xFFCC00],
[22, ‚22°C‘, ‚‘, 0xFF9900],
[23, ‚23°C‘, ‚‘, 0xFB7720],
[24, ‚24°C‘, ‚‘, 0xD20000],
[25, ‚25°C‘, ‚‘, 0xE60000],
[26, ‚On‘, ‚‘, 0xFF0000],
];

CreateProfileInteger('Profil.Heating', 'Radiator', '', '', 0, 0, 0, 0, $profile);

Gruß Heiko

4 „Gefällt mir“

Der Wwx Skin sieht super aus. Kann man evtl sogar ein eigenes Logo einfügen??

Danke! Ja geht

Methode 1) einfach das Bild unter /img/www.logo.png durch ein anderes ersetzen (Dimension beachten)

Methode 2) ein neues Bild mit neuem Namen unter /img/ ablegen und dann in der webfront.css den folgenden Teil anpassen …

.ipsLogin>.logo { 
    background-image: url(./img/wwx.logo.png); 
    height: 128px;
    margin-left: -64px;
    margin-top: -250px;
    width: 128px;
}

Fertsch!
Heiko

Hi gros_ibou,

das Profil sieht echt super aus!
Könntest Du auch noch Dein Float Profil (Ist-Werte in Deinem Screenshot) bereitstellen?

Schon mal vielen Dank!

Grüße Jochen

Hiho,

bin gerade bei mir durch sieht jetzt so in der Übersicht aus

Da ich HM habe sieht das Profil bei mir jetzt so aus …

Code …

$temp = [
    [4.5,'Aus',      '', 0x000080],
    [5,  '%0.1f °C', '', 0x000080],
    [16, '%0.1f °C', '', 0x333399],
    [17, '%0.1f °C', '', 0x005EC6],
    [18, '%0.1f °C', '', 0x008080],
    [19, '%0.1f °C', '', 0x339966],
    [20, '%0.1f °C', '', 0x58B306],
    [21, '%0.1f °C', '', 0xFFCC00],
    [22, '%0.1f °C', '', 0xFF9900],
    [23, '%0.1f °C', '', 0xFB7720],
    [24, '%0.1f °C', '', 0xD20000],
    [25, '%0.1f °C', '', 0xE60000],
    [30.5, 'An',     '', 0xFF0000],
];

CreateProfileFloat('HM.Temperature', 'Temperature', '', '', 4.5, 30.5, 0.5, 1, $temp);


Vielleicht hilft’s
Heiko

1 „Gefällt mir“

Freut mich, dass die Farbwerte auch woanders zu Ehren kommen :slightly_smiling_face:

1 „Gefällt mir“

@Thunderbolt : Float Profil brauchst Du jetzt nicht mehr, oder?

@pitti Danke für das Profil! :+1:

@gros_ibou Hat sich damit erledigt.

Viele Grüße
Jochen

1 „Gefällt mir“

Hi Heiko,

leider schnalle ich nicht wie ich Deine "CreateProfile…! nutzen kann um aus einem Deiner Profil Exporte wieder ein Profil zu erzeugen.
Versteh nicht wie man Deine Funktionen für die Profile richtig einsetzt. Hab jetzt alles versucht was mir so in den Sinn kam in Skripten, aber da klappt nix.

Weiss nicht ob ich mein Problem überhaupt richtig erläutern konnte :see_no_evil:
Dann versuch ich es natürlich besser zu erklären.

Danke und Gruss Seppm

Hi Seppm,

schick mir doch einfach mal Dein Script (gern auch im Chat) dann schaue ich mal drüber und korriegiere!

Gruß Heiko

1 „Gefällt mir“

:smiling_face_with_three_hearts: kommt in Discord :+1:

Danke @pitti für das „fertige“ Skript, hatte es echt nicht geschnallt.
Falls da noch jemand Stress hat, hier das ganze Skript von Pitti dass dann das Profile „HM.Temperature“ anlegt.

<?php

$temp = [
    [4.5,'Aus',      '', 0x000080],
    [5,  '%0.1f ∞C', '', 0x000080],
    [16, '%0.1f ∞C', '', 0x333399],
    [17, '%0.1f ∞C', '', 0x005EC6],
    [18, '%0.1f ∞C', '', 0x008080],
    [19, '%0.1f ∞C', '', 0x339966],
    [20, '%0.1f ∞C', '', 0x58B306],
    [21, '%0.1f ∞C', '', 0xFFCC00],
    [22, '%0.1f ∞C', '', 0xFF9900],
    [23, '%0.1f ∞C', '', 0xFB7720],
    [24, '%0.1f ∞C', '', 0xD20000],
    [25, '%0.1f ∞C', '', 0xE60000],
    [30.5, 'An',     '', 0xFF0000],
];

CreateProfileFloat('HM.Temperature', 'Temperature', '', '', 4.5, 30.5, 0.5, 1, $temp);


/// Erzeugt ein Variablenprofil vom Typ {type} mit Namen {name} 
function CreateProfile($name, $type)
{
    if(!IPS_VariableProfileExists($name)) {
        IPS_CreateVariableProfile($name, $type);
    }
    else {
    $profile = IPS_GetVariableProfile($name);
        if($profile['ProfileType'] != $type)
            throw new Exception("Variable profile type does not match for profile ".$name);
    }
}

// Erzeugt ein Boolean-Variablenprofil (Boolean-Typ = 0)
function CreateProfileBoolean($name, $icon, $prefix, $suffix, $asso)
{
    CreateProfile($name, 0);
    IPS_SetVariableProfileIcon($name, $icon);
    IPS_SetVariableProfileText($name, $prefix, $suffix);

    if (($asso !== null) && (count($asso) !== 0)) {
        foreach ($asso as $ass) {
            IPS_SetVariableProfileAssociation($name, $ass[0], $ass[1], $ass[2], $ass[3]);
        }
    }
}

// Erzeugt ein Integer-Variablenprofil (Integer-Typ = 1)
function CreateProfileInteger($name, $icon, $prefix, $suffix, $minvalue, $maxvalue, $step, $digits, $asso = null)
{
    CreateProfile($name, 1);
    IPS_SetVariableProfileIcon($name, $icon);
    IPS_SetVariableProfileText($name, $prefix, $suffix);
    IPS_SetVariableProfileDigits($name, $digits);
/*
    if (($asso !== null) && (count($asso) !== 0)) {
        $minvalue = 0;
        $maxvalue = 0;
    }
*/    
    IPS_SetVariableProfileValues($name, $minvalue, $maxvalue, $step);

    if (($asso !== null) && (count($asso) !== 0)) {
        foreach ($asso as $ass) {
            IPS_SetVariableProfileAssociation($name, $ass[0], $ass[1], $ass[2], $ass[3]);
        }
    }
}

// Erzeugt ein Float-Variablenprofil (Float-Typ = 2)
function CreateProfileFloat($name, $icon, $prefix, $suffix, $minvalue, $maxvalue, $step, $digits, $asso = null)
{
    CreateProfile($name, 2);
    IPS_SetVariableProfileIcon($name, $icon);
    IPS_SetVariableProfileText($name, $prefix, $suffix);
    IPS_SetVariableProfileDigits($name, $digits);
    if(($asso == NULL) && (sizeof($asso) == 0)){
        $minvalue = 0;
        $maxvalue = 0;
    } 
    IPS_SetVariableProfileValues($name, $minvalue, $maxvalue, $step);
    if(($asso !== NULL) && (sizeof($asso) !== 0)){
        foreach($asso as $ass) {
            IPS_SetVariableProfileAssociation($name, $ass[0], $ass[1], $ass[2], $ass[3]);
        }
    }
}

// Erzeugt ein String-Variablenprofil (String-Typ = 3)
function CreateProfileString($name, $icon, $prefix, $suffix, $asso)
{
    CreateProfile($name, 3);
    IPS_SetVariableProfileIcon($name, $icon);
    IPS_SetVariableProfileText($name, $prefix, $suffix);

    if (($asso !== null) && (count($asso) !== 0)) {
        foreach ($asso as $ass) {
            IPS_SetVariableProfileAssociation($name, $ass[0], $ass[1], $ass[2], $ass[3]);
        }
    }
}

Danke und Gruss Seppm

1 „Gefällt mir“