Autor Thema: Menü aus einem Array erstellen  (Gelesen 548 mal)

Offline australien

  • Full Member
  • ***
  • Beiträge: 346
Menü aus einem Array erstellen
« am: 03 November 2022, 11:31:41 »
Eine etwas allgemeine Frage.

Ist es möglich, einen MenüEintrag aus einem array zu erstellen?
zB.
"rightMenu": ["array Text:array Befehl(html)"]
raspberry pi3
signalduino, Shelly1, Shelly2, Sonos, Unifi
Amazon Fire Tablet 7 | Noname Android Tablet 10"

Offline jemu75

  • Moderator
  • Sr. Member
  • ***
  • Beiträge: 914
    • FHEM App
Antw:Menü aus einem Array erstellen
« Antwort #1 am: 03 November 2022, 12:08:03 »
Das Menü selbst ist ein Array. Dieses Array kannst du wie folgt befüllen ["text1:cmd1", "text2:cmd2", "text3:cmd3",...]
Ein dynamisches Befüllen ist derzeit nicht möglich.
Hast du ein konkretes Beispiel, aus welchen Daten das Menü mit Texten und Kommandos befüllt werden soll?

Grüße
Jens  :)

Offline australien

  • Full Member
  • ***
  • Beiträge: 346
Antw:Menü aus einem Array erstellen
« Antwort #2 am: 03 November 2022, 12:17:34 »
Ja, siehe https://forum.fhem.de/index.php/topic,129486.0.html

Die Readings kommen aus der SonosBridge

Readings Favorites

{"Result":[{"AlbumArtUri":"http://cdn-profiles.tunein.com/s172072/images/logoq.png","Title":"2Day Buddha (Chill)","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/9","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:s172072?sid=254&flags=8224&sn=0","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"AlbumArtUri":"http://cdn-profiles.tunein.com/s202791/images/logoq.png?t=155748","Title":"Boom","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/4","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:s202791?sid=254&flags=8224&sn=0","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"AlbumArtUri":"https://static.radio.de/images/broadcasts/22/0c/2703/1/c300.png","Title":"FM4","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/22","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:STATION:2703?sid=264&flags=8232&sn=7","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"AlbumArtUri":"https://static.radio.de/images/broadcasts/37/bf/4524/1/c175.png","Title":"Gold FM","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/5","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:STATION:4524?sid=264&flags=8224&sn=3","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"AlbumArtUri":"https://static.radio.de/images/broadcasts/6e/9c/122244/1/c175.png","Title":"Heart 80s","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/8","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:STATION:122244?sid=264&flags=8224&sn=3","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"AlbumArtUri":"https://static.radio.de/images/broadcasts/47/5f/4511/c175.png","Title":"Hitradio Ö3","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/21","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:STATION:4511?sid=264&flags=8224&sn=7","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"AlbumArtUri":"https://static.radio.de/images/broadcasts/c5/c5/9012/1/c300.png","Title":"ooe Radio Oberösterreich","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/11","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:STATION:9012?sid=264&flags=8224&sn=3","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"AlbumArtUri":"https://static.radio.de/images/broadcasts/a3/fe/9807/1/c300.png","Title":"ORF Radio Burgenland","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/12","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:STATION:9807?sid=264&flags=8224&sn=3","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"AlbumArtUri":"http://cdn-profiles.tunein.com/s265024/images/logoq.jpg?t=158163","Title":"smooth fm Brisbane","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/6","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:s265024?sid=254&flags=8224&sn=0","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"AlbumArtUri":"http://cdn-profiles.tunein.com/s8786/images/logoq.jpg?t=153330","Title":"Sydneys-2CH","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/7","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:s8786?sid=254&flags=8224&sn=0","ProtocolInfo":"x-sonosapi-stream:*:*:*"},{"AlbumArtUri":"http://cdn-radiotime-logos.tunein.com/s294407q.png","Title":"Triple M Greatest Hits (Classic Rock)","UpnpClass":"object.itemobject.item.sonos-favorite","ItemId":"FV:2/10","ParentId":"FV:2","TrackUri":"x-sonosapi-stream:s294407?sid=254&flags=8224&sn=0","ProtocolInfo":"x-sonosapi-stream:*:*:*"}],"NumberReturned":11,"TotalMatches":11,"UpdateID":1}

Reading favlist

2Day.Buddha.(Chill),Boom,FM4,Gold.FM,Heart.80s,Hitradio.Ö3,ORF.Radio.Burgenland,Sydneys-2CH,Triple.M.Greatest.Hits.(Classic.Rock),ooe.Radio.Oberösterreich,smooth.fm.Brisbane
raspberry pi3
signalduino, Shelly1, Shelly2, Sonos, Unifi
Amazon Fire Tablet 7 | Noname Android Tablet 10"

Offline jemu75

  • Moderator
  • Sr. Member
  • ***
  • Beiträge: 914
    • FHEM App
Antw:Menü aus einem Array erstellen
« Antwort #3 am: 03 November 2022, 13:16:58 »
Ich mache den Betrag hier mal zu und nutze den anderen Betrag für den weiteren Austausch.