Hauptmenü

Musik Switch Status

Begonnen von TWART016, 14 September 2016, 19:44:56

Vorheriges Thema - Nächstes Thema

TWART016

Hallo,

ich steuere über Tablet UI mein Squeezeplay. Drücke ich auf playing startet die Musik und der Switch wird orange, bei erneuten drücken stop sie und der Switch wieder grau. Soweit auch richtig. Wenn ich jedoch auf Pause klicke, bleibt Play jedoch orange.

Ist es möglich, dass nur eines der 5 Icons orange ist?

Hier mein Code:

<div class="cell top-space">
<div data-type="push"
data-device="SB_Player_PCT"
data-icon="fa-step-backward"
data-background-icon="-"
data-off-color="#505050"
data-set-on="prev"
class="inline">
</div>

        <div data-type="switch"
            data-device="SB_Player_PCT"
            data-get="playStatus"
            data-get-on="playing"
            data-get-off="pause"
            data-icon="fa-play"
            data-background-icon="-"
            data-set-on="play"
            data-on-color="#aa6900"
            data-off-color="#505050"
            class="inline">
        </div>

<div data-type="switch"
            data-device="SB_Player_PCT"
            data-get="playStatus"
            data-get-on="paused"
            data-get-off="play"
            data-icon="fa-pause"
            data-background-icon="-"
            data-set-on="pause"
            data-on-color="#aa6900"
            data-off-color="#505050"
    class="inline">
</div>

        <div data-type="switch"
            data-device="SB_Player_PCT"
            data-get="playStatus"
            data-get-on="stopped"
            data-get-off="!on"
            data-icon="fa-stop"
            data-background-icon="-"
            data-set-on="stop"
            data-on-color="#aa6900"
            data-off-color="#505050"
    class="inline">
</div>

<div data-type="push"
data-device="SB_Player_PCT"
data-icon="fa-step-forward"
data-background-icon="-"
data-off-color="#505050"
data-set-on="next"
class="inline">
</div>

</div>



Gruß
TWART016

setstate

Ich würde bei den Switches immer


              data-get-off="!on"
              data-set-off=""


setzen.

Also: Aus, wenn nicht der erwartete ON-Status
und: nicht ausschaltbar

TWART016

Dann kann ich auf dem Switch nicht mehr togglen. Geht das auch anders?

Eine Kleinigkeit stört mich noch. Wenn ich Pause drücke (oder Play) wird der andere Switch immer noch orange (also on) angezeigt. Erst nach einem manuellen Aktualisieren der Seite wird es korrekt dargestellt. Longpoll steht auf 1. Gibt es dafür eine Lösung?

setstate

okay, wenn Toggeln gewünscht ist, dann musst du data-set-off gesetzt lassen


        <div data-type="switch"
            data-device="SB_Player_PCT"
            data-get="playStatus"
            data-get-on="playing"
            data-get-off="!on"
            data-icon="fa-play"
            data-background-icon="-"
            data-set-on="play"
            data-set-off="pause"
            data-on-color="#aa6900"
            data-off-color="#505050"
            class="inline">
        </div>

<div data-type="switch"
            data-device="SB_Player_PCT"
            data-get="playStatus"
            data-get-on="paused"
            data-get-off="!on"
            data-icon="fa-pause"
            data-background-icon="-"
            data-set-on="pause"
            data-set-off="play"
            data-on-color="#aa6900"
            data-off-color="#505050"
    class="inline">
</div>

        <div data-type="switch"
            data-device="SB_Player_PCT"
            data-get="playStatus"
            data-get-on="stopped"
            data-get-off="!on"
            data-icon="fa-stop"
            data-background-icon="-"
            data-set-on="stop"
            data-set-off="play"
            data-on-color="#aa6900"
            data-off-color="#505050"
    class="inline">
</div>



Kommt das Reading ist das reading am Tablet auch ordentlich an?


  <div data-type="label"
          data-device="SB_Player_PCT"
          data-get="playStatus"></div>

TWART016

Toggeln mit data-set-off funktioniert auch.

