Autor Thema: KNX Squeezebox Glastaster  (Gelesen 258 mal)

Offline M4ce

  • New Member
  • *
  • Beiträge: 5
KNX Squeezebox Glastaster
« am: 23 Mai 2019, 21:29:12 »
Guten Abend euch allen,

in letzter Zeit habe ich mich sehr viel in FHEM eingelesen und auch einiges gelernt. Für die vielen Beiträge hier möchte ich mich schon vorher bedanken. Ohne diese wäre ich nie und nimmer so weit wie jetzt. FHEM läuft zwar nicht out of the box, aber dafür kann man so ziemlich alles einbinden :-)
Jetzt bin ich allerdings an einem Punkt angelangt, wobei ich leider selber ein Beitrag eröffnen muss (ein weiter wird wohl folgen -> FTUI).

KNX läuft sehr gut, ich kann meine Jallousien und Lichter steuern.
Wo es jetzt allerdings hapert ist die Kontrolle von Squeezebox.
Squeezebox selber ist installiert, läuft soweit. Kann es auch auf dem Dashboard steuern.
Aber wie bekomme ich jetzt geregelt, dass ich Squeezebox über mein Glastaster 2 (MDT KNX) steuern kann und danach (wenn möglich) den Text angezeit bekomme?

Die Taster auf dem Glastaster habe ich in ETS als Zwei-Tastenfunktion und "Schalten" angelegt. Ist das richtig? Die Gruppenadresse ist dafür 4/1/0
Der Status hat die GA 4/1/1.

Der SB_PLAYER heißt SqueezeboxWohnzimmer

Aber wie geht es jetzt weiter? Habe schon versucht ein Device mit define Radio.Essen KNX 4/1/1:dpt3  4/1/0:dpt1 angelegt. War der Schritt richtig? Wenn ja, wie geht es ab da weiter?

Wäre sehr dankbar für eure Hilfe.

Offline obi

  • New Member
  • *
  • Beiträge: 40
Antw:KNX Squeezebox Glastaster
« Antwort #1 am: 31 Mai 2019, 10:13:20 »
Hallo M4ce,

ich habe bei mir mit viel Aufwand ein DOIF erstellt (ist mitlerweile für einen Anfänger auch etwas unübersichtlich/komplex), welches die Umsetzung KNX<->Squeezebox erledigt. Ich kann über den Glastaster 2 Smart den Interpret, Titel, Album anzeigen. Den Player an/aus schalten, Lautstärke ändern, Playlists und Favoriten umschalten und zwischen Tracks/Playlists/Favoriten vor und zurück wechseln. Das alles mit nur 4 Tasten am Glastaster (eigene Seite nur für Media). Ich habe die Tasten mehrfachbelegt für verschiedene Funktionen. Ich werde das mal als Anleitung zusammrenschreiben und dann hier posten.

Hier ein kleines Video welches den Funktionsumfang der Steuerung zeigt:
https://www.youtube.com/watch?v=FddV7C0YV0w&feature=youtu.be

Im Anhang ist eine genauere Anleitung
Hier den Code für RAW-Import

