Squeezebox Modul - erste Version

Begonnen von bugster_de, 17 Dezember 2013, 22:12:10

Vorheriges Thema - Nächstes Thema

oliv06

Thank you
Zitat von: bugster_de am 27 Januar 2014, 08:57:39
>>I also have a suggestion : could you add these 2 commands :
puh, that might be endless ... I'll check that
No problem : it is possible to do it without the module

bugster_de

Hi,

@oliv06: instead of lunch, I played a little bit around. Asking the server for the current playing song / songlist is not that straight forward. If it is playing a playlist, you get the name and can then further walk through to get the id, playing an album gives you no URL. You need to walk the full library and ask the server for the id. Playing a favourite gives you the favourites id, but you need to know, that you're playing a favourite. Playing a radio station gives you the url but no id. And that is not at all what I would call straight forward :-)

All: on what machine are you running FHEM? I'm at home testing on my FHEM test installation which is a rather powerful machine. I did not test the module on a Fritzbox, as my Fritzbox runs my real FHEM. Given that in the meantie there is a lot of string parsing in the module, I have my doubts about the computation power of the Fritzbox.
Alle: auf was für einem rechner läuft bei euch FHEM? Ich entwickle hier auf meiner FHEM Testinstalltion, was eine vergleichsweise potente Maschine ist. Ich habe das Modul bisher nicht auf meiner Fritzbox getestet, da die im Produktiveinsatz ist. Da mittlerweile eine ganze Menge Strings geparst werden, bin ich mir nicht sicher, ob die Fritzbox genug rechenleistung hat ...

cutter

#107
Hallo

Habe jetzt aktuelle Player und Server installiert und fhem im Telnet geloggt.

