Grid inhalt wechseln?

Begonnen von Badflex, 04 März 2017, 21:15:36

Vorheriges Thema - Nächstes Thema

Badflex

Hallo,
ich würde gern auf der startseite ein musiksteuerung einmal für tunein und einmal für spotify hinzufügen.
So wie auf meiner Medieneite:

<li data-row="4" data-col="3" data-sizex="2" data-sizey="1" class="halbTransparent">
<header>spotify</header>
<br />
<marquee><div data-type="label" data-device="Tablet_Wohnzimmer" data-get="currentMusicArtist" class="inline"></div> -  <div data-type="label" data-device="Tablet_Wohnzimmer" data-get="currentMusicTrack" class="inline"></div></marquee>
<br />
<div data-type="switch" data-device="Tablet_Wohnzimmer" data-icon="fa-chevron-left" data-set-on="mediaSpotifyMusic back" data-set-off="mediaspotifyMusic back" data-on-color="#AA6900" data-off-color="#AA6900" data-background-icon="-"  class="inline"></div>
<div data-type="switch" data-device="Tablet_Wohnzimmer" data-set-on="mediaSpotifyMusic play" data-set-off="mediaSpotifyMusic stop" data-get="currentMusicApp" data-get-on='["googlemusic","no player active"]' data-background-colors='["#c0c0c0","#505050"]' data-icons='["fa-play","fa-pause"]' data-background-icon="-" data-on-color="#aa6900" data-off-color="#505050"class="inline"></div>
<div data-type="switch" data-device="Tablet_Wohnzimmer" data-icon="fa-chevron-right" data-set-on="mediaSpotifyMusic next" data-set-off="mediaSpotifyMusic next" data-on-color="#AA6900" data-off-color="#AA6900" data-background-icon="-" class="inline"></div>
<div data-type="spinner" data-device="Tablet_Wohnzimmer"
                                data-get="volume"
                                data-set="volume"                              data-max="15"
                                data-step="1"
                                data-icon-left="fa-volume-down"
                                data-icon-right="fa-volume-up"
                                data-background-color="none"
                                class="big narrow inline" >
                        </div>
</li>
<li data-row="4" data-col="5" data-sizex="2" data-sizey="1" class="halbTransparent">
<header>Tunein</header>
<br />
<marquee><div data-type="label" data-device="Tablet_Wohnzimmer" data-get="currentMusicArtist" class="inline"></div> -  <div data-type="label" data-device="Tablet_Wohnzimmer" data-get="currentMusicTrack" class="inline"></div></marquee>
<br />
<div data-type="switch" data-device="Tablet_Wohnzimmer" data-icon="fa-chevron-left" data-set-on="mediaTuneinRadio back" data-set-off="mediaTuneinRadio back" data-on-color="#AA6900" data-off-color="#AA6900" data-background-icon="-"  class="inline"></div>
<div data-type="switch" data-device="Tablet_Wohnzimmer" data-set-on="mediaTuneinRadio play" data-set-off="mediaTuneinRadio stop" data-get="currentMusicApp" data-get-on='["googlemusic","no player active"]' data-background-colors='["#c0c0c0","#505050"]' data-icons='["fa-play","fa-pause"]' data-background-icon="-" data-on-color="#aa6900" data-off-color="#505050"class="inline"></div>
<div data-type="switch" data-device="Tablet_Wohnzimmer" data-icon="fa-chevron-right" data-set-on="mediaTuneinRadio next" data-set-off="mediaTuneinRadio next" data-on-color="#AA6900" data-off-color="#AA6900" data-background-icon="-" class="inline"></div>
<div data-type="spinner" data-device="Tablet_Wohnzimmer"
                                data-get="volume"
                                data-set="volume"                              data-max="15"
                                data-step="1"
                                data-icon-left="fa-volume-down"
                                data-icon-right="fa-volume-up"
                                data-background-color="none"
                                class="big narrow inline" >
                        </div>
</li>



Ist das möglich in ein Grid zu packen?
Also wenn ich spotify starte das ich mit den stop,play,vor,zurück tasten spotify tuern kann und bei Tunein halt Tunein, ohne das ich zwei Gridster haben muss?

Kann man irgendwie einstellen das Play und Pause den Status erkennt?
Wenn ich über mein Button spotify starte und dann mit den oben genanten Steuerungen auf stop drücke, führt er erst mal play aus und beim zweiten drücken stopt er.
Raspberry Pi, CUL868(SlowRF), FB 7490, SmartVisu, fast nur HomeMatic wenig FS20, Netatmo

setstate