KNX - Device:
defmod KNX_MM_O07_01 KNX 25/5/20:dpt1.001:E-A:nosuffix\
25/5/21:dpt1.001:RM_E-A:nosuffix\
25/5/22:dpt1.001:Power_E-A:nosuffix\
25/5/23:dpt1.001:RM_Power_E-A:nosuffix\
25/5/24:dpt1.001:RM_Startvorgang:nosuffix\
25/5/25:dpt1.001:Play-Pause:nosuffix\
25/5/26:dpt1.001:RM_Play-Pause:nosuffix\
25/5/27:dpt1.001:Stop:nosuffix\
25/5/28:dpt1.001:Volume_-:nosuffix\
25/5/29:dpt1.001:Volume_+:nosuffix\
25/5/30:dpt1.001:Volume_-+:nosuffix\
25/5/31:dpt3:Volume_R:nosuffix\
25/5/32:dpt5.001:Volume_A:nosuffix\
25/5/33:dpt5.001:RM_Volume:nosuffix\
25/5/34:dpt1.001:Track_Prev:nosuffix\
25/5/35:dpt1.001:Track_Next:nosuffix\
25/5/36:dpt1.001:Track_Prev-Next:nosuffix\
25/5/37:dpt1.001:Playlist_Prev:nosuffix\
25/5/38:dpt1.001:Playlist_Next:nosuffix\
25/5/39:dpt1.001:Playlist_Prev-Next:nosuffix\
25/5/40:dpt1.001:Favorites_Prev:nosuffix\
25/5/41:dpt1.001:Favorites_Next:nosuffix\
25/5/42:dpt1.001:Favorites_Prev-Next:nosuffix\
25/5/43:dpt16:RM_Text1:nosuffix\
25/5/44:dpt16:RM_Text2:nosuffix\
25/5/45:dpt16:RM_Text3:nosuffix\
25/5/46:dpt1.001:Menue:nosuffix\
25/5/47:dpt1.001:Display_E-A:nosuffix\
25/5/48:dpt5.001:Display_Dim:nosuffix\
25/5/49:dpt1.001:Stromversorgung_E-A:nosuffix\
25/5/50:dpt1.001:Stromversorgung_RM_E-A:nosuffix\
25/5/51:dpt13:Stromversorgung_RM_Betriebsstunden:nosuffix\
25/5/52:dpt1.003:Stromversorgung_Betriebsstunden_zuruecksetzen:nosuffix\
25/5/53:dpt14.056:Stromversorgung_RM_Leistungswert:nosuffix\
25/5/54:dpt1.003:Stromversorgung_Stromzaehler_zuruecksetzen:nosuffix\
25/5/55:dpt13.010:Stromversorgung_RM_Theoretische_Wattstunde:nosuffix\
25/5/56:dpt1.003:Stromversorgung_Sperre:nosuffix\
25/5/57:dpt1.005:Stromversorgung_RM_Fehler:nosuffix\
25/5/58:dpt1.011:Stromversorgung_RM_Lastueber-Unterschreitung:nosuffix\
25/5/59:dpt1.001:Global:nosuffix\
25/5/60:dpt1.001:Global_Umschalten:nosuffix\
25/5/61:dpt1.001:Modus:nosuffix\
25/5/62:dpt1.001:Modus_Umschalten:nosuffix
attr KNX_MM_O07_01 IODev SY_KNX
attr KNX_MM_O07_01 answerReading 1
attr KNX_MM_O07_01 devStateIcon .*:fts_shutter_1w_0
attr KNX_MM_O07_01 room KNX->Multimedia
attr KNX_MM_O07_01 webCmd :


Funktionen in myUtils:
##Text Media
sub text_media
{
my ($text1, $text2, $text3, $columns, $count) = @_;
if(!defined($text1)) { $text1 = ''; }
if(!defined($text2)) { $text2 = ''; }
if(!defined($text3)) { $text3 = ''; }
if(!defined($columns)) { $columns = '14'; }
if(!defined($count)) { $count = '2'; }

my @return;

$text1 = text_replace_special_character($text1);
$text2 = text_replace_special_character($text2);
$text3 = text_replace_special_character($text3);

if($text1 eq '' or $text1 eq '?' or $text1 eq 'Kein Artist' or $text1 eq 'Kein Interpret' or $text1 eq 'Kein Künstler') { $text1 = '-'; }
if($text2 eq '' or $text2 eq '?' or $text2 eq 'Kein Titel') { $text2 = '-'; }
if($text3 eq '') { $text3 = '-'; }

if($text1 ne '-' and $text2 ne '-')
{
@return = ($text1, $text2);

}
elsif($text1 eq '-' and $text2 eq '-')
{
@return = text_wrap($text3, $columns, $count);

}
elsif($text1 eq '-')
{
@return = text_wrap($text2, $columns, $count);
}
elsif($text2 eq '-')
{
@return = text_wrap($text1, $columns, $count);
}

return @return;
}