Found = in conditional, should be == at ./FHEM/97_SB_SERVER.pm line 815, <$fh> line 1319.
could not find ParserDetails.ini in /var/InternerSpeicher/fhem/lib/perl5/site_perl/5.12.2/XML/SAX
Use of uninitialized value $list in pattern match (m//) at /var/InternerSpeicher/fhem/lib/perl5/5.12.2/utf8_heavy.pl line 399.
Use of uninitialized value $_ in lc at ./FHEM/70_ENIGMA2.pm line 312.
Use of uninitialized value $_ in lc at ./FHEM/70_ENIGMA2.pm line 312.
Can't use string (" ") as a SCALAR ref while "strict refs" in use at ./FHEM/98_SB_PLAYER.pm line 499.
Can't use an undefined value as a symbol reference at FHEM/Blocking.pm line 126.
Can't use an undefined value as a symbol reference at FHEM/Blocking.pm line 126.
Can't use an undefined value as a symbol reference at FHEM/Blocking.pm line 126.
Can't use an undefined value as a symbol reference at FHEM/Blocking.pm line 126.
Can't use string (" ") as a SCALAR ref while "strict refs" in use at ./FHEM/98
_SB_PLAYER.pm line 499.
> Can't use an undefined value as a symbol reference at FHEM/Blocking.pm line 12

UPS noch mehr Fehler !!!

Fehlermeldung in fhem: 2014.01.27 17:02:52.680 1: CallBlockingFn: Can't connect to localhost:7072

OK werde dann in fhem die Wecker erst löschen und dann neu anlegen. Wenn man das weiß ist es gut.
Übrigens wurden die Squeéze_Radios nicht erkannt habe alle möglichen Knöpfe gedreht, nur squeeze-Slave auf RPI wurde erkannt.

oliv06

Zitat von: bugster_de am 27 Januar 2014, 17:00:37
@oliv06: instead of lunch, I played a little bit around. Asking the server for the current playing song / songlist is not that straight forward. If it is playing a playlist, you get the name and can then further walk through to get the id, playing an album gives you no URL. You need to walk the full library and ask the server for the id. Playing a favourite gives you the favourites id, but you need to know, that you're playing a favourite. Playing a radio station gives you the url but no id. And that is not at all what I would call straight forward :-)
Hi bugster_de,
There is a function for this in the SB CLI. Here is a small example using your module, which saves the playlist context (but not the SB state nor the play status), talk, then restore the context. My SB is called SB_boom :
set SB_boom cliraw playlist save temp_playlist_SB_boom
set SB_boom talk hello world
set SB_boom cliraw playlist resume temp_playlist_SB_boom

Using these commands, SB will talk in any case (even if SB was off or on pause), and current playlist will be played afterwards (even if SB was off or on pause)

oliv06

Zitat von: bugster_de am 27 Januar 2014, 17:00:37
All: on what machine are you running FHEM? I'm at home testing on my FHEM test installation which is a rather powerful machine. I did not test the module on a Fritzbox, as my Fritzbox runs my real FHEM. Given that in the meantie there is a lot of string parsing in the module, I have my doubts about the computation power of the Fritzbox.
I am using a Seagate Dockstar on Debian, which is not very powerful  :

       
  • 128MB RAM
  • 256MB NAND (32MB root partition, 219MB mtdblock3 partition)
  • Marvell Sheeva CPU, 1.2GHz 88F6281
Your code has not dramatically increased CPU load (it is about 0.2)

One thing which changed between current version of your code and previous one : display type is now ? for my SB boom.

bugster_de

Hi,

Danke für das Feedback zu Rechenleistung. Da bin ich ja beruhigt.

Da ich die nächsten Tage beruflich unterwegs bin stelle ich euch mal hier den aktuellen Stand der Dinge rein. Die bemängelten Fehler sollten draussen sein (tritt zumindest bei mir seit Tagen nicht mehr auf).
Ich habe auch versucht die aktuelle ID des gerade gespielten Titels darzustellen, um die resume Funktion zu vereinfachen. Deshalb gibt es ein paar neue Readings, die ich am Wochenende hier dokumentieren werde. Sollten aber durch den Namen selbsterklärend sein
Was immer noch nicht geht: wenn der SB-Server per Hibernate oder Suspend schlafen gelegt wird oder daraus wieder aufwacht, dann bekommt FHEM das nicht mit. Wenn man den PC regulär ausschaltet geht es. Zumindest auf Windows Maschinen scheinen die laufenden Programme nicht darüber informiert zu werden, dass jetzt Schlafenszeit ist und somit können sie wohl auch z.B. etwaige Verbindungen nach aussen nicht sauber abbauen. Da dies für mich aber ein wichtiger Anwendungsfall stecke ich da noch etwas Gehirnschmalz rein. Für diejenigen die den Sourcecode anschauen: das ist auch der Grund, warum bei 97_SB_SERVER nun die Möglichkeit besteht, wahlweise ein RCC oder ein WOL Modul zu definieren. SOlltet ihr aber noch nicht nutzen, da aktuell eh nicht zufriedenstellend lauffähig.

Ansonsten: Fehler wie immer hier posten.

Viele Grüße

Borkk

Hi,

das 98_SB_Player.pm Modul von 13. Januar funktioniert bei mir einwandfrei mit einem Squeezeqbox Radio. Die Kombi aus 97_SB_Server und 98_SB_Player läuft bei mit nicht wirklich gut. die readings des Players kommen extern langsam zb. gar nicht. Is Log wird ebenfalls nichts geschrieben. Mein Squezzeserver läuft auf einem Synology NAS DS212+

Ich bekomme im reading:Lastunkowncmd displaynotifyshowbriefly HASH(0x386a1d8) HASH(0x3881d10) 2014-01-30 22:21:24

Wenn ich beide Module rausschmeisse und den "alten" SB_player" einbinde ist alles super.

Docker@DS220+ FHEM, ConBeeII, Homebridge, Nginx ReverseProxy, ConfigDB, MQTT, NodeRed, InfluxDB, Grafana,
Raspberrymatic@Raspi3: HmIP Akt- /Sensoren, Shelly´s, Tibber Puls, Alexa, ASC, Gardena, Netatmo, E-Paper, FritzBox; Tado°, HOMEMODE, iBeacon, OLED ; ESP32/8266, SwitchBot ...

bugster_de

Hi,

ZitatIs Log wird ebenfalls nichts geschrieben
Bitte für das jeweilige Modul das Attribut verbose auf 5 setzen. Dann kommen so viele Log Einträge, dass die das logfile anschwillt. Mit loglevel = 4 wird nur eingetragen, wann welche Funktion des Moduls aufgerufen wurde, aber keine internen Details der Funktion

ZitatIch bekomme im reading:Lastunkowncmd displaynotifyshowbriefly HASH(0x386a1d8) HASH(0x3881d10) 2014-01-30 22:21:24
Das ist eine gewollte Funktionalität. Siehe hierzu Diskussionen weiter vorne im Thread und die Forderung CLI Kommandos direkt absetzen zu können. In diesem Reading werden alle Antworten des SB-Servers abgelegt, die durch das Modul nicht behandeltw erden. Somit kann man mittels set cliraw ein Kommando absetzen und die Antwort aus diesem Reading holen.
Und wenn man das Attribut donotnotify auf false setzt, erzeugt das Modul bei jeder Änderung dieses Readings einen notify, auf den man reagieren kann. Sprich man sendet eine cli message und wertet die Antwort im notify aus. Somit verpasst man auch nichts.

oliv06

There is a strange behavior :
- when I power on / off the SB with FHEM, I get a notify on / off
- when I do it with the button power button or the remote, I do not get it, but the state on the readings changes, which is strange.
Do you have any idea ?
It seems to me it was working normally before, because I use this notify in order to power on/off the subwoofer connected to my boom and I did not notice any problem

pc1246

Hallo Gemeinde

Da ich ja noch auf meinen Jeelink warten muss, habe ich erst einmal alle moeglichen Multimedia Geraete in FHEM eingebunden. So langsam werde ich auch immer sicherer, in dem, was ich da so mache ;) ! Bei mir flutet der Sueezeserver allerdings das logfile mit:

2014.02.02 19:33:30 1: 192.168.178.100:9000 disconnected, waiting to reappear
2014.02.02 19:33:30 1: 192.168.178.100:9000 reappeared (Squeeze)

Der Server laeuft bei mir auf einem ReadyNAS, und ich habe gerade die neueste Version installiert! Ein RPI als Client laeuft auch, wird aber auch nicht per autocreate angelegt!? NAS und FHEM sind per Kabel im Netz, so dass ich Netzwerkprobleme erst mal ausschliesse!
Kennt einer von Euch das Problem, oder kann mir einen Tipp geben dem Problem auf die Spur zu kommen?

Danke und Gruss

Christoph
HP T610
Onkyo_AVR;3 Enigma2; SB_Server ; SB_Player; HM-USB mit 15 HM-CC-RT-DN, 3 HM_WDS10_TH_O, 6 HM-Sec-SCo, 4 HM-Sec-MDIR-2, 1 HM-Sen-MDIR-O-2, 8 Ferion 5000 OW ; PhilipsTV; 4 harmony hub; Jeelink mit 9 PCA301; Somfy; S7-300; 3 LGW; HUE; HM-IP auf Charly

oliv06

Zitat von: oliv06 am 01 Februar 2014, 13:11:49
There is a strange behavior :
- when I power on / off the SB with FHEM, I get a notify on / off
- when I do it with the button power button or the remote, I do not get it, but the state on the readings changes, which is strange.
Do you have any idea ?
It seems to me it was working normally before, because I use this notify in order to power on/off the subwoofer connected to my boom and I did not notice any problem
In subroutine SB_PLAYER_Parse, this works fine for me :
    } elsif( $cmd eq "power" ) {
        if( $args[ 0 ] eq "1" ) {
            readingsSingleUpdate( $hash, "state", "on", 1 );
            #readingsSingleUpdate( $hash, "power", "on", 0 );
            readingsSingleUpdate( $hash, "power", "on", 1 );
        } else {^M
            readingsSingleUpdate( $hash, "state", "off", 1 );
#           readingsSingleUpdate( $hash, "power", "off", 0 );
           readingsSingleUpdate( $hash, "power", "off", 1 );
           readingsSingleUpdate( $hash, "presence", "absent", 0 );
        }

Do not know if you want to do the same for "presence"

oliv06

#116
Some proposals for SB_PLAYER_Parse :

-you could also add the following , in order not to get "clientdisconnect" and "clientreconnect" notifies :
    } elsif( $cmd eq "client" ) {
        # filter "client disconnect" and "client reconnect" messages


- The volume CLI information is not exactly the same on the boom as the one on the radio : the mixer volume seems to be bugged and returns either "mixer volume %2B1" or "mixer volume -0", but there is always a "prefset server volume xxx" information when you change volume on boom and radio, so the following code would treat both :

    } elsif( $cmd eq "prefset" ) {
        if( $args[ 0 ] eq "server" ) {
            if( $args[ 1 ] eq "volume" ) {
                readingsBulkUpdate( $hash, "volume", $args[ 2], 1);
            } else {
            }
        }


There is also something to change in your code because mixer volume is not always numeric so there is an error  :
Argument "?" isn't numeric in numeric gt (>) at ./FHEM/98_SB_PLAYER.pm line 360, <FILE> line 651.

- For last IR code, add :
    } elsif( $cmd eq "ir" ) {
        readingsSingleUpdate( $hash, "lastir", "$args[ 0 ]", 1);


oliv06

#117
The playStatus treatment should be corrected  in SB_PLAYER_Parse  :
    } elsif( $cmd eq "pause" ) {
        if( $args[ 0 ] eq "0" ) {
            readingsSingleUpdate( $hash, "playStatus", "playing", 1 );
        } else {
            readingsSingleUpdate( $hash, "playStatus", "paused", 1 );
        }


plus : I do not understand why you use readingsSingleUpdate with last argument = 0 for playStatus
Wouldn't it be better if there is a notify for this ? (it is usefull in my opinion)

oliv06

#118
last little correction in order that lastunknowncommand is displayed correctly :
        # unkown command, we push it to the last command thingy
        readingsSingleUpdate( $hash, "lastunkowncmd",
                              $cmd . " " . join( " ", @args ) , 1 );
                              #$cmd . join( " ", @args ), 1 );


pc1246

#119
Hallo nochmal

Ich bekomme den Server auf dem ready-NAS nicht per fhem eingebunden!?

Mit verbose 5 konnte ich zumindest mal ein paar sinnvolle Antworten aufzeichnen, allerdings kommen die in einer Tour wieder:

2014.02.03 22:48:16 5: +++++++++++++++++++++++++++++++++++++++++++++++++++++
2014.02.03 22:48:16 5: New Squeezebox Server Read cycle starts here
2014.02.03 22:48:16 5: +++++++++++++++++++++++++++++++++++++++++++++++++++++
2014.02.03 22:48:16 5: SB_SERVER_Read: called
2014.02.03 22:48:16 5: SB_SERVER_Read(Squeeze): please implelement the sending of the CMDStack.
2014.02.03 22:48:16 5: SB_SERVER_Read: complete command received
2014.02.03 22:48:16 4: SB_SERVER_DispatchCommandLine(Squeeze): Line:<HTML><HEAD><TITLE>405 Method Not Allowed</TITLE></HEAD>...
2014.02.03 22:48:16 4: SB_SERVER_DispatchCommandLine(Squeeze): Line:<BODY>405 Method Not Allowed: </BODY></HTML>...
2014.02.03 22:48:16 5: +++++++++++++++++++++++++++++++++++++++++++++++++++++
2014.02.03 22:48:16 5: Squeezebox Server Read cycle ends here
2014.02.03 22:48:16 5: +++++++++++++++++++++++++++++++++++++++++++++++++++++
2014.02.03 22:48:16 5: +++++++++++++++++++++++++++++++++++++++++++++++++++++
2014.02.03 22:48:16 5: New Squeezebox Server Read cycle starts here
2014.02.03 22:48:16 5: +++++++++++++++++++++++++++++++++++++++++++++++++++++
2014.02.03 22:48:16 5: SB_SERVER_Read: called
2014.02.03 22:48:16 1: 192.168.178.100:9000 disconnected, waiting to reappear
2014.02.03 22:48:16 4: SB_SERVER_Ready: called
2014.02.03 22:48:16 4: SB_SERVER_Broadcast: called
2014.02.03 22:48:16 1: 192.168.178.100:9000 reappeared (Squeeze)
2014.02.03 22:48:16 4: SB_SERVER_DoInit: called
2014.02.03 22:48:16 5: SW: listen 1

2014.02.03 22:48:16 5: SW: pref authorize ?

2014.02.03 22:48:16 5: SW: version ?

2014.02.03 22:48:16 5: SW: serverstatus 0 200

2014.02.03 22:48:16 5: SW: favorites items 0 30


Weiss jemand Rat?

Der Player, ein squeezelite auf RPI, wird nicht automatisch gefunden, liegt wohl am Problem mit dem Server, aber wenn ich ihn von Hand eintrage kommt folgendes:

2014.02.03 22:55:58 1: SB_PLAYER_Get: called with Bad ?
2014.02.03 22:56:50 1: SB_PLAYER_Get: called with Bad ?
2014.02.03 22:57:40 5: SB_PLAYER_Set: called with ?
2014.02.03 22:57:40 1: SB_PLAYER_Get: called with Bad ?
2014.02.03 22:57:40 5: SB_PLAYER_Get: Bad: unkown argument
2014.02.03 22:57:40 5: SB_PLAYER_Broadcast(Bad): called with OFF

2014.02.03 22:57:41 5: SB_PLAYER_Broadcast(Bad): called with OFF

Bad ist uebrigens der Ort des Players, nicht das englische "bad"!

Ich weiss bugster ist auf Dienstreise, aber eventuell kann ja jemand anderes einen entscheidenden Hinweis geben. Oder geht meine Kombi etwa gar nicht?

Danke und Gruesse

Christoph
HP T610
Onkyo_AVR;3 Enigma2; SB_Server ; SB_Player; HM-USB mit 15 HM-CC-RT-DN, 3 HM_WDS10_TH_O, 6 HM-Sec-SCo, 4 HM-Sec-MDIR-2, 1 HM-Sen-MDIR-O-2, 8 Ferion 5000 OW ; PhilipsTV; 4 harmony hub; Jeelink mit 9 PCA301; Somfy; S7-300; 3 LGW; HUE; HM-IP auf Charly