ich benutze dafür einen Swiper, der je nach AV-Receiver-Quelle eine andere Page anzeigt.


                                <div data-type="swiper" data-height="150px" data-width="320px" data-device="AvReceiver" data-get="input" data-states='["Spotify","Webradio","Sat"]' class="nopagination">
                                    <ul>
                                        <li>
                                            <div class="vbox">
                                                <div class="hbox grow-2">
                                                    <div data-type="push" data-device="MPD1" data-icon="fa-step-backward" data-background-icon="-" data-set-on="previous" class=""></div>
                                                    <div data-type="switch" data-device="MPD1" data-states='["play","pause","stop"]' data-set-states='["pause","play","play"]' data-background-icon="fa-circle-thin" data-background-colors='["#555","#555","#555"]' data-colors='["#555","#555","#555"]' data-icons='["fa-pause","fa-play","fa-play"]' class="big"></div>
                                                    <div data-type="push" data-device="MPD1" data-icon="fa-step-forward" data-background-icon="-" data-set-on="next" class=""></div>
                                                </div>
                                                <div class="hbox grow-1">
                                                    <div data-type="label" data-device="MPD1" data-get="Artist" data-post-text="&nbsp;-&nbsp;" class="bold truncate"></div>
                                                    <div data-type="label" data-device="MPD1" data-get="Title" class="truncate"></div>
                                                </div>
                                            </div>
                                        </li>
                                        <li>
                                            <div class="vbox">
                                                <div class="hbox">
                                                    <div data-type="push" data-device="WebRadio" data-icon="fa-step-backward" data-set-on="Prev" class=""></div>
                                                    <div data-type="label" data-device="WebRadio" class="inline white">radio</div>
                                                    <div data-type="push" data-device="WebRadio" data-icon="fa-step-forward" data-set-on="Next" class=""></div>
                                                </div>
                                                <div class="hbox">
                                                    <div data-type="label" data-device="RadioEinsInfo" data-get="Artist" data-post-text="&nbsp;-&nbsp;" class="bold"></div>
                                                    <div data-type="label" data-device="RadioEinsInfo" data-get="Title" class=""></div>
                                                </div>
                                            </div>
                                        </li>
                                        <li>
                                            <div class="vbox">
                                                <div class="hbox">
                                                    <div data-type="push" data-device="SatReceiver" data-icon="fa-step-backward" data-set-on="channelDown" class=""></div>
                                                    <div data-type="label" data-device="SatReceiver" data-get="channel" class="white"></div>
                                                    <div data-type="push" data-device="SatReceiver" data-icon="fa-step-forward" data-set-on="channelUp" class=""></div>
                                                </div>
                                                <div class="hbox">
                                                    <div data-type="label" data-device="SatReceiver" data-get="eventstart_hr" class="bold truncate"></div>
                                                    <div data-type="label" data-device="SatReceiver" data-get="currentTitle" class="truncate"></div>
                                                </div>
                                            </div>
                                        </li>
                                    </ul>
                                </div>

Badflex

#2
Das Problem was ich dabei habe, das Device ist beide mal das selbe. also mein Tablet wo ich über Amad Spotify oder Tunein starte.
Muss ich da da das Tablet nochmal unter anderem Namen anlegen oder wie kann ich das machen?
Raspberry Pi, CUL868(SlowRF), FB 7490, SmartVisu, fast nur HomeMatic wenig FS20, Netatmo

sinus61

Hab auch gerade sowas überlegt, bei mir für Amazon Music und TuneIn. Leider heißen die Readings aus Amad für currentMusicApp anders als der set Befehl zum steuern der Player, sonst könnte man das leicht auslesen und damit steuern. Am einfachsten wäre es natürlich wenn es in Amad sowas wie set mediaCurrentMusicApp geben würde.

Im Moment fällt mir nur ein einen Dummy zu steuern, der dann über ein notify die currentMusicApp ausliest und den Player steuert.

sinus61

Mal eine Idee dazu:


wz_tablet {
if ( ReadingsVal( "wz_tablet", "currentMusicApp", "") eq "Amazon Musik" ) {
fhem ("setreading wz_tablet currentMusicAppSet mediaAmazonMusic");
}
elsif ( ReadingsVal( "wz_tablet", "currentMusicApp", "") eq "TuneIn Player" ) {
fhem ("setreading wz_tablet currentMusicAppSet mediaTuneinRadio");
}
}


Das notify für das Tablet merkt sich immer den letzten Mediaplayer in einem Reading.

set wz_tablet [wz_tablet:currentMusicAppSet] stop

Und damit wird der aktuell laufende Mediaplayer gestoppt. So kann stop/play/next/prev über jeweils einen Button für alle Mediaplayer abhandeln.