FHEM - Hausautomations-Systeme > MQTT

Sonos2mqtt - vielleicht hat jemand Lust mitzumachen

<< < (222/224) > >>

TomLee:
Hallo Otto,

hab mich länger nicht mit s2m beschäftigt, ich frage mich warum das Reading favlist bei mir nach einem get Favorites nicht geschrieben wird.
Der Zeitstempel ändert sich schon, es wird aber nicht die Liste in das Reading geschrieben, einfach nix, keine Fehlermeldung im Log.


--- Code: ---99_sonos2mqttUtils.pm 24637 2021-06-15 14:19:41Z Otto123
--- Ende Code ---


--- Code: ---defmod MQTT2_sonos_Bridge MQTT2_DEVICE mqttjs_a4b34a1c
attr MQTT2_sonos_Bridge IODev MQTT2_Server
attr MQTT2_sonos_Bridge bridgeRegexp sonos/(RINCON_[A-Z0-9]+)[:/].* "$1"
attr MQTT2_sonos_Bridge devStateIcon 0:10px-kreis-rot 1:10px-kreis-gelb 2:10px-kreis-gruen
attr MQTT2_sonos_Bridge devicetopic sonos
attr MQTT2_sonos_Bridge getList Favorites:noArg Favorites {sonos2mqtt($NAME,$EVENT)}\
Reply:Favorites,Radios,Playlists Reply {sonos2mqtt($NAME,$EVENT)}
attr MQTT2_sonos_Bridge group MQTT2_Bridges
attr MQTT2_sonos_Bridge icon mqtt_bridge_2
attr MQTT2_sonos_Bridge model sonos2mqtt_bridge
attr MQTT2_sonos_Bridge readingList homeassistant/music_player/RINCON_([0-9A-Z]+)/sonos/config:.* { $TOPIC =~ m,(RINCON_[0-9A-Z]+),;; { "config_$1"=>$EVENT }}\
sonos/RINCON_([0-9A-Z]+)/Favorites:.* Favorites\
sonos/RINCON_([0-9A-Z]+)/Reply:.* Reply\
sonos/connected:.* connected\
sonos/status/[^/]+/avtransport:.* {}\
sonos/status/[^/]+/renderingcontrol:.* {}
attr MQTT2_sonos_Bridge room MQTT2_DEVICE,Media
attr MQTT2_sonos_Bridge setList CheckSubscription:noArg $DEVICETOPIC/cmd/check-subscriptions\
PauseAll:noArg $DEVICETOPIC/cmd/pauseall\
announcementall:textField {sonos2mqtt($NAME,$EVENT)}\
notifyall:textField {sonos2mqtt($NAME,$EVENT)}
attr MQTT2_sonos_Bridge stateFormat connected
attr MQTT2_sonos_Bridge userReadings favlist:Favorites.* {sonos2mqtt_ur($name,'favlist')},\
grouplist:Favorites.* {sonos2mqtt_ur($name,'grouplist')},\
favRadios:Favorites.* {\
   my $json = ReadingsVal($name,'Favorites','{"Title":"none"}');;;;\
   $json =~ s/\s/./g;;;;\
   my $werte = json2nameValue($json,'','undef','Title');;  \
   my @a;;\
   while ( my ($key, $value) = each (%$werte)) {\
   push(@a,$value);;\
   }\
   return join ',',sort @a;;}