##Text Umbruch
sub text_wrap
{
my ($text, $columns, $count) = @_;
if(!defined($columns)) { $columns = '2048'; }
if($columns eq '') { $columns = '2048'; }
if(!defined($count)) { $count = '1'; }
if($count eq '') { $count = '1'; }

my @return;
my $index = 0;
$count--;

if(length($text) > $columns)
{
$Text::Wrap::columns=$columns;
$text = wrap('','', $text);
my @text_parts = split(/\n/, $text);

foreach(@text_parts)
{
if($index < $count)
{
$return[$index] = $_;
$index++;
}
else
{
if($return[$index])
{
$return[$index] = $return[$index].' '.$_;
}
else
{
$return[$index] = $_;
}
}
}
}
else
{
$return[$index] = $text;
}

for($index=0;$index<=$count;$index++)
{
if(!$return[$index])
{
$return[$index] = '-';
}
}

return @return;
}

##Text/Sonderzeichen für KNX Ausgabe ersetzen
sub text_replace_special_character
{
my ($text, $allow) = @_;
if(!defined($allow)) { $allow = "[^A-Za-z0-9äÄöÖüÜß \=\!\?\'\§\$\%\&\/\(\)\[\]]"; }
$text =~ s/$allow//g;
return $text;
}

SB_PLAYER – Device:
attr MM_O07_01 userattr auto_off auto_play auto_power_off auto_power_on boot_time boot_time_blocking
attr MM_O07_01 auto_off off
attr MM_O07_01 auto_play on
attr MM_O07_01 auto_power_off on
attr MM_O07_01 auto_power_on on
attr MM_O07_01 boot_time 10
attr MM_O07_01 boot_time_blocking 20
attr MM_O07_01 userReadings volume_last:volume.*\
{\
if(ReadingsVal($name,'volume','0') ne 0 and ReadingsVal($name,'volume','0') ne 'muted')\
{\
return ReadingsVal($name,'volume','0');;\
}\
else\
{\
return ReadingsVal($name,'volume_last','0');;\
}\
},\
\
currentFilename:currentMedia.*\
{\
my $return = ReadingsVal($name,'currentMedia','');;\
$return =~ s/.*\/(.*)\..*/$1/g;;\
$return =~ s/%20/ /g;;\
return $return;;\
},\
\
currentFoldername:currentMedia.*\
{\
my $return = ReadingsVal($name,'currentMedia','');;\
$return =~ s/.*\/(.*)\/.*/$1/g;;\
$return =~ s/%20/ /g;;\
return $return;;\
},\
\
FAVSTR_DATA-LIST:power.*\
{\
my $string_favorites = ReadingsVal($name,'FAVSTR_DATA-LIST','');;\
my @array_favorites = split(',', InternalVal($name,'FAVSTR',''));;\
@array_favorites = sort { lc($a) cmp lc($b) } @array_favorites;;\
@array_favorites = grep(!/!/, @array_favorites);;\
\
if(InternalVal($name,'FAVSTR','') !~ /not yet defined/)\
{\
return(join(':', @array_favorites));;\
}\
else\
{\
return($string_favorites);;\
}\
},\
\
PLAYLIST_DATA-LIST:power.*\
{\
my $string_playlists = ReadingsVal($name,'PLAYLIST_DATA-LIST','');;\
my @array_playlists = split(',', InternalVal($name,'SERVERPLAYLISTS',''));;\
@array_playlists = sort { lc($a) cmp lc($b) } @array_playlists;;\
@array_playlists = grep(!/!/, @array_playlists);;\
\
if(InternalVal($name,'SERVERPLAYLISTS','') !~ /not yet defined/)\
{\
return(join(':', @array_playlists));;\
}\
else\
{\
return($string_playlists);;\
}\
}


