Squeezebox Modul - erste Version

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

Vorheriges Thema - Nächstes Thema

bugster_de

#75
So liebe Freunde der gepflegten Musik,

im ersten Post habe ich die neue Version angehängt. Der Code ist einmal komplett neu. Bitte eure bisherigen defines löschen, da ich leider das Interface doch nicht stabil halten konnte. Dafür gibt es jetzt aber autocreate :-) Sprich einfach nur den Server anlegen, die Player werden automatisch angelegt.

@oliv06:
- warning should be gone none
- IR doesn't work on my side, but I have only a SB Radio that doesn't support it. So if you have some other hardware, just try it. Set verbose to 5 for the modul and send me the log, then we'll see
- attributes are complete

@cutter:
zweiter Wecker ist auch drin

Bei mir lief das jetzt ein paar Stunden, aber echte Testtiefe ist vermutlich auch was anderes ...

oliv06

Zitat von: bugster_de am 19 Januar 2014, 01:39:56
- warning should be gone none
- IR doesn't work on my side, but I have only a SB Radio that doesn't support it. So if you have some other hardware, just try it. Set verbose to 5 for the modul and send me the log, then we'll see
- attributes are complete
Thanks for the good work !
- no warning anymore

- IR with SB boom : seems to work . With attributes donotnotify = true and verbose = 5
If I press "PAUSE" :
Logfile :
2014.01.19 12:24:18 5: SB_PLAYER_Parse: SB_boom CMD:ir ARGS:768920df 1178218.662...
2014.01.19 12:24:18 5: SB_PLAYER_Parse: SB_boom: leaving
2014.01.19 12:24:18 5: SB_PLAYER_Set: called with ?
2014.01.19 12:24:18 5: SB_PLAYER_Parse: SB_boom CMD:ir ARGS:768920df 1178218.714...
2014.01.19 12:24:18 5: SB_PLAYER_Parse: SB_boom: leaving
2014.01.19 12:24:18 5: SB_PLAYER_Set: called with ?
2014.01.19 12:24:18 5: SB_PLAYER_Parse: SB_boom CMD:button ARGS:done_passback 1178218.918 1...
2014.01.19 12:24:18 5: SB_PLAYER_Parse: SB_boom: leaving
2014.01.19 12:24:18 5: SB_PLAYER_Set: called with ?
2014.01.19 12:24:18 5: SB_PLAYER_Parse: SB_boom CMD:button ARGS:passback 1178218.714 1...
2014.01.19 12:24:18 5: SB_PLAYER_Parse: SB_boom: leaving
2014.01.19 12:24:18 5: SB_PLAYER_Set: called with ?
2014.01.19 12:24:18 5: SB_PLAYER_Parse: SB_boom CMD:pause ARGS:1...
2014.01.19 12:24:18 5: SB_PLAYER_Parse: SB_boom: leaving
2014.01.19 12:24:18 5: SB_PLAYER_Set: called with ?
2014.01.19 12:24:18 5: SB_PLAYER_Parse: SB_boom CMD:playlist ARGS:stop...
2014.01.19 12:24:18 5: SB_PLAYER_Parse: SB_boom: leaving
2014.01.19 12:24:18 5: SB_PLAYER_Parse: SB_boom CMD:menustatus ARGS:ARRAY(0x3e8e970) add 00:04:20:1f:5c:85...
2014.01.19 12:24:18 5: SB_PLAYER_Parse: SB_boom: leaving
2014.01.19 12:24:18 5: SB_PLAYER_Set: called with ?

SB logfile :
2014-01-19_12:24:18 SB_boom lastunkowncmd: ir768920df 1178218.662
2014-01-19_12:24:18 SB_boom lastunkowncmd: ir768920df 1178218.714
2014-01-19_12:24:18 SB_boom lastunkowncmd: buttondone_passback 1178218.918 1
2014-01-19_12:24:18 SB_boom lastunkowncmd: buttonpassback 1178218.714 1
2014-01-19_12:24:18 SB_boom lastunkowncmd: pause1
2014-01-19_12:24:18 SB_boom lastunkowncmd: menustatusARRAY(0x3e8e970) add 00:04:20:1f:5c:85


- attributes : thanks !

I am going to test the other features


oliv06

talk function has to be changed, I think, because I get a 404 error and only the first word
<       $outstr .= "tl=" . AttrVal( $name, "ttslanguage", "de" ) . "%26";
<       $outstr .= join( "+", @arg );
<       $outstr = uri_escape( $outstr );
---
>       $outstr .= "tl=" . AttrVal( $name, "ttslanguage", "de" ) . "%26q=" . uri_escape( join(" ",@arg ));

