Amazon Echo (Alexa) mit IP-Symcon verbinden

Hi,
gibt irgendein Gerät das einen Text von Alexa an IPS übergibt damit man es für eine Suche missbrauchen kann?

Ralf

Siehe Modul Echo Remote, dort hast du den letzten Befehl als String

Hi,
als Notlösung vielleicht machbar aber oft quatscht Alexa dazwischen. Ich suche etwas wo sie nicht drauf antwortet wenn ICH es nicht will.

Ralf

Hi,
im April 2018 gab es mal Fragen nach Farbtemperatur über Alexa an IPS. Hat sich da irgendwas geändert? Skills müssten es eigentlich können da Hue es unterstützt.

Ralf

Wir schauen uns das nochmal an. Ich kann mir gut vorstellen, dass wir das beim Expertenlicht hinzufügen.

Hi,
danke. Ist nicht so wichtig aber nice to have.

Ralf

Mit der Zeit wird die Anzahl der Alexa-Kommandos immer umfangreicher. Gibt es denn eine Möglichkeit eine Liste anzuzeigen / auszudrucken auf der alle Alexa-Kommandos (Feld Name) und alle Schaltervariablen angezeigt werden?

Die selbe Frage hatte @steiner letzte Woche und ich habe ihm folgendes Skript gebaut. Vielleicht hilft es dir ja auch?

<?php

$id_alexa = 12345;
$list = [];
$properties = json_decode(IPS_GetConfiguration($id_alexa), true);
foreach($properties as $name => $value) {
    if (substr($name, 0, 6) == "Device") {
        $devices = json_decode($value, true);
        foreach($devices as $device) {
            foreach($device as $endpoint => $target) {
                if($endpoint == "ID")
                    continue;
                if($endpoint == "Name")
                    continue;
                $list[] = [
                    "ID" => $target,
                    "Name" => $device["Name"],
                    "Type" => substr($name, 6)
                ];
            }
        }
    }
}
$readable = [];
$maxLocation = 0;
$maxName = 0;
$maxType = 0;
foreach($list as $item) {
    $maxLocation = max($maxLocation, mb_strlen(IPS_GetLocation($item['ID'])));
    $maxName = max($maxName, mb_strlen($item['Name']));
    $maxType = max($maxType, mb_strlen($item['Type']));
}
function mb_str_pad( $input, $pad_length, $pad_string = ' ', $pad_type = STR_PAD_RIGHT)
{
    $diff = strlen( $input ) - mb_strlen( $input );
    return str_pad( $input, $pad_length + $diff, $pad_string, $pad_type );
}
foreach($list as $item) {
    $readable[] = mb_str_pad(IPS_GetLocation($item['ID']), $maxLocation, " ") . "   " . mb_str_pad($item['Name'], $maxName, " ") . "   " . mb_str_pad($item['Type'], $maxType, " ");
}
sort($readable);
foreach($readable as $line) {
    echo $line . PHP_EOL;
}

paresy

JA, SUPER!!!
Vielen Dank für die sehr schnelle Hilfe.
Genau so etwas habe ich gesucht :smiley:

Moin,
ich habe da mal eine übersichtliche Tabelle draus gebastelt.