setstate MQTT2_sonos_Bridge 0
setstate MQTT2_sonos_Bridge 2021-12-05 17:06:44 Favorites {"Result":[{"AlbumArtUri":"http://cdn-radiotime-logos.tunein.com/s296020q.png","Title":"011.FM-NonStop60s","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/26","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:s296020?sid=254&flags=8224&sn=0","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"AlbumArtUri":"http://dtu8ldmaopof3.cloudfront.net/i/https:%2F%2Fderpimagecache.s3.amazonaws.com%2Fimage%2F475_288x162_2020-01-22-10-30-00-920.png_180.jpg","Title":"1A Deutsche Hits","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/41","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:rpde_svc_475?sid=232&flags=32&sn=4","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"Title":"1LIVE diggi","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/49","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:s45087?sid=254&flags=8224&sn=0","ProtocolInfo":"x-rincon-mp3radio:*:*:*"},{"AlbumArtUri":"http://dtu8ldmaopof3.cloudfront.net/i/https:%2F%2Fderpimagecache.s3.amazonaws.com%2Fimage%2F21_288x162_2018-12-18-16-03-52-837.png_180.jpg","Title":"ANTENNE THÜRINGEN","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/50","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:rpde_svc_21?sid=232&flags=32&sn=4","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"AlbumArtUri":"http://dtu8ldmaopof3.cloudfront.net/i/https:%2F%2Fderpimagecache.s3.amazonaws.com%2Fimage%2F1944_288x162_2019-02-12-13-40-09-357.png_640.jpg","Title":"COSMO Chillout","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/30","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:rpde_svc_1944?sid=232&flags=32&sn=4","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"AlbumArtUri":"http://cdn-profiles.tunein.com/s20295/images/logoq.png","Title":"DASDING","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/34","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:s76488?sid=254&flags=8224&sn=0","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"AlbumArtUri":"http://cdn-profiles.tunein.com/s84548/images/logoq.jpg","Title":"die neue welle 101.8 (Rock)","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/39","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:s84548?sid=254&flags=8224&sn=0","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"AlbumArtUri":"http://cdn-radiotime-logos.tunein.com/s65628q.png","Title":"FM نجوم 100.6 (Arabisch)","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/29","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:s65628?sid=254&flags=8224&sn=0","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"Title":"Hitradio Ö3 99.9 (Österreichisch)","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/37","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:s8007?sid=254&flags=8224&sn=0","ProtocolInfo":"x-rincon-mp3radio:*:*:*"},{"Title":"Hörbücher","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/32","ParentId":"FV:2","TrackUri":"x-rincon-playlist:RINCON_000E58F7F67C01400#S://192.168.188.26/OwnMusic/Hörbücher","ProtocolInfo":"x-rincon-playlist:*:*:*"},{"AlbumArtUri":"http://cdn-profiles.tunein.com/s228737/images/logoq.png?t=154228","Title":"NDR 2 Hamburg","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/43","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:s228737?sid=254&flags=8224&sn=0","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"AlbumArtUri":"http://cdn-radiotime-logos.tunein.com/s97066q.png","Title":"PsyRadio Chillout","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/15","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:s97066?sid=254&flags=8224&sn=0","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"Title":"Radio Regenbogen","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/52","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:s272334?sid=254&flags=8224&sn=0","ProtocolInfo":"x-rincon-mp3radio:*:*:*"},{"Title":"SWR4 Baden-Württemberg","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/48","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:s20293?sid=254&flags=8224&sn=0","ProtocolInfo":"x-rincon-mp3radio:*:*:*"},{"Title":"SWR4 Rheinland-Pfalz","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/47","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:s1563?sid=254&flags=8224&sn=0","ProtocolInfo":"x-rincon-mp3radio:*:*:*"}],"NumberReturned":15,"TotalMatches":15,"UpdateID":7}
setstate MQTT2_sonos_Bridge 2021-12-05 10:53:11 IODev MQTT2_Server
setstate MQTT2_sonos_Bridge 2021-12-04 14:19:20 Radios {"Result":[{"Title":"011.FM - Non Stop 60s","UpnpClass":"object.item.audioItem.audioBroadcast","ItemId":"R:0/0/27","ParentId":"R:0/0","TrackUri":"x-sonosapi-stream:s296020?sid=254&flags=8224&sn=0","ProtocolInfo":"x-rincon-mp3radio:*:*:*"},{"Title":"1LIVE diggi (Top 40/Pop)","UpnpClass":"object.item.audioItem.audioBroadcast","ItemId":"R:0/0/35","ParentId":"R:0/0","TrackUri":"x-sonosapi-stream:s45087?sid=254&flags=8224&sn=0","ProtocolInfo":"x-rincon-mp3radio:*:*:*"},{"Title":"DASDING 92.5 (Euro-Hits)","UpnpClass":"object.item.audioItem.audioBroadcast","ItemId":"R:0/0/33","ParentId":"R:0/0","TrackUri":"x-sonosapi-stream:s76488?sid=254&flags=8224&sn=0","ProtocolInfo":"x-rincon-mp3radio:*:*:*"},{"Title":"die neue welle 101.8 (Rock)","UpnpClass":"object.item.audioItem.audioBroadcast","ItemId":"R:0/0/40","ParentId":"R:0/0","TrackUri":"x-sonosapi-stream:s84548?sid=254&flags=8224&sn=0","ProtocolInfo":"x-rincon-mp3radio:*:*:*"},{"Title":"Hitradio Ö3 99.9 (Österreichisch)","UpnpClass":"object.item.audioItem.audioBroadcast","ItemId":"R:0/0/36","ParentId":"R:0/0","TrackUri":"x-sonosapi-stream:s8007?sid=254&flags=8224&sn=0","ProtocolInfo":"x-rincon-mp3radio:*:*:*"},{"Title":"NDR 2","UpnpClass":"object.item.audioItem.audioBroadcast","ItemId":"R:0/0/46","ParentId":"R:0/0","TrackUri":"x-sonosapi-stream:s228737?sid=254&flags=8224&sn=0","ProtocolInfo":"x-rincon-mp3radio:*:*:*"},{"Title":"Nota Masria (Gemeinden)","UpnpClass":"object.item.audioItem.audioBroadcast","ItemId":"R:0/0/23","ParentId":"R:0/0","TrackUri":"x-sonosapi-stream:s290159?sid=254&flags=8224&sn=0","ProtocolInfo":"x-rincon-mp3radio:*:*:*"},{"Title":"PsyRadio Chillout","UpnpClass":"object.item.audioItem.audioBroadcast","ItemId":"R:0/0/25","ParentId":"R:0/0","TrackUri":"x-sonosapi-stream:s97066?sid=254&flags=8224&sn=0","ProtocolInfo":"x-rincon-mp3radio:*:*:*"},{"Title":"Radio Regenbogen","UpnpClass":"object.item.audioItem.audioBroadcast","ItemId":"R:0/0/3","ParentId":"R:0/0","TrackUri":"x-sonosapi-stream:s272334?sid=254&flags=8224&sn=0","ProtocolInfo":"x-rincon-mp3radio:*:*:*"},{"Title":"SWR4 Baden-Württemberg","UpnpClass":"object.item.audioItem.audioBroadcast","ItemId":"R:0/0/5","ParentId":"R:0/0","TrackUri":"x-sonosapi-stream:s20293?sid=254&flags=8224&sn=0","ProtocolInfo":"x-rincon-mp3radio:*:*:*"},{"Title":"SWR4 Rheinland-Pfalz","UpnpClass":"object.item.audioItem.audioBroadcast","ItemId":"R:0/0/1","ParentId":"R:0/0","TrackUri":"x-sonosapi-stream:s1563?sid=254&flags=8224&sn=0","ProtocolInfo":"x-rincon-mp3radio:*:*:*"}],"NumberReturned":11,"TotalMatches":11,"UpdateID":1}
setstate MQTT2_sonos_Bridge 2021-12-05 11:39:05 Reply {"Result":[{"AlbumArtUri":"http://192.168.188.23:1400/getaa?u=x-file-cifs:%2f%2f192.168.188.26%2fOwnMusic%2fBirdy%2fWings.mp3&v=475","Title":"Test","UpnpClass":"object.container.playlistContainer","ItemId":"SQ:2","ParentId":"SQ:","TrackUri":"file:///jffs/settings/savedqueues.rsq#2","ProtocolInfo":"file:*:audio/mpegurl:*"}],"NumberReturned":1,"TotalMatches":1,"UpdateID":0}
setstate MQTT2_sonos_Bridge 2021-05-19 13:06:55 attrTemplateVersion 20210303
setstate MQTT2_sonos_Bridge 2021-12-03 09:41:51 config_RINCON_000E58F7F67C01400 {"available_commands":["adv-command","clearqueue","command","joingroup","leavegroup","mute","next","notify","pause","play","playmode","previous","queue","seek","selecttrack","setavtransporturi","sleep","speak","stop","switchtoline","switchtoqueue","switchtotv","toggle","unmute","volume","volumedown","volumeup"],"command_topic":"sonos/RINCON_000E58F7F67C01400/control","device":{"identifiers":["RINCON_000E58F7F67C01400"],"manufacturer":"Sonos","name":"Wohnzimmer"},"device_class":"speaker","icon":"mdi:speaker","json_attributes":true,"json_attributes_topic":"sonos/RINCON_000E58F7F67C01400","name":"Wohnzimmer","state_topic":"sonos/RINCON_000E58F7F67C01400","unique_id":"sonos2mqtt_RINCON_000E58F7F67C01400_speaker","availability_topic":"sonos/connected","payload_available":"2"}
setstate MQTT2_sonos_Bridge 2021-12-05 10:19:41 connected 0
setstate MQTT2_sonos_Bridge 2021-12-05 17:06:44 favRadios 011.FM-NonStop60s,1A.Deutsche.Hits,1LIVE.diggi,ANTENNE.THÜRINGEN,COSMO.Chillout,DASDING,FM.نجوم.100.6.(Arabisch),Hitradio.Ö3.99.9.(Österreichisch),Hörbücher,NDR.2.Hamburg,PsyRadio.Chillout,Radio.Regenbogen,SWR4.Baden-Württemberg,SWR4.Rheinland-Pfalz,die.neue.welle.101.8.(Rock)
setstate MQTT2_sonos_Bridge 2021-12-05 17:06:44 favlist
setstate MQTT2_sonos_Bridge 2021-12-05 17:06:44 grouplist Wohnzimmer,Wohnzimmer,Wohnzimmer
--- Ende Code ---

Wenn ich den Code aus sonos2mqtt_getList in der Kommandozeile ausführe wird mir die Liste zurückgegeben.

Siehst du oder wer anderes an was es liegen könnte ?

Ralli:
Favorites ist gefüllt. Und in den Playern müsste das Attribut setList um den Eintrag playFav: erweitert worden sein.

TomLee:
Nee, die setList ist auch nicht erweitert worden, da steht weiterhin der neue  :P dynamische playFav setter drin.


--- Code: ---defmod Sonos_Wohnzimmer MQTT2_DEVICE RINCON_000E58F7F67C01400
attr Sonos_Wohnzimmer IODev MQTT2_Server
attr Sonos_Wohnzimmer comment {\
my $wpix = '250px';;\
my $groupname = ReadingsVal($name,'groupName','0');;\
my $sgroupname = (split(' ',ReadingsVal($name,'groupName','')))[0];;\
my $uuidtoname = (devspec2array('DEF='.ReadingsVal($name,'coordinatorUuid','0')))[0];;\
my $vol = ReadingsVal($name,'volume','');;\
my $img = ReadingsVal($name,'currentTrack_AlbumArtUri','');;\
my $mystate = $name eq $uuidtoname \
  ? ReadingsVal($name,'state','FEHLER') : ReadingsVal($uuidtoname,'state','');;\
my %stat2pic = (\
'PLAYING' => 'rc_PAUSE@red',\
'PAUSED_PLAYBACK' => 'rc_PLAY@green',\
'STOPPED' => 'rc_PLAY@green',\
'TRANSITIONING' => 'rc_PLAY@blue',\
'set_next' => 'rc_NEXT@blue',\
'set_previous' => 'rc_PREVIOUS@blue',\
'set_volumeUp' => 'rc_VOLUP@blue',\
'set_volumeDown' => 'rc_VOLDOWN@blue',\
'set_mute' => 'rc_MUTE@blue');;\
return my $playpic='rc_PLAY@yellow' if !$mystate;;\
$playpic = $stat2pic{$mystate};; \
my $mutecmd = ReadingsVal($name,'mute','0') eq 'false'?'true':'false';;\
my $mutepic = $mutecmd eq 'on'?'rc_MUTE':'rc_VOLUP';;\
my $show = 'FEHLER';;\
my $currentTrack_Artist = ReadingsVal($name,'currentTrack_Artist','FEHLER');;\
my $currentTrack_Title = ReadingsVal($name,'currentTrack_Title','FEHLER');;\
if ($currentTrack_Title =~ 'x-sonosapi-stream:'){$currentTrack_Title=''};;\
my $currentTrack = $mystate eq 'TRANSITIONING'\
  ? 'Puffern...' : $currentTrack_Artist.' - '.$currentTrack_Title;;\
my $nextTrack_Artist = ReadingsVal($name,'nextTrack_Artist','FEHLER');;\
my $nextTrack_Title = ReadingsVal($name,'nextTrack_Title','FEHLER');;\
my $nextTrack = $nextTrack_Artist.' - '.$nextTrack_Title;;\
my $previouspic = 'rc_PREVIOUS';;\
my $nextpic = 'rc_NEXT';;\
my $voldownpic = 'rc_VOLDOWN';;\
my $voluppic = 'rc_VOLUP';;\
my $leavegrouppic = 'rc_LEFT';;\
my $showlg = ReadingsVal($name,"name","0") ne $groupname ? "<a href=\"/fhem?cmd.dummy=set $name leaveGroup&XHR=1\">".FW_makeImage($leavegrouppic)."</a>" : "";;\
if (($mystate eq 'PLAYING')\
  || ($mystate eq 'TRANSITIONING' )\
  || ($mystate eq 'set_next' )\
  || ($mystate eq 'set_previous' )\
  || ($mystate eq 'set_volumeUp' )\
  || ($mystate eq 'set_volumeDown' )\
  || ($mystate eq 'set_mute' )) { \
    my $shownp = ReadingsVal($name,'name','') eq $sgroupname \
    ? "<a href=\"/fhem?cmd.dummy=set $name previous&XHR=1\">".FW_makeImage($previouspic)."</a>\
       <a href=\"/fhem?cmd.dummy=set $name next&XHR=1\">".FW_makeImage($nextpic)."</a>" : "";;  \
    $show = "$showlg <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($playpic)."</a>\
    <a href=\"/fhem?cmd.dummy=set $name volumeDown&XHR=1\">".FW_makeImage($voldownpic)."</a>\
    $shownp\
    <a href=\"/fhem?cmd.dummy=set $name volumeUp&XHR=1\">".FW_makeImage($voluppic)."</a>\
    &nbsp;;&nbsp;;&nbsp;;&nbsp;;\
    <a href=\"/fhem?cmd.dummy=set $name mute $mutecmd&XHR=1\">".FW_makeImage($mutepic)."</a><br>";;\
  \
    if (ReadingsVal($name,'name','') eq $sgroupname) {\
      $show = ReadingsVal($name,'currentTrack_TrackUri','') =~ 'spdif'\
      ? 'TV': ReadingsVal($name,'enqueuedMetadata_UpnpClass','FEHLER') ne 'object.item.audioItem.audioBroadcast'\
      ? "$show<marquee style='width: $wpix'>Aktueller Track: $currentTrack<br>Nächster Track: $nextTrack</marquee>"\
      : "$show<marquee scrollamount='1' scrolldelay='1' style='width: $wpix'>Radio: $currentTrack</marquee>"\
    }\
    elsif (ReadingsVal($name,'name','') ne $groupname) {\
      $show = "$show Master: $sgroupname"}\
    }\
    else {\
      $show = $name eq $uuidtoname\
      ? "$showlg <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($playpic)."</a>"\
      : "$showlg <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($playpic)."</a><br>Master: $sgroupname"\
    }\
  "<div>\
   <table>\
     <tr>\
       <td><div style='display: inline-block;; margin-right: 5px;; border: 1px solid lightgray;;\
              height: 4.00em;; width: 4.00em;; background-image: url($img);; background-size: contain;;'></div></td>\
       <td>$show</td>\
     </tr>\
   </table>\
   </div>"\
}\
\
011.FM-NonStop60s,1A.Deutsche.Hits,1LIVE.diggi.(Top.40/Pop),ANTENNE.THÜRINGEN,COSMO.Chillout,DASDING.92.5.(Euro-Hits),FM.نجوم.100.6.(Arabisch),Hitradio.Ö3.99.9.(Österreichisch),Hörbücher,NDR.2,PsyRadioChillout,SWR4.Baden-Württemberg,SWR4.Rheinland-Pfalz,die.neue.welle.101.8.(Rock)
attr Sonos_Wohnzimmer devStateIcon {\
my $wpix = '210px';;\
my $master = ReadingsVal($name,'Master',$name);;\
my $inGroup = ReadingsNum($name,'inGroup','0');;\
my $isMaster = ReadingsNum($name,'isMaster','0');;\
my $inCouple = ReadingsNum($name,'inCouple','0');;\
my $Input = ReadingsVal($name,'Input','');;\
my $cover = ReadingsVal($name,'currentTrack_AlbumArtUri','');;\
my $mutecmd = ReadingsVal($name,'mute','0') eq 'false'?'true':'false';;\
my $mystate = $isMaster ? Value($name) : Value((devspec2array('DEF='.ReadingsVal($name,'coordinatorUuid','0')))[0]);;\
my $playpic = $mystate eq 'PLAYING'\
  ? 'rc_PAUSE@red'    : $mystate eq 'PAUSED_PLAYBACK'\
  ? 'rc_PLAY@green'   : $mystate eq 'STOPPED'\
  ? 'rc_PLAY@green'   : $mystate eq 'TRANSITIONING'\
  ? 'rc_PLAY@blue'    : 'rc_PLAY@yellow';;\
my $mutepic = $mutecmd eq 'true'?'rc_MUTE':'rc_VOLUP';;\
my $line2 = '';;\
my $title = $mystate eq 'TRANSITIONING' ? 'Puffern...' : ReadingsVal($name,'enqueuedMetadata_Title','FEHLER');;\
my $linePic = ($inGroup and !$isMaster and !$inCouple) ? "<a href=\"/fhem?cmd.dummy=set $name leaveGroup&XHR=1\">".FW_makeImage('rc_LEFT')."</a>" : "";;\
if ($isMaster) {$linePic .= " <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($playpic)."</a>"};;\
   $linePic .= "&nbsp;;&nbsp"\
            ."<a href=\"/fhem?cmd.dummy=set $name volumeDown&XHR=1\">".FW_makeImage('rc_VOLDOWN')."</a>"\
            ."<a href=\"/fhem?cmd.dummy=set $name previous&XHR=1\">".FW_makeImage('rc_PREVIOUS')."</a>"\
            ."<a href=\"/fhem?cmd.dummy=set $name next&XHR=1\">".FW_makeImage('rc_NEXT')."</a>"\
            ."<a href=\"/fhem?cmd.dummy=set $name volumeUp&XHR=1\">".FW_makeImage('rc_VOLUP')."</a>"\
            ."&nbsp;;&nbsp"\
            ."<a href=\"/fhem?cmd.dummy=set $name mute $mutecmd&XHR=1\">".FW_makeImage($mutepic)."</a>";;\
if ($isMaster and $mystate eq 'PLAYING') {$line2 = $Input =~ /LineIn|TV/ ? $Input : "$title"}\
    elsif ($inGroup and !$isMaster or $inCouple) {$line2 .= $inCouple ? "Stereopaar":"Steuerung: $master"}\
my $style1 = 'display:inline-block;;margin-right:5px;;border:1px solid lightgray;;background-size:contain;;background-image:';;\
my $style2 ='background-repeat: no-repeat;; height:4.00em;;width:4.00em;;background-size: contain;; background-position: center center';;\
"<div><table>\
     <tr>\
       <td><div style='$style1 url($cover);;$style2'></div></td>\
       <td>$linePic<br><div>$line2</div></td>\
     </tr>\
  </table></div>"\
}
attr Sonos_Wohnzimmer event-on-change-reading .*
attr Sonos_Wohnzimmer group s2m
attr Sonos_Wohnzimmer icon audio_volume_low
attr Sonos_Wohnzimmer jsonMap volume_Master:volume mute_Master:mute transportState:state volume_LF:0 volume_RF:0 mute_LF:0 mute_RF:0 enqueuedMetadata_ItemId:0 enqueuedMetadata_ParentId:0 currentTrack_ItemId:0 currentTrack_ParentId:0 enqueuedMetadata_Title:playFav
attr Sonos_Wohnzimmer model sonos2mqtt_speaker
attr Sonos_Wohnzimmer readingList sonos/RINCON_000E58F7F67C01400:.* { json2nameValue($EVENT,'',$JSONMAP) }\
sonos/RINCON_000E58F7F67C01400/error:.* { json2nameValue($EVENT) }\
sonos/RINCON_000E58F7F67C01400/sonosPlaylists:.* { json2nameValue($EVENT) }\
sonos/RINCON_000E58F7F67C01400/GetFavoritesReply:.* { json2nameValue($EVENT) }
attr Sonos_Wohnzimmer room MQTT2_DEVICE,Media
attr Sonos_Wohnzimmer setList sleep:slider,0,1,60,1 sonos/RINCON_000E58F7F67C01400/control {  "command": "sleep",  "input": $EVTPART1}\
stop:noArg sonos/RINCON_000E58F7F67C01400/control { "command": "stop" }\
play:noArg sonos/RINCON_000E58F7F67C01400/control { "command": "play" }\
pause:noArg sonos/RINCON_000E58F7F67C01400/control { "command": "pause" }\
toggle:noArg sonos/RINCON_000E58F7F67C01400/control { "command": "toggle" }\
volumeDown:noArg sonos/RINCON_000E58F7F67C01400/control { "command": "volumedown" }\
volumeUp:noArg sonos/RINCON_000E58F7F67C01400/control { "command": "volumeup" }\
volume:slider,0,1,100,5 sonos/RINCON_000E58F7F67C01400/control { "command": "volume", "input": $EVTPART1 }\
mute:noArg { my $value = ReadingsVal($NAME,'mute','false') eq "true" ? "unmute" : "mute";; qq(sonos/RINCON_000E58F7F67C01400/control { "command": "$value" } ) }\
next:noArg sonos/RINCON_000E58F7F67C01400/control { "command": "next" }\
previous:noArg sonos/RINCON_000E58F7F67C01400/control { "command": "previous" }\
joinGroup:textField sonos/RINCON_000E58F7F67C01400/control { "command": "joingroup",  "input": "$EVTPART1"}\
leaveGroup:noArg { my $value = ReadingsVal("RINCON_000E58F7F67C01400","groupName","all");; qq(sonos/RINCON_000E58F7F67C01400/control { "command": "leavegroup",  "input": "$value" } ) }\
setAVTUri:textField sonos/RINCON_000E58F7F67C01400/control { "command": "setavtransporturi",  "input": "$EVTPART1"}\
  playUri:textField {fhem("set $NAME setAVTUri $EVTPART1;; sleep 1;; set $NAME play")}\
  input:Queue { my $value = $EVTPART1 eq "TV" ? "tv" : $EVTPART1 eq "Line_In" ? "line" : "queue";; qq(sonos/RINCON_000E58F7F67C01400/control { "command": "switchto$value" } ) }\
  notify:textField sonos/RINCON_000E58F7F67C01400/control { "command":"notify","input":{"trackUri":"$EVTPART2","onlyWhenPlaying":false,"timeout":11,"volume":$EVTPART1,"delayMs":700}}\
  x_raw_payload:textField { my $payload = $EVENT;;$payload =~ s/$EVTPART0 //g;; qq(sonos/RINCON_000E58F7F67C01400/control $payload)}\
  speak:textField { my $tts="SonosTTS";;my ($cmd,$vol,$text)=split(' ', $EVENT,3);;fhem("set $tts tts $text;;sleep $tts:playing:.0 ;;set $NAME notify $vol [$tts:httpName]")}\
playF:011.FM-NonStop60s,1A.Deutsche.Hits,1LIVE.diggi.(Top.40/Pop),ANTENNE.THÜRINGEN,COSMO.Chillout,DASDING.92.5.(Euro-Hits),FM.نجوم.100.6.(Arabisch),Hitradio.Ö3.99.9.(Österreichisch),Hörbücher,NDR.2,PsyRadioChillout,SWR4.Baden-Württemberg,SWR4.Rheinland-Pfalz,die.neue.welle.101.8.(Rock) {use JSON;;use HTML::Entities;;use Encode qw(encode decode);;my $enc = 'UTF8';;my $uri='';;my $search=(split(' ', $EVENT,2))[1];;$search=~s/[\/()]/./g;;my $dev = (devspec2array('model=sonos2mqtt_bridge'))[0];;my $read='Favorites';;my $decoded = decode_json(ReadingsVal($dev,$read,''));;my @arr=@{$decoded->{'Result'}};;foreach (@arr) {if (encode($enc, decode_entities($_->{'Title'}))=~/$search/i){$uri = $_->{'TrackUri'} }};;fhem("set $NAME playUri $uri") if ($uri ne '')}\
  playFav:{ReadingsVal('MQTT2_sonos_Bridge','favRadios','RPR1')} {use JSON;;use HTML::Entities;;use Encode qw(encode decode);;my $enc = 'UTF8';;my $uri='';;my $search=(split(' ', $EVENT,2))[1];;$search=~s/[\/()]/./g;;my $dev = (devspec2array('model=sonos2mqtt_bridge'))[0];;my $read='Favorites';;my $decoded = decode_json(ReadingsVal($dev,$read,''));;my @arr=@{$decoded->{'Result'}};;foreach (@arr) {if (encode($enc, decode_entities($_->{'Title'}))=~/$search/i){$uri = $_->{'TrackUri'} }};;fhem("set $NAME playUri $uri") if ($uri ne '')}\
  toggleRadio:noArg {my $dev = (devspec2array('model=sonos2mqtt_bridge'))[0];;my $r=Each($dev,ReadingsVal($dev,'favRadios',''));;my $tts="SonosTTS";;fhem("set $tts tts Es folgt $r;;sleep $tts:playing:.0;;set $NAME playUri [$tts:httpName];;sleep $NAME:play;;sleep $NAME:PLAYING;;sleep $NAME:STOPPED;;set $NAME playFav $r")}\
  playSound:textField {my $tts="SonosTTS";;my ($cmd,$vol,$file)=split(' ', $EVENT,3);;$file=($file=~m/\.mp3$/)?"$file":"$file.mp3";;fhem("set $NAME notify $vol http://[$tts:host]/fhem/cache/Toene/$file")}\
  sayText:textField { my $tts=ReadingsVal('SonosBridge','tts','SonosTTS');;my ($cmd,$text)=split(' ', $EVENT,2);;fhem("setreading $tts text ".ReadingsVal($tts,'text',' ').' '.$text.";;sleep 0.4 tts;;set $tts tts [$tts:text];;sleep $tts:playing:.0 ;;set $NAME notify [$tts:vol] [$tts:httpName];;deletereading $tts text")}
attr Sonos_Wohnzimmer userReadings Master:groupName.* {(split(' +',ReadingsVal($name,'groupName','')))[0]},\
isMaster:coordinatorUuid.* {ReadingsVal($name,'coordinatorUuid','') eq ReadingsVal($name,'uuid','')?1:0},\
inGroup:groupName.* {ReadingsVal($name,'groupName','') =~ / \+ /?1:0},\
inCouple:coordinatorUuid.* {(ReadingsVal($name,'coordinatorUuid','') ne ReadingsVal($name,'uuid','') and (index(ReadingsVal($name,'groupName',''), ReadingsVal($name,'name','')) != -1))?1:0},\
Input:currentTrack_TrackUri.* {my $currentTrack_TrackUri = ReadingsVal($name,'currentTrack_TrackUri','');;\
   $currentTrack_TrackUri =~ 'x-rincon-stream'\
      ? 'LineIn': $currentTrack_TrackUri =~ 'spdif'\
      ? 'TV'    : ReadingsVal($name,'enqueuedMetadata_UpnpClass','') eq 'object.item.audioItem.audioBroadcast'\
      ? 'Radio' : 'Playlist'}
attr Sonos_Wohnzimmer verbose 2
attr Sonos_Wohnzimmer webCmd volume:playFav
attr Sonos_Wohnzimmer webCmdLabel Lautstärke\
:Favoriten

setstate Sonos_Wohnzimmer PLAYING
setstate Sonos_Wohnzimmer 2021-12-05 10:18:24 IODev MQTT2_Server
setstate Sonos_Wohnzimmer 2021-12-05 15:05:58 Input Radio
setstate Sonos_Wohnzimmer 2021-12-04 13:08:33 Master Wohnzimmer
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 bass 2
setstate Sonos_Wohnzimmer 2021-12-05 14:35:38 command play
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 coordinatorUuid RINCON_000E58F7F67C01400
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 currentTrack_AlbumArtUri http://192.168.188.23:1400/getaa?s=1&u=x-sonosapi-stream:s97066%3fsid%3d254%26flags%3d8224%26sn%3d0
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 currentTrack_Artist Saafi Brothers
setstate Sonos_Wohnzimmer 2021-12-05 15:05:57 currentTrack_Duration 0:00:00
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 currentTrack_ProtocolInfo sonos.com-http:*:*:*
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 currentTrack_Title Something Outside
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 currentTrack_TrackUri x-sonosapi-stream:s97066?sid=254&flags=8224&sn=0
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 currentTrack_UpnpClass object.item
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 enqueuedMetadata_UpnpClass object.item.audioItem.audioBroadcast
setstate Sonos_Wohnzimmer 2021-12-05 14:35:38 error_Action Play
setstate Sonos_Wohnzimmer 2021-12-05 14:35:38 error_Fault UPnPError
setstate Sonos_Wohnzimmer 2021-12-05 14:35:38 error_FaultCode s:Client
setstate Sonos_Wohnzimmer 2021-12-05 14:35:38 error_UpnpErrorCode 701
setstate Sonos_Wohnzimmer 2021-12-05 14:35:38 error_name SonosError
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 groupName Wohnzimmer
setstate Sonos_Wohnzimmer 2021-12-04 13:08:33 inCouple 0
setstate Sonos_Wohnzimmer 2021-12-04 13:08:33 inGroup 0
setstate Sonos_Wohnzimmer 2021-12-04 13:08:33 isMaster 1
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 mute false
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 name Wohnzimmer
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 playFav PsyRadio Chillout
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 playmode NORMAL
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 state PLAYING
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 treble -1
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 ts 1638721760434
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 uuid RINCON_000E58F7F67C01400
setstate Sonos_Wohnzimmer 2021-12-05 17:29:20 volume 10
--- Ende Code ---

Otto123:
Hallo Tom,

in der letzten Variante hatte ich mich auf die Variante direkt auszulesen konzentriert. Die playFav musste so erzeugt werden:
https://wiki.fhem.de/wiki/Sonos2mqtt#Player_mit_Favoritenliste_und_Gruppenliste_ausstatten

Ich habe die Änderungen bez. setList schon mitbekommen, habe bloß noch keine Muße gefunden mich damit zubeschäftigen.

Gruß Otto

TomLee:
Du verlinkst wie der setter gesetzt wird darum gehts mir aber gar nicht und war nicht meine Frage, ich frage mich warum das userReading favlist in der Bridge nicht geschrieben wird.

Meinem Verständnis nach wird erst

--- Code: ---sonos2mqtt_ur($name,'favlist')
--- Ende Code ---
ausgeführt, dort wird wieder

--- Code: ---sonos2mqtt_getList ($name,'Favorites')
--- Ende Code ---
aufgerufen und es sollte die Liste im Reading favlist zurückgegeben werden.

Den Code in sonos2mqtt_getList hab ich ja geschrieben, hab ich in der Kommandozeile getestet und die Liste wird mir zurückgegeben.
Wo ist der Denkfehler.

Navigation

[0] Themen-Index

[#] Nächste Seite

[*] Vorherige Sete

Zur normalen Ansicht wechseln