DOIF:
defmod DI_MM_O07_01 DOIF ##Funktionen\
subs\
{\
sub $SELF_startvorgang_finish\
{\
fhem_set('KNX_MM_O07_01 RM_Startvorgang off');;\
\
if(ReadingsVal('MM_O07_01','playStatus','') ne 'playing' and AttrVal('MM_O07_01','auto_play','') eq 'on')\
{\
fhem_set('MM_O07_01 play');;\
fhem_set('MM_O07_01 next');;\
}\
\
set_Exec('$SELF_startvorgang_check', 5, '$SELF_startvorgang_check');;\
\
my @array = ::text_media(ReadingsVal('MM_O07_01','currentArtist',''), ReadingsVal('MM_O07_01','currentTitle',''), ReadingsVal('MM_O07_01','currentFilename',''));;\
fhem_set('KNX_MM_O07_01 RM_Text1 '.$array[0]);;\
fhem_set('KNX_MM_O07_01 RM_Text2 '.$array[1]);;\
\
if(ReadingsVal('MM_O07_01','currentPlaylistName','') eq '-')\
{\
fhem_set('KNX_MM_O07_01 RM_Text3 '.::text_replace_special_character(ReadingsVal('MM_O07_01','currentAlbum','')));;\
}\
else\
{\
fhem_set('KNX_MM_O07_01 RM_Text3 '.::text_replace_special_character(ReadingsVal('MM_O07_01','currentPlaylistName','')));;\
}\
}\
\
\
sub $SELF_startvorgang_check\
{\
if(ReadingsVal('MM_O07_01','volume','0') eq '0' or ReadingsVal('MM_O07_01','volume','0') eq 'muted')\
{\
fhem_set('MM_O07_01 volume '.ReadingsVal('MM_O07_01','volume_last','0'));;\
}\
}\
\
\
sub $SELF_volume\
{\
my ($type)=@_;; \
fhem_set('MM_O07_01 volume'.$type);;\
set_Exec('$SELF_volume', 1, '$SELF_volume', $type);;\
  }\
\
\
sub $SELF_display_text3\
{\
my ($text)=@_;; \
fhem_set('KNX_MM_O07_01 RM_Text3 '.$text);;\
  }\
\
\
sub $SELF_display_new_track\
{\
my @array = ::text_media(ReadingsVal('MM_O07_01','currentArtist',''), ReadingsVal('MM_O07_01','currentTitle',''), ReadingsVal('MM_O07_01','currentFilename',''));;\
\
fhem_set('KNX_MM_O07_01 RM_Text3 '.$array[0]);;\
set_Exec('$SELF_1', 1, '$SELF_display_text3', $array[1]);;\
\
if(ReadingsVal('MM_O07_01','currentPlaylistName','') eq '-')\
{\
my $text = ReadingsVal('MM_O07_01','currentAlbum','');;\
if($text eq '' or $text eq 'Kein Album' or $text eq 'none') { $text = ReadingsVal('MM_O07_01','currentFoldername','');; }\
\
set_Exec('$SELF_2', 2, '$SELF_display_text3', ::text_replace_special_character($text));;\
}\
else\
{\
set_Exec('$SELF_2', 2, '$SELF_display_text3', ::text_replace_special_character(ReadingsVal('MM_O07_01','currentPlaylistName','')));;\
}\
  }\
\
\
sub $SELF_sleeptimer\
{\
fhem_set('MM_O07_01 off');;\
fhem('setreading MM_O07_01 sleeptimer 0');;\
  }\
\
\
sub $SELF_auto_off\
{\
if(ReadingsVal('MM_O07_01','playStatus','') eq 'stopped' and ReadingsVal('MM_O07_01','playlistCurrentTrack','') eq ReadingsVal('MM_O07_01','playlistTracks','') and ReadingsVal('MM_O07_01','power','') eq 'on')\
{\
fhem_set('MM_O07_01 off');;\
}\
  }\
}\
\
\
\
\
#############################################################################################################################\
##Steuerung\
\
##Sleeptimer\
{\
if([MM_O07_01:sleeptimer] eq '0' and get_Exec('$SELF_sleeptimer'))\
{\
del_Exec('$SELF_sleeptimer');;\
}\
}\
\
{\
if([MM_O07_01:sleeptimer] ne '0')\
{\
my $time = ReadingsNum('MM_O07_01','sleeptimer','0');;\
$time = $time*60;;\
set_Exec('$SELF_sleeptimer', $time, '$SELF_sleeptimer');;\
}\
}\
\
\
##Auto off\
{\
if([MM_O07_01:playStatus] eq 'stopped' and [?MM_O07_01:playlistCurrentTrack] eq [?MM_O07_01:playlistTracks] and [?MM_O07_01:power] eq 'on' and AttrVal('MM_O07_01','auto_off','') eq 'on')\
{\
set_Exec('$SELF_auto_off', 5, '$SELF_auto_off');;\
}\
}\
\
\
\
\
#############################################################################################################################\
##Anzeige - Fhem -> KNX\
\
\
##Artist/Titel aktualisieren\
{\
if(([MM_O07_01:currentArtist] or [MM_O07_01:currentTitle] or [MM_O07_01:currentFilename]) and [?MM_O07_01:power] eq 'on' and [?MM_O07_01:talkStatus] eq 'idle')\
{\
my @array = ::text_media(ReadingsVal('MM_O07_01','currentArtist',''), ReadingsVal('MM_O07_01','currentTitle',''), ReadingsVal('MM_O07_01','currentFilename',''));;\
fhem_set('KNX_MM_O07_01 RM_Text1 '.$array[0]);;\
fhem_set('KNX_MM_O07_01 RM_Text2 '.$array[1]);;\
\
if(!get_Exec('$SELF_display_new_track') and [?MM_O07_01:currentPlaylistName] eq '-')\
{\
my $text = ReadingsVal('MM_O07_01','currentAlbum','');;\
if($text eq '' or $text eq 'Kein Album' or $text eq 'none') { $text = '-';; }\
fhem_set('KNX_MM_O07_01 RM_Text3 '.::text_replace_special_character($text));;\
}\
}\
}\
\
\
##Album aktualisieren\
{\
if([MM_O07_01:currentAlbum] and !get_Exec('timer_display_new_track') and [?MM_O07_01:power] eq 'on' and [?MM_O07_01:playlists] eq '-' and [?MM_O07_01:talkStatus] eq 'idle')\
{\
my $text = ReadingsVal('MM_O07_01','currentAlbum','');;\
if($text eq '' or $text eq 'Kein Album' or $text eq 'none') { $text = ReadingsVal('MM_O07_01','currentFoldername','');; }\
if($text eq '' or $text eq 'Kein Album' or $text eq 'none') { $text = '-';; }\
fhem_set('KNX_MM_O07_01 RM_Text3 '.::text_replace_special_character($text));;\
}\
}\
\
\
##Playlist/Favoriten, Modus aktualisieren\
{\
if([MM_O07_01:currentPlaylistName] ne '-')\
{\
my $text = ReadingsVal('MM_O07_01','currentPlaylistName','');;\
if($text eq '' or $text eq 'Kein Album' or $text eq 'none') { $text = '-';; }\
fhem_set('KNX_MM_O07_01 RM_Text3 '.$text);;\
\
if(ReadingsVal('MM_O07_01','favorites','') eq '-')\
{\
fhem_set('KNX_MM_O07_01 Modus off');;\
set_Reading('playlists', ReadingsVal('MM_O07_01','playlists',''));;\
}\
else\
{\
fhem_set('KNX_MM_O07_01 Modus on');;\
set_Reading('favorites', ReadingsVal('MM_O07_01','favorites',''));;\
}\
}\
}\
\
{\
if([MM_O07_01:currentPlaylistName] eq '-')\
{\
fhem_set('KNX_MM_O07_01 Modus off');;\
}\
}\
\
\
##E-A\
{\
if([MM_O07_01:power] eq 'on' and !get_Exec('$SELF_startvorgang'))\
{\
set_Exec('$SELF_startvorgang_finish', AttrVal('MM_O07_01','boot_time','1'), '$SELF_startvorgang_finish');;\
set_Exec('$SELF_startvorgang', AttrVal('MM_O07_01','boot_time_blocking','20'), '');;\
fhem_set('KNX_MM_O07_01 RM_E-A on');;\
fhem_set('KNX_MM_O07_01 RM_Startvorgang on');;\
fhem_set('KNX_MM_O07_01 Menue on');;\
\
if(AttrVal('MM_O07_01','auto_power_on','') eq 'on')\
{\
fhem_set('KNX_MM_O07_01 Stromversorgung_E-A on');;\
}\
\
fhem('setreading MM_O07_01 talkStatus idle');;\
}\
}\
\
\
{\
if([MM_O07_01:power] eq 'off' and get_Exec('$SELF_startvorgang'))\
{\
fhem_set('MM_O07_01 on');;\
\
if([MM_O07_01:playStatus] ne 'playing' and AttrVal('MM_O07_01','auto_play','') eq 'on')\
{\
fhem_set('MM_O07_01 play');;\
fhem_set('MM_O07_01 next');;\
}\
}\
}\
\
\
{\
if([MM_O07_01:power] eq 'off' and !get_Exec('$SELF_startvorgang'))\
{\
fhem_set('KNX_MM_O07_01 RM_E-A off');;\
fhem_set('KNX_MM_O07_01 RM_Startvorgang off');;\
fhem_set('KNX_MM_O07_01 Menue off');;\
fhem_set('DI_RC_000_01 execNow on');; ##Anzeige der Raumcontroller aktualisieren\
\
if(AttrVal('MM_O07_01','auto_power_off','') eq 'on')\
{\
fhem_set('KNX_MM_O07_01 Stromversorgung_E-A off');;\
}\
}\
}\
\
\
{\
if([KNX_MM_O07_01:Stromversorgung_RM_E-A] eq 'on' and !get_Exec('$SELF_startvorgang'))\
{\
set_Exec('$SELF_startvorgang', AttrVal('MM_O07_01','boot_time_blocking','20'), '');;\
}\
}\
\
\
##Volume\
{\
if([MM_O07_01:volume])\
{\
fhem_set('KNX_MM_O07_01 RM_Volume '.ReadingsVal('MM_O07_01','volume',''));;\
}\
}\
\
\
\
\
#############################################################################################################################\
##Steuerung - KNX -> FHEM\
\
\
##Volume\
{\
if([KNX_MM_O07_01:Volume_R] eq '100' and [?MM_O07_01:power] eq 'on' and [?KNX_MM_O07_01:Global] eq 'off')\
{\
set_Exec('$SELF_volume', 0, '$SELF_volume', 'Up');; \
}\
}\
\
{\
if([KNX_MM_O07_01:Volume_R] eq '-100' and [?MM_O07_01:power] eq 'on' and [?KNX_MM_O07_01:Global] eq 'off')\
{\
set_Exec('$SELF_volume', 0, '$SELF_volume', 'Down');; \
}\
}\
\
{\
if([KNX_MM_O07_01:Volume_R] eq '0' and [?MM_O07_01:power] eq 'on' and [?KNX_MM_O07_01:Global] eq 'off')\
{\
del_Exec('$SELF_volume');;\
}\
}\
\
\
##E/A\
{\
if([KNX_MM_O07_01:E-A] eq 'off' and [?KNX_MM_O07_01:Global] eq 'off')\
{\
fhem_set('MM_O07_01 off');;\
}\
}\
\
{\
if([KNX_MM_O07_01:E-A] eq 'on' and [?KNX_MM_O07_01:Global] eq 'off')\
{\
fhem_set('MM_O07_01 on');;\
}\
}\
\
{\
if([KNX_MM_O07_01:Stromversorgung_RM_E-A] eq 'off' and [?MM_O07_01:power] eq 'on')\
{\
fhem_set('MM_O07_01 off');;\
}\
}\
\
\
##Track\
{\
if([KNX_MM_O07_01:Track_Prev-Next] eq 'off' and [?MM_O07_01:power] eq 'on' and ([?MM_O07_01:favorites] eq '-' or [?MM_O07_01:currentPlaylistName] eq '-' ) and [?KNX_MM_O07_01:Global] eq 'off')\
{\
fhem_set('MM_O07_01 prev');;\
set_Exec('$SELF_display_new_track', 1, '$SELF_display_new_track', '');;\
}\
}\
\
{\
if([KNX_MM_O07_01:Track_Prev-Next] eq 'on' and [?MM_O07_01:power] eq 'on' and ([?MM_O07_01:favorites] eq '-' or [?MM_O07_01:currentPlaylistName] eq '-' ) and [?KNX_MM_O07_01:Global] eq 'off')\
{\
fhem_set('MM_O07_01 next');;\
set_Exec('$SELF_display_new_track', 1, '$SELF_display_new_track', '');;\
}\
}\
\
\
##Playlist\
{\
if([KNX_MM_O07_01:Playlist_Prev-Next] eq 'off' and [?MM_O07_01:power] eq 'on' and [?KNX_MM_O07_01:Global] eq 'off')\
{\
my @array = split(':', ReadingsVal('MM_O07_01','PLAYLIST_DATA-LIST',''));;\
my $search = ReadingsVal('MM_O07_01','playlists','');;\
my $cmd = '';;\
\
use List::MoreUtils qw(firstidx);;\
my $index = firstidx { $_ eq $search } @array;;\
\
if($index-1 >= 0)\
{\
$cmd = $array[$index-1];;\
}\
else\
{\
$cmd = $array[@array-1];;\
}\
\
fhem_set('MM_O07_01 playlists '.$cmd);;\
$cmd=~ s/_/ /g;;\
$cmd=~ s/  / /g;;\
fhem_set('KNX_MM_O07_01 RM_Text3 '.$cmd);;\
}\
}\
\
{\
if([KNX_MM_O07_01:Playlist_Prev-Next] eq 'on' and [?MM_O07_01:power] eq 'on' and [?KNX_MM_O07_01:Global] eq 'off')\
{\
my @array = split(':', ReadingsVal('MM_O07_01','PLAYLIST_DATA-LIST',''));;\
my $search = ReadingsVal('MM_O07_01','playlists','');;\
my $cmd = '';;\
\
use List::MoreUtils qw(firstidx);;\
my $index = firstidx { $_ eq $search } @array;;\
\
if($index+1 < @array)\
{\
$cmd = $array[$index+1];;\
}\
else\
{\
$cmd = $array[0];;\
}\
\
fhem_set('MM_O07_01 playlists '.$cmd);;\
$cmd=~ s/_/ /g;;\
$cmd=~ s/  / /g;;\
fhem_set('KNX_MM_O07_01 RM_Text3 '.$cmd);;\
}\
}\
\
\
##Favoriten\
{\
if([KNX_MM_O07_01:Favorites_Prev] eq 'on' and [?MM_O07_01:power] eq 'on' and [?KNX_MM_O07_01:Global] eq 'off')\
{\
my @array = split(':', ReadingsVal('MM_O07_01','FAVSTR_DATA-LIST',''));;\
my $search = ReadingsVal('MM_O07_01','favorites','');;\
my $cmd = '';;\
\
use List::MoreUtils qw(firstidx);;\
my $index = firstidx { $_ eq $search } @array;;\
\
if($index-1 >= 0)\
{\
$cmd = $array[$index-1];;\
}\
else\
{\
$cmd = $array[@array-1];;\
}\
\
fhem_set('MM_O07_01 favorites '.$cmd);;\
$cmd=~ s/_/ /g;;\
$cmd=~ s/  / /g;;\
fhem_set('KNX_MM_O07_01 RM_Text3 '.$cmd);;\
}\
}\
\
{\
if([KNX_MM_O07_01:Favorites_Next] eq 'on' and [?MM_O07_01:power] eq 'on' and [?KNX_MM_O07_01:Global] eq 'off')\
{\
my @array = split(':', ReadingsVal('MM_O07_01','FAVSTR_DATA-LIST',''));;\
my $search = ReadingsVal('MM_O07_01','favorites','');;\
my $cmd = '';;\
\
use List::MoreUtils qw(firstidx);;\
my $index = firstidx { $_ eq $search } @array;;\
\
if($index+1 < @array)\
{\
$cmd = $array[$index+1];;\
}\
else\
{\
$cmd = $array[0];;\
}\
\
fhem_set('MM_O07_01 favorites '.$cmd);;\
$cmd=~ s/_/ /g;;\
$cmd=~ s/  / /g;;\
fhem_set('KNX_MM_O07_01 RM_Text3 '.$cmd);;\
}\
}\
\
\
##Favoriten\
{\
if([KNX_MM_O07_01:Track_Prev-Next] eq 'off' and [?MM_O07_01:power] eq 'on' and [?MM_O07_01:favorites] ne '-' and [?KNX_MM_O07_01:Global] eq 'off')\
{\
my @array = split(':', ReadingsVal('MM_O07_01','FAVSTR_DATA-LIST',''));;\
my $search = ReadingsVal('MM_O07_01','favorites','');;\
my $cmd = '';;\
\
use List::MoreUtils qw(firstidx);;\
my $index = firstidx { $_ eq $search } @array;;\
\
if($index-1 >= 0)\
{\
$cmd = $array[$index-1];;\
}\
else\
{\
$cmd = $array[@array-1];;\
}\
\
fhem_set('MM_O07_01 favorites '.$cmd);;\
$cmd=~ s/_/ /g;;\
$cmd=~ s/  / /g;;\
fhem_set('KNX_MM_O07_01 RM_Text3 '.$cmd);;\
}\
}\
\
{\
if([KNX_MM_O07_01:Track_Prev-Next] eq 'on' and [?MM_O07_01:power] eq 'on' and [?MM_O07_01:favorites] ne '-' and [?KNX_MM_O07_01:Global] eq 'off')\
{\
my @array = split(':', ReadingsVal('MM_O07_01','FAVSTR_DATA-LIST',''));;\
my $search = ReadingsVal('MM_O07_01','favorites','');;\
my $cmd = '';;\
\
use List::MoreUtils qw(firstidx);;\
my $index = firstidx { $_ eq $search } @array;;\
\
if($index+1 < @array)\
{\
$cmd = $array[$index+1];;\
}\
else\
{\
$cmd = $array[0];;\
}\
\
fhem_set('MM_O07_01 favorites '.$cmd);;\
$cmd=~ s/_/ /g;;\
$cmd=~ s/  / /g;;\
fhem_set('KNX_MM_O07_01 RM_Text3 '.$cmd);;\
}\
}\
\
\
##Modus\
{\
if([KNX_MM_O07_01:Modus_Umschalten] eq 'on' and [?MM_O07_01:favorites] ne '-' and [?MM_O07_01:power] eq 'on' and [?KNX_MM_O07_01:Global] eq 'off')\
{\
my @array = split(':', ReadingsVal('MM_O07_01','PLAYLIST_DATA-LIST',''));;\
my $cmd = get_Reading('playlists');;\
\
if($cmd ~~ @array )\
{\
fhem_set('MM_O07_01 playlists '.$cmd);;\
}\
else\
{\
fhem_set('MM_O07_01 playlists '.$array[0]);;\
}\
}\
}\
\
{\
if([KNX_MM_O07_01:Modus_Umschalten] eq 'on' and [?MM_O07_01:favorites] eq '-' and [?MM_O07_01:power] eq 'on' and [?KNX_MM_O07_01:Global] eq 'off')\
{\
my @array = split(':', ReadingsVal('MM_O07_01','FAVSTR_DATA-LIST',''));;\
my $cmd = get_Reading('favorites');;\
\
if($cmd ~~ @array )\
{\
fhem_set('MM_O07_01 favorites '.$cmd);;\
}\
else\
{\
fhem_set('MM_O07_01 favorites '.$array[0]);;\
}\
}\
}\
\
\
##Global\
{\
if([KNX_MM_O07_01:Global_Umschalten] eq 'on')\
{\
if([?KNX_MM_O07_01:Global] eq 'on')\
{\
fhem_set('KNX_MM_O07_01 Global off');;\
}\
else\
{\
fhem_set('KNX_MM_O07_01 Global on');;\
}\
}\
}
attr DI_MM_O07_01 devStateIcon disabled:edit_settings@red:initialize enabled:edit_settings@green:disable
attr DI_MM_O07_01 eventMap /initialize:on/disable:off/initialize:An/disable:Aus/execNow on:Ausführen
attr DI_MM_O07_01 readingList execNow favorites playlists
attr DI_MM_O07_01 setList execNow:on favorites playlists
attr DI_MM_O07_01 stateFormat {ReadingsVal($name,'mode','')}
attr DI_MM_O07_01 userReadings favorites playlists
attr DI_MM_O07_01 webCmd An:Aus:Ausführen
VG Sebastian
« Letzte Änderung: 31 Mai 2019, 17:28:42 von obi »
Gefällt mir Gefällt mir x 1 Liste anzeigen