Ich denke mit einem funktionierenen aktualisieren würde es aktualisieren. Jedoch wird erst nach einem Neuladen die Werte erneuert. Auch bei einem Label werden die Readings nicht automatisch aktualisiert, nur beim manuellen Laden.

Die Readings kommen korrekt an.

setstate

Sendet FHEM das Reading überhaupt als Notify Event? Geht Aktualisieren bei anderen Readings bei anderen Widgets?

TWART016

wie meinst du das? Auf anderen Seiten werden die Readings auch nur nach manuellen Neuladen aktualisiert.

setstate

Dann geht longpoll bei dir nicht!!  ;D

Nimm erst einmal eine example Seite und setzt ein Label drauf. Klappt da das Update?

TWART016

aktualisiert leider nicht automatisch, index_example mit einem Label von Squeezeplayer.

attr WEB longpoll 1 ist aktiviert

<meta name="longpoll" content="0"> geht alle 30sek, möchte es aber nahezu realtime

setstate

Dann musst du mal <meta name="debug" content="5"> setzen und in der Web-Console schauen, was für Events reinkommen und ob sie verarbeitet werden.

TWART016

Ich werde daraus leider nicht schlau

Plugin dir: js
fhem-tablet-ui.js:977 Filename: test.html
fhem-tablet-ui.js:977 FHEM dir: /fhem/
fhem-tablet-ui.js:977 initPage - area=
fhem-tablet-ui.js:977 start shortpoll in (ms):30000
fhem-tablet-ui.js:977 count of templates:
fhem-tablet-ui.js:977 Object {modules: Array[0]}addModule: (module)load: (name,area)modules: Array[2]removeArea: (area)update: (dev,par)updateParameters: ()__proto__: Object
fhem-tablet-ui.js:977 Object {modules: Array[0]}addModule: (module)load: (name,area)modules: Array[2]removeArea: (area)update: (dev,par)updateParameters: ()__proto__: Object
fhem-tablet-ui.js:977 initWidgets - area=
fhem-tablet-ui.js:977 Load widget : label
fhem-tablet-ui.js:977 Create widget : label
fhem-tablet-ui.js:977 dynamic load file:js/widget_label.js / async:true
fhem-tablet-ui.js:977 Load widget : joinedlabel
fhem-tablet-ui.js:977 Create widget : joinedlabel
fhem-tablet-ui.js:977 dynamic load file:js/widget_joinedlabel.js / async:true
fhem-tablet-ui.js:977 dynamic load done:js/widget_label.js
fhem-tablet-ui.js:977 function depends_label not found (maybe ok)
fhem-tablet-ui.js:977 init widget: name=label area=
fhem-tablet-ui.js:977 label - value:Hands, substitution:
fhem-tablet-ui.js:977 label - value:Various Artists, substitution:
fhem-tablet-ui.js:977 Loaded plugin: label
fhem-tablet-ui.js:977 dynamic load done:js/widget_joinedlabel.js
fhem-tablet-ui.js:977 init widget: name=joinedlabel area=
widget_joinedlabel.js:10 init_attr start
widget_joinedlabel.js:16 init_attr end
widget_joinedlabel.js:24 update start
fhem-tablet-ui.js:1012 getPart is a deprecated function: use ftui.getPart instead
fhem-tablet-ui.js:977 undefined - value:<span class="joinedlabel_get_0">Hands - Single</span>, substitution:
widget_joinedlabel.js:24 update start
fhem-tablet-ui.js:977 Loaded plugin: joinedlabel
fhem-tablet-ui.js:977 initWidgets - Done
fhem-tablet-ui.js:316 initPage: 98.578ms
fhem-tablet-ui.js:977 start shortpoll in (ms):500
fhem-tablet-ui.js:977 start shortpoll
fhem-tablet-ui.js:977 start shortpoll in (ms):30000
fhem-tablet-ui.js:372 get jsonlist2: 21.332ms
fhem-tablet-ui.js:977 fhemJSON: 0=Arg 1=Results
fhem-tablet-ui.js:977 shortpoll: fhemJSON.Results.length=1
widget_joinedlabel.js:24 update start
fhem-tablet-ui.js:1012 getPart is a deprecated function: use ftui.getPart instead
fhem-tablet-ui.js:977 undefined - value:<span class="joinedlabel_get_0">IPAUTA- Don't You Need Somebody</span>, substitution:
fhem-tablet-ui.js:977 update done for "SB_Player_PCT:currentAlbum"
fhem-tablet-ui.js:977 label - value:RedOne feat. Enrique Iglesias, R. City, Serayah & Shaggy, substitution:
widget_joinedlabel.js:24 update start
fhem-tablet-ui.js:977 update done for "SB_Player_PCT:currentArtist"
fhem-tablet-ui.js:977 label - value:Don't You Need Somebody, substitution:
widget_joinedlabel.js:24 update start
fhem-tablet-ui.js:977 update done for "SB_Player_PCT:currentTitle"
fhem-tablet-ui.js:977 shortPoll - Done
fhem-tablet-ui.js:440 read jsonlist2: 36.629ms
fhem-tablet-ui.js:977 Longpoll started
fhem-tablet-ui.js:977
fhem-tablet-ui.js:977 ["SB_Player_PCT","on","<div id=\"SB_Player_PCT\"  title=\"on\" class=\"col2\"><a href=\"/fhem?cmd.SB_Player_PCT=set SB_Player_PCT off&room=SB%5fPLAYER\"><img class=' on' src=\"/fhem/images/default/on.png\" alt=\"on\" title=\"on\"></a></div>"]
fhem-tablet-ui.js:977 ["SB_Player_PCT", "on", "<div id="SB_Player_PCT"  title="on" class="col2"><...es/default/on.png" alt="on" title="on"></a></div>"]0: "SB_Player_PCT"1: "on"2: "<div id="SB_Player_PCT"  title="on" class="col2"><a href="/fhem?cmd.SB_Player_PCT=set SB_Player_PCT off&room=SB%5fPLAYER"><img class=' on' src="/fhem/images/default/on.png" alt="on" title="on"></a></div>"length: 3__proto__: Array[0]concat: concat()constructor: Array()copyWithin: copyWithin()entries: entries()every: every()fill: fill()filter: filter()find: find()findIndex: findIndex()forEach: forEach()includes: includes()indexOf: indexOf()join: join()keys: keys()lastIndexOf: lastIndexOf()length: 0map: map()pop: pop()push: push()reduce: reduce()reduceRight: reduceRight()reverse: reverse()shift: shift()slice: slice()some: some()sort: sort()splice: splice()toLocaleString: toLocaleString()toString: toString()unshift: unshift()Symbol(Symbol.iterator): values()Symbol(Symbol.unscopables): Object__proto__: Object
fhem-tablet-ui.js:977 ["SB_Player_PCT","on","<div id=\"SB_Player_PCT\"  title=\"on\" class=\"col2\"><a href=\"/fhem?cmd.SB_Player_PCT=set SB_Player_PCT off&room=SB%5fPLAYER\"><img class=' on' src=\"/fhem/images/default/on.png\" alt=\"on\" title=\"on\"></a></div>"]
fhem-tablet-ui.js:977 ["SB_Player_PCT", "on", "<div id="SB_Player_PCT"  title="on" class="col2"><...es/default/on.png" alt="on" title="on"></a></div>"]0: "SB_Player_PCT"1: "on"2: "<div id="SB_Player_PCT"  title="on" class="col2"><a href="/fhem?cmd.SB_Player_PCT=set SB_Player_PCT off&room=SB%5fPLAYER"><img class=' on' src="/fhem/images/default/on.png" alt="on" title="on"></a></div>"length: 3__proto__: Array[0]concat: concat()constructor: Array()copyWithin: copyWithin()entries: entries()every: every()fill: fill()filter: filter()find: find()findIndex: findIndex()forEach: forEach()includes: includes()indexOf: indexOf()join: join()keys: keys()lastIndexOf: lastIndexOf()length: 0map: map()pop: pop()push: push()reduce: reduce()reduceRight: reduceRight()reverse: reverse()shift: shift()slice: slice()some: some()sort: sort()splice: splice()toLocaleString: toLocaleString()toString: toString()unshift: unshift()Symbol(Symbol.iterator): values()Symbol(Symbol.unscopables): Object__proto__: Object
fhem-tablet-ui.js:977 start shortpoll in (ms):900000

setstate

Die letzten Zeilen zeigen Events für "STATUS" des Devices "SB_Player_PCT", keine für das Reading "playStatus".

Du musst FHEM dazu bringen, Events dafür zu senden.
-> ATTR "event-on-change-reading"

TWART016

attr SB_Player_PCT event-on-change-reading 1 habe ich nun gesetzt, jedoch keine Veränderung. Oder wo muss das hin?

setstate

nicht 1 sondern die Readings, für die die Events gesendet werden sollen

attr MPD1 event-on-update-reading state,Title,Track,playlistinfo,Album,Artist,playlistcollection,file,cover,playlist,Pos,Time,elapsed

TWART016

Ich habe jetzt das gesetzt:
attr SB_Player_PCT event-on-update-reading state,currentTitle,currentArtist,currentAlbum,playStatus

Im FHEMWEB wird das Reading auch nicht autoamtisch aktualisiert. Liegt es evtl. daran?

Im Konsolenlog steht das gleiche:
Plugin dir: js
fhem-tablet-ui.js:977 Filename: test.html
fhem-tablet-ui.js:977 FHEM dir: /fhem/
fhem-tablet-ui.js:977 initPage - area=
fhem-tablet-ui.js:977 start shortpoll in (ms):30000
fhem-tablet-ui.js:977 count of templates:
fhem-tablet-ui.js:977 Object {modules: Array[0]}
fhem-tablet-ui.js:977 Object {modules: Array[0]}
fhem-tablet-ui.js:977 initWidgets - area=
fhem-tablet-ui.js:977 Load widget : label
fhem-tablet-ui.js:977 Create widget : label
fhem-tablet-ui.js:977 dynamic load file:js/widget_label.js / async:true
fhem-tablet-ui.js:977 Load widget : joinedlabel
fhem-tablet-ui.js:977 Create widget : joinedlabel
fhem-tablet-ui.js:977 dynamic load file:js/widget_joinedlabel.js / async:true
fhem-tablet-ui.js:977 dynamic load done:js/widget_label.js
fhem-tablet-ui.js:977 function depends_label not found (maybe ok)
fhem-tablet-ui.js:977 init widget: name=label area=
fhem-tablet-ui.js:977 label - value:Thinking Out Loud, substitution:
fhem-tablet-ui.js:977 label - value:Ed Sheeran, substitution:
fhem-tablet-ui.js:977 Loaded plugin: label
fhem-tablet-ui.js:977 dynamic load done:js/widget_joinedlabel.js
fhem-tablet-ui.js:977 init widget: name=joinedlabel area=
widget_joinedlabel.js:10 init_attr start
widget_joinedlabel.js:16 init_attr end
widget_joinedlabel.js:24 update start
fhem-tablet-ui.js:1012 getPart is a deprecated function: use ftui.getPart instead
fhem-tablet-ui.js:977 undefined - value:<span class="joinedlabel_get_0">x (Deluxe Edition)</span>, substitution:
widget_joinedlabel.js:24 update start
fhem-tablet-ui.js:977 Loaded plugin: joinedlabel
fhem-tablet-ui.js:977 initWidgets - Done
fhem-tablet-ui.js:316 initPage: 112.986ms
fhem-tablet-ui.js:977 start shortpoll in (ms):500
fhem-tablet-ui.js:977 start shortpoll
fhem-tablet-ui.js:977 start shortpoll in (ms):30000
fhem-tablet-ui.js:372 get jsonlist2: 18.155ms
fhem-tablet-ui.js:977 fhemJSON: 0=Arg 1=Results
fhem-tablet-ui.js:977 shortpoll: fhemJSON.Results.length=1
widget_joinedlabel.js:24 update start
fhem-tablet-ui.js:1012 getPart is a deprecated function: use ftui.getPart instead
fhem-tablet-ui.js:977 undefined - value:<span class="joinedlabel_get_0">x (Deluxe Edition)</span>, substitution:
fhem-tablet-ui.js:977 update done for "SB_Player_PCT:currentAlbum"
fhem-tablet-ui.js:977 label - value:Ed Sheeran, substitution:
widget_joinedlabel.js:24 update start
fhem-tablet-ui.js:977 update done for "SB_Player_PCT:currentArtist"
fhem-tablet-ui.js:977 label - value:Thinking Out Loud, substitution:
widget_joinedlabel.js:24 update start
fhem-tablet-ui.js:977 update done for "SB_Player_PCT:currentTitle"
fhem-tablet-ui.js:977 shortPoll - Done
fhem-tablet-ui.js:440 read jsonlist2: 28.831ms
fhem-tablet-ui.js:977 Longpoll started
fhem-tablet-ui.js:977
fhem-tablet-ui.js:977 ["SB_Player_PCT","on","<div id=\"SB_Player_PCT\"  title=\"on\" class=\"col2\"><a href=\"/fhem?cmd.SB_Player_PCT=set SB_Player_PCT off&room=SB%5fPLAYER\"><img class=' on' src=\"/fhem/images/default/on.png\" alt=\"on\" title=\"on\"></a></div>"]
fhem-tablet-ui.js:977 ["SB_Player_PCT", "on", "<div id="SB_Player_PCT"  title="on" class="col2"><...es/default/on.png" alt="on" title="on"></a></div>"]0: "SB_Player_PCT"1: "on"2: "<div id="SB_Player_PCT"  title="on" class="col2"><a href="/fhem?cmd.SB_Player_PCT=set SB_Player_PCT off&room=SB%5fPLAYER"><img class=' on' src="/fhem/images/default/on.png" alt="on" title="on"></a></div>"length: 3__proto__: Array[0]concat: concat()constructor: Array()copyWithin: copyWithin()entries: entries()every: every()fill: fill()filter: filter()find: find()findIndex: findIndex()forEach: forEach()includes: includes()indexOf: indexOf()join: join()keys: keys()lastIndexOf: lastIndexOf()length: 0map: map()pop: pop()push: push()reduce: reduce()reduceRight: reduceRight()reverse: reverse()shift: shift()slice: slice()some: some()sort: sort()splice: splice()toLocaleString: toLocaleString()toString: toString()unshift: unshift()Symbol(Symbol.iterator): values()Symbol(Symbol.unscopables): Object__proto__: Object
fhem-tablet-ui.js:977 ["SB_Player_PCT","on","<div id=\"SB_Player_PCT\"  title=\"on\" class=\"col2\"><a href=\"/fhem?cmd.SB_Player_PCT=set SB_Player_PCT off&room=SB%5fPLAYER\"><img class=' on' src=\"/fhem/images/default/on.png\" alt=\"on\" title=\"on\"></a></div>"]
fhem-tablet-ui.js:977 ["SB_Player_PCT", "on", "<div id="SB_Player_PCT"  title="on" class="col2"><...es/default/on.png" alt="on" title="on"></a></div>"]0: "SB_Player_PCT"1: "on"2: "<div id="SB_Player_PCT"  title="on" class="col2"><a href="/fhem?cmd.SB_Player_PCT=set SB_Player_PCT off&room=SB%5fPLAYER"><img class=' on' src="/fhem/images/default/on.png" alt="on" title="on"></a></div>"length: 3__proto__: Array[0]concat: concat()constructor: Array()copyWithin: copyWithin()entries: entries()every: every()fill: fill()filter: filter()find: find()findIndex: findIndex()forEach: forEach()includes: includes()indexOf: indexOf()join: join()keys: keys()lastIndexOf: lastIndexOf()length: 0map: map()pop: pop()push: push()reduce: reduce()reduceRight: reduceRight()reverse: reverse()shift: shift()slice: slice()some: some()sort: sort()splice: splice()toLocaleString: toLocaleString()toString: toString()unshift: unshift()Symbol(Symbol.iterator): values()Symbol(Symbol.unscopables): Object__proto__: Object