<?
$id_alexa = 0;
$instanceList = IPS_GetInstanceList();
foreach ($instanceList as $id) {
    $instance = IPS_GetInstance($id);
    if ($instance['ModuleInfo']['ModuleName'] == 'Alexa'){
        $id_alexa = $instance['InstanceID'];
        break;
    }
}
if ($id_alexa == 0) return;
$list = [];
$properties = json_decode(IPS_GetConfiguration($id_alexa), true);
foreach($properties as $name => $value) {
    if (substr($name, 0, 6) == "Device") {
        $devices = json_decode($value, true);
        foreach($devices as $device) {
            switch ($name){
                case 'DeviceSimpleScene':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["SceneControllerSimpleID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceDeactivatableScene':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["SceneControllerDeactivatableActivateID"],
                        "ID2" => $device["SceneControllerDeactivatableDeactivateID"],
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceGenericSwitch':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["PowerControllerID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceLightSwitch':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["PowerControllerID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceLightDimmer':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["BrightnessControllerID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceLightExpert':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["PowerControllerID"],
                        "ID2" => $device["BrightnessOnlyControllerID"],
                        "ID3" => $device["ColorOnlyControllerID"],
                        "ID4" => $device["ColorTemperatureOnlyControllerID"],
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceLock':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["LockControllerID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceShutter':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["RangeControllerShutterID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceSpeaker':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["SpeakerID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceTemperatureSensor':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["TemperatureSensorID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceGenericSlider':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["PercentageControllerID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceLightColor':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["ColorControllerID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceMediaPlayer':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["PowerControllerID"],
                        "ID2" => $device["SpeakerMuteableVolumeID"],
                        "ID3" => $device["SpeakerMuteableMuteID"],
                        "ID4" => $device["PlaybackControllerID"],
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceSpeakerMuteable':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["SpeakerMuteableVolumeID"],
                        "ID2" => $device["SpeakerMuteableMuteID"],
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceTelevision':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["PowerControllerID"],
                        "ID2" => $device["ChannelControllerID"],
                        "ID3" => $device["SpeakerMuteableVolumeID"],
                        "ID4" => $device["SpeakerMuteableMuteID"],
                        "ID5" => $device["InputControllerID"]
                    ];
                    break;
                  case 'DeviceThermostat':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["ThermostatControllerID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
              default:
                        var_dump($name);
                        var_dump($device);
                    break;
            }
        }
    }
}

$UpdateList = [];
$maxName = 0;
$maxType = 0;
$index = 0;
foreach($list as $item) {
    $UpdateList[$index]['Name'] = mb_str_pad($item['Name'], $maxName, " ") ;
    $UpdateList[$index]['Type'] = mb_str_pad($item['Type'], $maxType, " ");
    $UpdateList[$index]['ID1'] = $item['ID1'];
    $UpdateList[$index]['ID2'] = $item['ID2'];
    $UpdateList[$index]['ID3'] = $item['ID3'];
    $UpdateList[$index]['ID4'] = $item['ID4'];
    $UpdateList[$index]['ID5'] = $item['ID5'];
    $index++;
}

$Type  = array_column($UpdateList, 'Type');
$Name = array_column($UpdateList, 'Name');
array_multisort($Type, SORT_ASC, $Name, SORT_ASC, $UpdateList);

// HTML ereugen
$HintergrundFarbcode = '000000';
$TextFarbcode = 'FFFFFF';
$TextFarbcodeNOK = 'FF0000';
$TextSize = 14;
$TextSizeTitle = $TextSize + 2;
$TextWeight = 'normal';
$Textausrichtung = 'text-align:left;';

$HTML_CSS_Style = '<style type="text/css">
.bt {border-collapse: separate;border-spacing: 2px;}
.bt td {font-family:Arial, sans-serif;font-size:' . $TextSize . 'px;color:#' . $TextFarbcode . ';' . $Textausrichtung . 'padding:1px 10px;border-style:solid;border-width:1px;overfNOK:hidden;word-break:normal;}
.bt th {font-family:Arial, sans-serif;font-size:' . $TextSize . 'px;color:#' . $TextFarbcode . ';' . $Textausrichtung . 'padding:1px 10px;border-style:solid;border-width:1px;overfNOK:hidden;word-break:normal;}
.bt .tb-title {font-size:' . $TextSizeTitle . 'px;padding:2mm;' . $Textausrichtung . 'background-color:#' . $HintergrundFarbcode . ';color:#' . $TextFarbcode . '}
.bt .tb-content {font-size:' . $TextSize . 'px;font-weight: ' . $TextWeight . ';padding:1mm;' . $Textausrichtung . 'background-color:#' . $HintergrundFarbcode . ';color:#' . $TextFarbcode . '}
.bt .tb-contentNOK {font-size:' . $TextSize . 'px;font-weight: ' . $TextWeight . ';padding:1mm;' . $Textausrichtung . 'background-color:#' . $HintergrundFarbcode . ';color:#' . $TextFarbcodeNOK . '}
</style>';

$HTML = '<html>' . $HTML_CSS_Style;
$HTML .= '<table class="bt"';

$Titel = array();
$Titel = array('Nummer');
$Titel[] = 'Name';
$Titel[] = 'Typ';
$Titel[] = 'ID1';
$Titel[] = 'ID2';
$Titel[] = 'ID3';
$Titel[] = 'ID4';
$Titel[] = 'ID5';

$HTML .= '<tr>';

$colspan = 1;
foreach ($Titel as $TitelEntry) {
    $HTML .= '<th class="tb-title"><b>' . $TitelEntry . '</b></th>';
    $colspan++;
}
$HTML .= '</tr><tr>';

$index = 0;
foreach ($UpdateList as $Update) {
    $index++;
    $HTML .= '<th class="tb-content">' . $index . '</th>';
    $HTML .= '<th class="tb-content">' . $Update['Name'] . '</th>';
    $HTML .= '<th class="tb-content">' . $Update['Type'] . '</th>';
    if ($Update['ID1'] > 0){
        if (IPS_ObjectExists($Update['ID1'])){
            $IDName = IPS_GetName($Update['ID1']);
            $HTML .= '<th class="tb-content">' . $Update['ID1'] . ':' . $IDName . '</th>';
        }
        else{
            $HTML .= '<th class="tb-contentNOK">' . $Update['ID1'] . ':</th>';
        }
    }
    else{
        $HTML .= '<th class="tb-contentL"> </th>';

    }
    if ($Update['ID2'] > 0){
        if (IPS_ObjectExists($Update['ID2'])){
            $IDName = IPS_GetName($Update['ID2']);
            $HTML .= '<th class="tb-content">' . $Update['ID2'] . ':' . $IDName . '</th>';
        }
        else{
            $HTML .= '<th class="tb-contentNOK">' . $Update['ID2'] . ':</th>';
        }
    }
    else{
        $HTML .= '<th class="tb-contentL"> </th>';

    }
    if ($Update['ID3'] > 0){
        if (IPS_ObjectExists($Update['ID3'])){
            $IDName = IPS_GetName($Update['ID3']);
            $HTML .= '<th class="tb-content">' . $Update['ID3'] . ':' . $IDName . '</th>';
        }
        else{
            $HTML .= '<th class="tb-contentNOK">' . $Update['ID3'] . ':</th>';
        }
    }
    else{
        $HTML .= '<th class="tb-contentL"> </th>';

    }
    if ($Update['ID4'] > 0){
        if (IPS_ObjectExists($Update['ID4'])){
            $IDName = IPS_GetName($Update['ID4']);
            $HTML .= '<th class="tb-content">' . $Update['ID4'] . ':' . $IDName . '</th>';
        }
        else{
            $HTML .= '<th class="tb-contentNOK">' . $Update['ID4'] . ':</th>';
        }
    }
    else{
        $HTML .= '<th class="tb-contentL"> </th>';

    }
    if ($Update['ID5'] > 0){
        if (IPS_ObjectExists($Update['ID5'])){
            $IDName = IPS_GetName($Update['ID5']);
            $HTML .= '<th class="tb-content">' . $Update['ID5'] . ':' . $IDName . '</th>';
        }
        else{
            $HTML .= '<th class="tb-contentNOK">' . $Update['ID5'] . ':</th>';
        }
    }
    else{
        $HTML .= '<th class="tb-contentL"> </th>';

    }
    $HTML .= '</tr>';
}
$HTML .= '</table></html>';
$vid = @IPS_GetVariableIDByName("Alexa Kommandos", $_IPS['SELF']);

if ($vid == false){
    $vid = IPS_CreateVariable(3);
    IPS_SetParent($vid, $_IPS['SELF']);             //Variable zuordnen
    IPS_SetName($vid, "Alexa Kommandos");
    IPS_SetVariableCustomProfile($vid, "~HTMLBox");
}

SetValue( $vid, $HTML);

function mb_str_pad( $input, $pad_length, $pad_string = ' ', $pad_type = STR_PAD_RIGHT)
{
    $diff = strlen( $input ) - mb_strlen( $input );
    return str_pad( $input, $pad_length + $diff, $pad_string, $pad_type );
}
?>

Das Script erstellt eine Variable als Kind des Scriptes das man nur noch in die Visualisierung verlinken muss.

Ralf

Vielen Dank Ralf!

Ich habe das Script gleich ausprobiert und es funktioniert bestens.
Viel besser als meine Idee einen Zettel auszudrucken. Jetzt habe ich die Befehle gleich im Webfront :smiley:

Nochmals vielen Dank und viele Grüße
Torsten

Hi,
ich wollte auch schon immer mal eine Liste meiner Kommandos haben. Mit paresy’s Script ist mir auch aufgefallen das mittlerweile ein paar Variablen und/oder Scripte fehlten. In meinem Script sollte in diesem Fall die ID rot eingefärbt sein. Ich hatte leider alle meine Fehler korrigiert bevor ich das Script geschrieben hatte.

Edit: Script oben erneut geändert: Fehlende Geräte hinzugefügt und rot bei fehlenden IDs geht jetzt.

Ralf

Vielen Dank für das Update!

Ich hatte auch erst alles aufgeräumt, bevor ich mir Gedanken über die Dokumentation gemacht habe. Insoweit funktioniert im Moment alles. Ich lasse das Script jetzt aber täglich laufen…

Hallo,
kann man eigentlich zwei Amazon Alexa Konten mit IP-Symcon verbinden??
mein Sohn hat eine Kleine eigene Wohnung im Haus und seine eigene Alexa … fände es Sinnvoll das ganze dann zu trennen, ist das Möglich?? Oder hat jemand ein Vorschlag für mich

Danke
Roland

Leider nein. Pro Lizenz (bzw. Connect Dienst) geht nur eine Anmeldung.

paresy

Danke für die schnelle Info…
Werde das dann irgendwie organisieren müssen

Roland

Ein Beitrag wurde in ein existierendes Thema verschoben: Amazon Echo Remote Control

Hi,
die Szenen in der Alexa-Integration benutzen jetzt auch Aktionen und ich musste die Tabelle aller Alexa Kommandos etwas anpassen. Hier die geänderte Version:

<?
$id_alexa = 0;
$instanceList = IPS_GetInstanceList();
foreach ($instanceList as $id) {
    $instance = IPS_GetInstance($id);
    if ($instance['ModuleInfo']['ModuleName'] == 'Alexa'){
        $id_alexa = $instance['InstanceID'];
        break;
    }
}
if ($id_alexa == 0) return;
$list = [];
$properties = json_decode(IPS_GetConfiguration($id_alexa), true);
foreach($properties as $name => $value) {
    if (substr($name, 0, 6) == "Device") {
        $devices = json_decode($value, true);
        foreach($devices as $device) {
            switch ($name){
                case 'DeviceSimpleScene':
                    $SimpleScene = $device["SceneControllerSimpleAction"];
                    $SimpleAction = json_decode($SimpleScene, true);
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $SimpleAction["parameters"]["TARGET"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceDeactivatableScene':
                    $SceneActivate = json_decode($device["SceneControllerDeactivatableActivateAction"], true);
                    $SceneDeActivate = json_decode($device["SceneControllerDeactivatableDeactivateAction"], true);
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $SceneActivate["parameters"]["TARGET"],
                        "ID2" => $SceneDeActivate["parameters"]["TARGET"],
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
//                    print_r($device);
                    break;
                case 'DeviceGenericSwitch':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["PowerControllerID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceLightSwitch':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["PowerControllerID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceLightDimmer':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["BrightnessControllerID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceLightExpert':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["PowerControllerID"],
                        "ID2" => $device["BrightnessOnlyControllerID"],
                        "ID3" => $device["ColorOnlyControllerID"],
                        "ID4" => $device["ColorTemperatureOnlyControllerID"],
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceLock':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["LockControllerID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceShutter':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["RangeControllerShutterID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceSpeaker':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["SpeakerID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceTemperatureSensor':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["TemperatureSensorID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceGenericSlider':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["PercentageControllerID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceLightColor':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["ColorControllerID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceMediaPlayer':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["PowerControllerID"],
                        "ID2" => $device["SpeakerMuteableVolumeID"],
                        "ID3" => $device["SpeakerMuteableMuteID"],
                        "ID4" => $device["PlaybackControllerID"],
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceSpeakerMuteable':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["SpeakerMuteableVolumeID"],
                        "ID2" => $device["SpeakerMuteableMuteID"],
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
                case 'DeviceTelevision':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["PowerControllerID"],
                        "ID2" => $device["ChannelControllerID"],
                        "ID3" => $device["SpeakerMuteableVolumeID"],
                        "ID4" => $device["SpeakerMuteableMuteID"],
                        "ID5" => $device["InputControllerID"]
                    ];
                    break;
                  case 'DeviceThermostat':
                    $list[] = [
                        "Name" => $device["Name"],
                        "Type" => substr($name, 6),
                        "ID1" => $device["ThermostatControllerID"],
                        "ID2" => 0,
                        "ID3" => 0,
                        "ID4" => 0,
                        "ID5" => 0
                    ];
                    break;
              default:
                        var_dump($name);
                        var_dump($device);
                    break;
            }
        }
    }
}

$UpdateList = [];
$maxName = 0;
$maxType = 0;
$index = 0;
foreach($list as $item) {
    $UpdateList[$index]['Name'] = mb_str_pad($item['Name'], $maxName, " ") ;
    $UpdateList[$index]['Type'] = mb_str_pad($item['Type'], $maxType, " ");
    $UpdateList[$index]['ID1'] = $item['ID1'];
    $UpdateList[$index]['ID2'] = $item['ID2'];
    $UpdateList[$index]['ID3'] = $item['ID3'];
    $UpdateList[$index]['ID4'] = $item['ID4'];
    $UpdateList[$index]['ID5'] = $item['ID5'];
    $index++;
}

$Type  = array_column($UpdateList, 'Type');
$Name = array_column($UpdateList, 'Name');
array_multisort($Type, SORT_ASC, $Name, SORT_ASC, $UpdateList);

// HTML ereugen
$HintergrundFarbcode = '000000';
$TextFarbcode = 'FFFFFF';
$TextFarbcodeNOK = 'FF0000';
$TextSize = 14;
$TextSizeTitle = $TextSize + 2;
$TextWeight = 'normal';
$Textausrichtung = 'text-align:left;';

$HTML_CSS_Style = '<style type="text/css">
.bt {border-collapse: separate;border-spacing: 2px;}
.bt td {font-family:Arial, sans-serif;font-size:' . $TextSize . 'px;color:#' . $TextFarbcode . ';' . $Textausrichtung . 'padding:1px 10px;border-style:solid;border-width:1px;overfNOK:hidden;word-break:normal;}
.bt th {font-family:Arial, sans-serif;font-size:' . $TextSize . 'px;color:#' . $TextFarbcode . ';' . $Textausrichtung . 'padding:1px 10px;border-style:solid;border-width:1px;overfNOK:hidden;word-break:normal;}
.bt .tb-title {font-size:' . $TextSizeTitle . 'px;padding:2mm;' . $Textausrichtung . 'background-color:#' . $HintergrundFarbcode . ';color:#' . $TextFarbcode . '}
.bt .tb-content {font-size:' . $TextSize . 'px;font-weight: ' . $TextWeight . ';padding:1mm;' . $Textausrichtung . 'background-color:#' . $HintergrundFarbcode . ';color:#' . $TextFarbcode . '}
.bt .tb-contentNOK {font-size:' . $TextSize . 'px;font-weight: ' . $TextWeight . ';padding:1mm;' . $Textausrichtung . 'background-color:#' . $HintergrundFarbcode . ';color:#' . $TextFarbcodeNOK . '}
</style>';

$HTML = '<html>' . $HTML_CSS_Style;
$HTML .= '<table class="bt"';

$Titel = array();
$Titel = array('Nummer');
$Titel[] = 'Name';
$Titel[] = 'Typ';
$Titel[] = 'ID1';
$Titel[] = 'ID2';
$Titel[] = 'ID3';
$Titel[] = 'ID4';
$Titel[] = 'ID5';

$HTML .= '<tr>';

$colspan = 1;
foreach ($Titel as $TitelEntry) {
    $HTML .= '<th class="tb-title"><b>' . $TitelEntry . '</b></th>';
    $colspan++;
}
$HTML .= '</tr><tr>';

$index = 0;
foreach ($UpdateList as $Update) {
    $index++;
    $HTML .= '<th class="tb-content">' . $index . '</th>';
    $HTML .= '<th class="tb-content">' . $Update['Name'] . '</th>';
    $HTML .= '<th class="tb-content">' . $Update['Type'] . '</th>';
    if ($Update['ID1'] > 0){
        if (IPS_ObjectExists($Update['ID1'])){
            $IDName = IPS_GetName($Update['ID1']);
            $HTML .= '<th class="tb-content">' . $Update['ID1'] . ':' . $IDName . '</th>';
        }
        else{
            $HTML .= '<th class="tb-contentNOK">' . $Update['ID1'] . ':</th>';
        }
    }
    else{
        $HTML .= '<th class="tb-contentL"> </th>';

    }
    if ($Update['ID2'] > 0){
        if (IPS_ObjectExists($Update['ID2'])){
            $IDName = IPS_GetName($Update['ID2']);
            $HTML .= '<th class="tb-content">' . $Update['ID2'] . ':' . $IDName . '</th>';
        }
        else{
            $HTML .= '<th class="tb-contentNOK">' . $Update['ID2'] . ':</th>';
        }
    }
    else{
        $HTML .= '<th class="tb-contentL"> </th>';

    }
    if ($Update['ID3'] > 0){
        if (IPS_ObjectExists($Update['ID3'])){
            $IDName = IPS_GetName($Update['ID3']);
            $HTML .= '<th class="tb-content">' . $Update['ID3'] . ':' . $IDName . '</th>';
        }
        else{
            $HTML .= '<th class="tb-contentNOK">' . $Update['ID3'] . ':</th>';
        }
    }
    else{
        $HTML .= '<th class="tb-contentL"> </th>';

    }
    if ($Update['ID4'] > 0){
        if (IPS_ObjectExists($Update['ID4'])){
            $IDName = IPS_GetName($Update['ID4']);
            $HTML .= '<th class="tb-content">' . $Update['ID4'] . ':' . $IDName . '</th>';
        }
        else{
            $HTML .= '<th class="tb-contentNOK">' . $Update['ID4'] . ':</th>';
        }
    }
    else{
        $HTML .= '<th class="tb-contentL"> </th>';

    }
    if ($Update['ID5'] > 0){
        if (IPS_ObjectExists($Update['ID5'])){
            $IDName = IPS_GetName($Update['ID5']);
            $HTML .= '<th class="tb-content">' . $Update['ID5'] . ':' . $IDName . '</th>';
        }
        else{
            $HTML .= '<th class="tb-contentNOK">' . $Update['ID5'] . ':</th>';
        }
    }
    else{
        $HTML .= '<th class="tb-contentL"> </th>';

    }
    $HTML .= '</tr>';
}
$HTML .= '</table></html>';
$vid = @IPS_GetVariableIDByName("Alexa Kommandos", $_IPS['SELF']);

if ($vid == false){
    $vid = IPS_CreateVariable(3);
    IPS_SetParent($vid, $_IPS['SELF']);             //Variable zuordnen
    IPS_SetName($vid, "Alexa Kommandos");
    IPS_SetVariableCustomProfile($vid, "~HTMLBox");
}

SetValue( $vid, $HTML);

function mb_str_pad( $input, $pad_length, $pad_string = ' ', $pad_type = STR_PAD_RIGHT)
{
    $diff = strlen( $input ) - mb_strlen( $input );
    return str_pad( $input, $pad_length + $diff, $pad_string, $pad_type );
}
?>

Falls es noch weitere Änderungen gab bitte melden.

Ralf

Ich habe festgestellt, dass seit der Umstellung der Szenen auf Aktionen standardmäßig kein $_IPS[‚SENDER‘] mehr gesetzt wird, wenn ich die Aktion „Automation ausführen“ nutze. Ist das beabsichtigt und ich muss jetzt immer die erweiterte Aktion nutzen und den SENDER manuell auf „VoiceControl“ setzen?

Gruß
Slummi

EDIT:
Oder ist die Aktion generisch und wird nicht nur von diesem Modul verwendet? Dann wäre es klar, dass der SENDER nicht gesetzt werden kann. Dann sollte es aber denke ich in der Doku erwähnt werden, dass der SENDER nicht in jedem Fall „VoiceControl“ ist, wenn eine Aktion über das Alexa-Modul ausgeführt wird.

Oh ja, da muss ich die Dokumentation nochmal auf die Aktionen anpassen.

Da die Aktionen generisch sind, gibt es den SENDER VoiceControl nicht mehr. Deswegen werden alte Skriptaufrufe auch auf „Führe Automation mit Parametern aus“ konvertiert, in welcher dann SENDER und VALUE gesetzt sind.

1 „Gefällt mir“