KNX Squeezebox Glastaster

Begonnen von M4ce, 23 Mai 2019, 21:29:12

Vorheriges Thema - Nächstes Thema

M4ce

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.

obi

#1
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

JoachimJOY

Hallo zusammen,
Hallo Obi,

ich habe das ganze entsprechend mit dem PicorePlayer nachgebaut. Hierzu nutze ich den Hifiberry Amp2.
Nun habe ich beim Starten eines Liedes ca. 10 Sekunden eine Art "Soundaufbaugeräusch" bzw. knacken bis das Lied vollständig und danach auch korrekt läuft.

Habt ihr das auch bzw. gibt es hierfür eine Lösung?

Viele Grüße
Joachim

obi

Hallo Joachim,
so ein Problem sagt mir jetzt nichts. Habe mehere PiPorePlayer mit Amp2 und auch direkt an Verstärker über Klinke.
Das schöne vom Amp2 ist, dass es keinerlei Ein/Ausschalt Geräusche gibt auch beim schalten der Stromversorgung.
Ich verwende noch eine ältere Version "piCorePlayer v4.0.0 " als die aktuelle. Da ich kein Bedarf habe ein Update durchzuführen. Versuche mal die Version. Gibt es das Problem auch am Klinke-Ausgang? Eventuell mal ein anders Dateiformat der Musik testen.

Sonnst wüsste ich nichts was das sein könnte.

VG Sebastian

JoachimJOY

Hallo Obi,

ich konnte es "lösen". Ich nutze im FHEM den Befehl playlists anstatt play. Durch die Playlist startet es ohne dieses Verhalten.

Danke  und gruß Joachim

S-Desire

Hallo allerseits.
Hallo Obi, erstmal Hut ab, das sieht echt super aus.
Ich versuche derzeit genau die gleiche umsetzung und im grunde sieht es bei mir auch Gerätetechnisch genauso aus.
Ich habe mir leider erst viele systeme angeschaut, wie openHAB SmarthomeNG und bin letztendlich wieder bei FHEM gelandet.
Nun bin ich auf deine Umsetzung gestoßen.
Leider scheint es in der tat nicht ganz einfach zu sein, dies umzusetzen.
Gibt es den Inzwischen schon eine Anleitung?
Bei mir meldet er unknown IODev SY_KNX specified
ich mein gelesen zu haben das sich nur der Befehl geändert hab, wenn ich richtig liege, finde die Seite jedoch nicht.
Hoffe das es noch einer Liest, denke das Thema ist immernoch recht interessant.
Gruß
Sven

obi

Hallo Sven,

danke. Ich werde versuchen Zeitnah eine komplette Anleitung zu machen. Wie du hatte ich mir auch inzwischen mal andere Systeme angesehen und bin doch wieder bei Fhem gelandet. OpenHab usw. sagt immer, dass es viel einfacher als FHEM sei, dies kann ich aber nicht wirklich bestätigen. Die Visu mag sicherlich bei den anderen Systemen einfacher/besser sein aber die Konfiguration an sich geht auch über Text-Files usw. Da kann ich auch gleich bei FHEM bleiben. FHEM hat nun einmal die beste Integration in die verschiedenen Dienste/Systeme. Mitlerweile habe ich auch einiges selbst programmiert und erweitert. Da gibt es quasi unbegrenze Möglichkeiten

S-Desire

Danke. Ach, die Visu ist mir zur zeit nicht wichtig, die kommt später mal. Im Moment hab ich den Pi mit Hifiberry auf dem Dachboden für die Musik im Bad, wo auch gleitzeitig FHEM läuft und per Zeitschaltuhr das Nachtlicht an der Toilette an schaltet und den Präsenzmelder nachts sperrt.

Ich hatte anfangs die PDF nicht gefunden, die hab ich nun, ich muss mal schauen ob ich es zerbröselt bekomme. Da ich meinen Pi ja nicht Ein- und Ausschalten möchte, sondern lediglich die wiedergabe starten und stoppen möchte....

Da ich diese Woche noch KZH bin, werd ich etwas zeit haben und versuchen es umzusetzen. Hoffe es gelingt.

Matthias 377

Hallo

Mich interessieren diese Glastaster. Wie werden die an fhem angebunden. Benötige ich dieses ip-Modul zusätzlich ?

Danke
Gruß Matthias

S-Desire

Matthias
Zitat von: Matthias 377 am 29 März 2020, 13:54:36
Hallo

Mich interessieren diese Glastaster. Wie werden die an fhem angebunden. Benötige ich dieses ip-Modul zusätzlich ?

Danke
Gruß Matthias