Still not ideal as &q= may not be the same if you change TTS engine (would need a ttsquery attribute which could be set to &q= for the google TTS engine

bugster_de

#78
@oliv06: thanks for the quick feedback !

for the IR codes, that is cool. Given the responses of the SB, I could introduce a reading like "lastircommand" that holds the last command sent by the IR. As such, you can create a notify on that reading and process the command further. Helpful?

For the talk: you are right: change this line
$outstr .= "tl=" . AttrVal( $name, "ttslanguage", "de" ) . "%26";
to this
$outstr .= "tl=" . AttrVal( $name, "ttslanguage", "de" ) . "$q=";

oliv06

Zitat von: bugster_de am 19 Januar 2014, 13:55:51
For the talk: you are right: change this line
$outstr .= "tl=" . AttrVal( $name, "ttslanguage", "de" ) . "%26";
to this
$outstr .= "tl=" . AttrVal( $name, "ttslanguage", "de" ) . "$q=";
There is a typo : right line is
$outstr .= "tl=" . AttrVal( $name, "ttslanguage", "de" ) . "&q=";

oliv06

Zitat von: bugster_de am 19 Januar 2014, 13:55:51
for the IR codes, that is cool. Given the responses of the SB, I could introduce a reading like "lastircommand" that holds the last command sent by the IR. As such, you can create a notify on that reading and process the command further. Helpful?
lastitcommand would be nice !

Another suggestion to better handle notifications : the "donotnotify = false" approach seems to work fine, but if we need to better filter events, there could be then 2 mecanisms to filter SB events for FHEM :
1/ using the CLI "subscribe" command which allows to filter input on the SB server (can be set with cliraw), while "listen 1/0" is all or nothing . A module "subscribe" attribute would make  sense, which would take care of adding to the subscribe list  "playlist" and other SB commands inputs you use in the module
2/ standard FHEM notify, with regular expressions, is then simplified, because there is less to handle

bugster_de

Hi,

I thought about the listen list also, but that holds true for the whole server and not for indivdual players, but it is a quite good means to limit traffic (not only on the net but also on FHEM notifications).
As the server is sending a lot of responses, that are not documented in the CLI dou, I think as soon as we have more experience, we can switch the concept to the limited list.

You seem to have significant experience with the CLI interface. Do you have any suggestion on how to figure out if the SB-Server is still there?
In my case, the SB-Server is located on the HTPC (Windows machine) in the living room. If the HTPC is not needed, it is put to hibernate. And in this case, the server is just gone for FHEM (which is not an issue). But as soon as the HTPC is back in action, FHEM needs to re-initialize the CLI session, yb sending the listen 1 command. Of course i could send it from time to time, but that is also not very nice...
And on top of that, FHEM doesn't realize in the go-to-hibernate case, that the players actually are turned off.

oliv06

#82
Zitat von: bugster_de am 19 Januar 2014, 17:46:30
I thought about the listen list also, but that holds true for the whole server and not for indivdual players, but it is a quite good means to limit traffic (not only on the net but also on FHEM notifications).
As the server is sending a lot of responses, that are not documented in the CLI dou, I think as soon as we have more experience, we can switch the concept to the limited list.
You are right, perheaps the donotnotify and (potential) subscribe attributes should be SB_SERVER attributes ?

Zitat von: bugster_de am 19 Januar 2014, 17:46:30
Do you have any suggestion on how to figure out if the SB-Server is still there?
In my case, the SB-Server is located on the HTPC (Windows machine) in the living room. If the HTPC is not needed, it is put to hibernate. And in this case, the server is just gone for FHEM (which is not an issue). But as soon as the HTPC is back in action, FHEM needs to re-initialize the CLI session, yb sending the listen 1 command. Of course i could send it from time to time, but that is also not very nice...
And on top of that, FHEM doesn't realize in the go-to-hibernate case, that the players actually are turned off.
I myself have the SB-server on the same little linux machine (Dockstar plug computer) as FHEM which is up 7/24 (hopefully).
- I tried to stop the LMS server, and your code handles it very well (state goes from opened to disconnected). What could be done is perheaps to change in the module the SB-clients state to unknown (we still can do it with notify in the meantime)
2014.01.19 18:24:43 1: 192.168.0.5:9090 disconnected, waiting to reappear
2014.01.19 18:24:43 1: 192.168.0.5:9090 reappeared (SB_server)
2014.01.19 18:24:43 1: 192.168.0.5:9090 disconnected, waiting to reappear
2014.01.19 18:24:49 5: SB_PLAYER_Set: called with ?

- when I start it again, it goes to connected
2014.01.19 18:35:41 5: SB_PLAYER_Set: called with ?
2014.01.19 18:35:53 1: 192.168.0.5:9090 reappeared (SB_server)
2014.01.19 18:36:26 5: SB_PLAYER_GetStatus: called
2014.01.19 18:36:26 5: SB_PLAYER_GetStatus: leaving
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom CMD:mode ARGS:stop...
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom: leaving
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom CMD:artist ARGS:...
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom: leaving
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom CMD:album ARGS:...
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom: leaving
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom CMD:title ARGS:...
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom: leaving
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom CMD:mixer ARGS:volume 37...
2014.01.19 18:36:26 5: ##########VOLUME SET############
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom: leaving
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom CMD:connected ARGS:1...
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom: leaving
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom CMD:power ARGS:1...
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom: leaving
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom CMD:name ARGS:tournedix (Squeezebox Boom)...
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom: leaving
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom CMD:signalstrength ARGS:62...
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom: leaving
2014.01.19 18:36:26 5: SB_PLAYER_Parse: SB_boom CMD:player ARGS:ip ? 192.168.0.16:64832...

The squeezebox status recovers correctly

So I do not understand your issue about the SB-server . It does not work the same for you ?
The only issue is about the SB status

cutter

Hallo bugster_de

Irgendwie stehe ich gerade auf dem Schlauch oder das Modul geht bei mir nicht.
Wie muss die define aussehen ???

d0np3p3

FHEM: Raspberry Pi (COC) & Fritz 7270 (freetz FHEM2FHEM)
IT (Elro AB440 AB600D) - Max! (6*regler 1*Thermostat 5*Fenster) Hue Bridge mit Bulbs - 2*Living-white Adapter - Iris
XBMC (Zbox) 4*SqueezeRadios 3*squeezelite dbox
AndFhem (Nexus4)

bugster_de

@cutter: wie sieht denn dein aktuelles define aus?

bsp.:
define sbsrv SB_SERVER 192.172.53.17

oder:
define sbsrv SB_SERVER 192.172.53.17:9090

Achtung: der angegebene Port ist der Port des CLI Interfaces und nicht der des Webfrontends. Per default steht dies beim SB Server auf 9090.

wilfo

Hallo

Ich hab da mal wieder ein Problem.
da scheint was zu kollidieren.
FHEM behauptet meine 2 Player haben die gleiche IP-Adresse, was mal nicht stimmt.
Ich hab mich jetzt eine weile damit gespielt
Wenn ich meine Squeezebox alleine ranhäng erkennt er sie mit der richtigen IP.
Wenn ich dann meinen Squeezeplayer dran mach hat die Squeezebox wieder die selbe IP wie der Squeezeplayer
ich hab zwischen den Versuchen immer wieder restarts gemacht und natürlich jedes mal die Zeilen aus der fhem.cfg gelöscht.

Hat irgendwer das selbe oder eine Ahnung was ich überseh

sg
wilfo

d0np3p3

Nur so eine Idee, hast du dem Player eine andere Mac als 00:00:00:00:00:00 gegeben, vielleicht hilft das.
FHEM: Raspberry Pi (COC) & Fritz 7270 (freetz FHEM2FHEM)
IT (Elro AB440 AB600D) - Max! (6*regler 1*Thermostat 5*Fenster) Hue Bridge mit Bulbs - 2*Living-white Adapter - Iris
XBMC (Zbox) 4*SqueezeRadios 3*squeezelite dbox
AndFhem (Nexus4)

bugster_de

Hi,

die IP, die in FHEM für den Player angegeben ist, ist die, die der SB-Server zurück meldet. Ob diese dann tatsächlich richtig ist, kann man nur durch einen Blick in den Router sagen ...
Die IP Adresse fragt FHEM nur ca. alle 5 Minuten vom Server ab. Vielleicht einfach mal diese 5 Minuten warten um zu sehen, ob sich ein Update ergibt.

In Summe gehe ich aber mal davon aus, dass es trotzdem funktioniert, da die IP Adresse in FHEM nur angezeigt wird und sonst nicht genutzt wird. Sprich sie ist eigentlich egal, da nur die MAC Adresse des Players wichtig ist. Diese sollte stimmen und sie sollte im Netzwerk eindeutig sein. Wenn Du, wie d0np3p3 schon schreibt hier zweimal die gleiche MAC vergeben hast, dann geht es nicht. Das ist aber dann unabhängig von FHEM, denn dann sollte es auch schon beim Squeezbox Server PC nicht gehen.

wilfo

@d0np3p3: Beide haben eine andere eindeutige MAC

@Bugster: Im Prinzip funktioniert alles mit der Ausnahme, dass er nicht von anfang an beide Player anzeigt, wobei ich nicht sagen kann ob das vieleicht auch nur ungeduld war.
Zu deiner 5 Minuten theorie: leider nein.
FHEM hatte die ganze Nacht und den halben Tag Zeit.
Der SqueezeboxServer selbst erkennt alles richtig.

Es is auch nicht so tragisch, weil wie du schon sagst funktioniert trotzdem alles. :-)

sg
wilfo