Die werden entweder mittels eines IP-Interface mit Fhem, sowie die gesamte KNX Installation eingebunden oder es gibt eine Platine für den Raspberry



Obi, ich konnte erste erfolge verzeichnen,
leider habe ich wohl noch einen alten Hardware Relase vom Glasttaster, das auf der Seite bleiben geht nicht und so kleinigkeiten, die denke ich aber erstmal irrelevant sind.

Was ich Bislang hinbekommen habe:
Play & Paus  - ich hab die Stelle gefunden das er nicht den Raspi einschaltet sondern ja nur play und Pause macht.
Lautstärke steuern geht auch, jedoch keine Textrückmeldung. meine anfang ging es kurz.

Wenn ich am PC oder mit dem Handy in den Media Modus, spricht MP3 von der NAS wiedergeben gehe, steht der Text im Taster, ich kann die Tracks vor und zurückspulen.
Ich kann jedoch den Modus Media und Favoriten nicht am Taster Wechseln.
Wechsel zwischen Favoriten geht jedoch auch nicht.
Ich habe aber gesehen das der SB-Player in Fhem das auch nicht deklariert hat in der Auswahlliste.
In der DOIF steht ja der Befehl "favrites_Prev" und "Favorites_Next", den ich aber in liste bei FHEM im SB-Plyer nicht habe.
Denke es liegt viel am SB-Player. Hatte das  mal von der PDF eingefgt das ging, aber irgendwie auch nicht

Ich hab den SB-Player nach dieser ANleitung installiert gehabt. :
https://wiki.fhem.de/wiki/Squeezebox_Modul

Ich werd nochmal bei gelegenheit Tüffteln.

S-Desire

#10
Witzige, oder komische neuerungen...
Ich habe mein Fhem nun neu aufgesetzt, auf einem PI 4.... bzw. von PI 3 nach PI4 umgezogen.
Von Fhem ein Backup gemacht und auf dem neuen PI4 eingespielt...
Jetzt geht es die Favoriten zu Wechseln, sowie PLaylisten, jedoch geht es nicht mehr die Lautstärke zu verstellen.
Im Event Monitor steht nunr immer

error: eval condition: Bareword "Volume" not allowed while "strict subs" in use at (eval 350) line 1.

Irgendwie ist ein fehler in der DOIF... bin schon am suchen.
Jemand das selbe Problem oder eine Lösung?

Hier nochmal mein DOIF Bereich vom Volume:

##Volume
{
if([KNX_Badezimmer:Volume_R] eq '100' and [?Badezimmer:power] eq 'on' and [?KNX_Badezimmer:Global] eq 'off')
{
set_Exec('$SELF_volume', 0, '$SELF_volume', 'volume', 'Up');
}
}

{
if([KNX_Badezimmer:Volume_R] eq '-100' and [?Badezimmer:power] eq 'on' and [?KNX_Badezimmer:Global] eq 'off')
{
set_Exec('$SELF_volume', 0, '$SELF_volume', 'volume', 'Down');
}
}

{
if([KNX_Badezimmer:Volume_R] eq '0' and [?Badezimmer:power] eq 'on' and [?KNX_Badezimmer:Global] eq 'off')
{
del_Exec('$SELF_volume');
}
}

S-Desire

Vielen Dank geht an Damian!

Die DOIF Geschichte von Fhem wurde abgeändert, dadurch muss die DOIF auch angepast werden.
Ich hab folgende zeilen bezgl. der Lautstärke angepasst, vermutlich müssten nochmehrere Zeilen abgeändert werden, das ist aber doch anhand der Parameter und Readings für mich etwas "too much", da reichen leider meine Kentnisse nicht aus wo und wann an welcher stelle ein ' durch " ersetzt und ( ) gesetzt werden müssen und wo nicht.


sub $SELF_volume
{
my ($type)=@_;
fhem_set('Badezimmer volume' .$type);
set_Exec('$SELF_volume', 1, "$SELF_volume ('$type')");
}


#############################################################################################################################
##Steuerung - KNX -> FHEM


##Volume
{
if([KNX_Badezimmer:Volume_R] eq '100' and [?Badezimmer:power] eq 'on' and [?KNX_Badezimmer:Global] eq 'off')
{
set_Exec('$SELF_volume', 0, "$SELF_volume('Up')");
}
}

{
if([KNX_Badezimmer:Volume_R] eq '-100' and [?Badezimmer:power] eq 'on' and [?KNX_Badezimmer:Global] eq 'off')
{
set_Exec('$SELF_volume', 0, "$SELF_volume('Down')");
}
}


Das Badezimmer ist bei euch der Name eures Players in Fhem!

http://forum.fhem.de/index.php/topic,114828.0.html