Squeezebox Modul - erste Version

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

Vorheriges Thema - Nächstes Thema

bugster_de

#60
@oliv06:
- sayText, showText and message commands are already in the code but I have not yet documented them, as they crash SB Server when used with software players like Squeezeslave. So I have to look in more detail into that
- the passthru is also already implemented but I didn't publish that one yet. Will come in the next couple of days
- notifications: I'm not sure if I got that topic correctly. Does that mean, that a SB Player like the boom can receive any arbitrary IR command and pass it on? That would indeed be excellent. Do you have more dteails on that?

At the minute, my code is opening a connection to the CLI interface, sending the command and closing the connection aafterwards. I'm working on implementing also the feedback channel, that CLI supports, that means, that the connection needs to be open all the time which would block fhem. So I'm working on some major modification to handle the connection in the 'standard' FHEM way but I have to say, that there is not at all any documentation on the FHEM side available on how to implement that. In order to implement the IR commands, that would be needed.

@cutter: >>Was ich noch gut fände, wenn der State ein on oder off anzeigt dann könnte man damit angeschlossene Lautsprecher über ein Funksteckdose ein- und aus-schalten
heisst das, dass der state on or off sein soll? Das ist kein problem. Ich bin mir eh immer unschlüssig, wie die state Variable zu belegen ist.

Meesus

Hi,

ich muss hier nochmal fragen, ob ich der einzige bin, wo die Funktion nicht geht.

-schnipp-
Hi bugster,

schaust Du auch nochmal nach:
"Next" und "Prev" ?

Bei diesen Funktionen wiederholt er jetzt nur noch bei mir die Wiedergabe. Kein Skip möglich.

@All: Geht das bei den anderen hier ?
-schnapp-
Raspberry 4 - FHEM 6.1 - HMLAN, CUL V3 433Mhz & 868Mhz, HM, Intertechno, HUE, Tasmota, Shelly, ESP Devices, Max! und Alexa - Banana PI zum testen

wilfo

@Meesus

bei mir funktionierts wies soll, auch next und prev

bugster_de

@meesus: bei mir geht das auch. Wenn man allerdings nur ein Lied in der Playlist hat (z.B. man hört Webradio), dann 'fühlt' es sich so an, als ob ständig wiederholt wird.
Kannst Du mal deinen Aufruf posten (als set myplayer next)?

Bitte am besten beim Einspielen der Version ein shutdown restart machen.

oliv06

Zitat von: bugster_de am 16 Januar 2014, 09:58:51
- notifications: I'm not sure if I got that topic correctly. Does that mean, that a SB Player like the boom can receive any arbitrary IR command and pass it on? That would indeed be excellent. Do you have more dteails on that?
Yes, seems to work that way. When you do "listen 1" on the CLI then :
with a SB remote you may have something like :
00%3A04%3A20%3A1f%3A5c%3A85 ir 7689d02f 952381.144
00%3A04%3A20%3A1f%3A5c%3A85 button done_passbackplaylist 952381.144 1
00%3A04%3A20%3A1f%3A5c%3A85 ir 7689d02f 952381.196

and with another one :
00%3A04%3A20%3A1f%3A5c%3A85 ir c53a9966 952454.178
00%3A04%3A20%3A1f%3A5c%3A85 unknownir c53a9966 952454.178
00%3A04%3A20%3A1f%3A5c%3A85 ir f50a6d92 952454.267
00%3A04%3A20%3A1f%3A5c%3A85 unknownir f50a6d92 952454.267
00%3A04%3A20%3A1f%3A5c%3A85 ir c53a9966 952454.356
00%3A04%3A20%3A1f%3A5c%3A85 unknownir c53a9966 952454.356
00%3A04%3A20%3A1f%3A5c%3A85 ir f50a6d92 952454.445
00%3A04%3A20%3A1f%3A5c%3A85 unknownir f50a6d92 952454.445
00%3A04%3A20%3A1f%3A5c%3A85 ir c53a9966 952454.535
00%3A04%3A20%3A1f%3A5c%3A85 unknownir c53a9966 952454.535
00%3A04%3A20%3A1f%3A5c%3A85 ir f50a6d92 952454.624
00%3A04%3A20%3A1f%3A5c%3A85 unknownir f50a6d92 952454.624


I tried the same with a squeezebox radio but I hardly receive anything about ir , as stated in the doc :
Zitat<playerid> unknownir <ircode> <time>

This signals an IR code unkown by the server. The syntax is the same than the one used by "ir".

Note: This is only available on SB Classic, SB Boom and Transporter. SB Touch and SB Radio handle IR codes locally and do not report them to the server anymore.

cutter

Hallo

Ja ich meinte ein on oder off im state dann könnte ich mein SB Radio in der Küche einschalten und Fhem könnte die Lautsprecher über HM-Steckdose einschalten.

Volume im State braucht glaube ich keiner. Ich regle die Lautstärke über Fhem mit einem slider-Dummy.

ich stelle das Skript hier mal zur Verfügung für Anfänger, so was hilft immer weiter.
Muss nur angepasst werden

define KU_SB_Volume dummy
attr KU_SB_Volume group Multimedia
attr KU_SB_Volume room Kueche
attr KU_SB_Volume setList state:slider,0,1,100
attr KU_SB_Volume webCmd state
attr KU_SB_Volume event-on-change-reading state

define act1_KU_SB_Volume notify KU_SB_Volume {\
my $volume1;;\
   $volume1 = ReadingsVal("KU_SB_Volume", "state", "??");;\
   {\
   system"wget -O /dev/null -q 'http://192.168.2.57:9030/status.html?p0=mixer&p1=volume&p2=$volume1&player=192.168.2.108'";;\
   }\
}

define act_KU_SB_Volume notify SB_kueche:volume:.* {\
my $SBKUstatus=ReadingsVal("SB_kueche", "volume", "??");;\
fhem "set KU_SB_Volume $SBKUstatus";;\
}

Noch nicht ganz auf dein Modul umgestellt aber es funktioniert.

Ich hoffe du Arbeitest noch an dem Wecker, das wäre die Krönung.
   

oliv06

Zitat von: bugster_de am 16 Januar 2014, 09:58:51
- sayText, showText and message commands are already in the code but I have not yet documented them, as they crash SB Server when used with software players like Squeezeslave. So I have to look in more detail into that
For TTS, I would appreciate that you include an option on language : Would be nice that there is an attribute for this such as
attr SB_radio lang de
which would be used instead of a hard-coded language in the call to google ...

bugster_de

Hi,

so, ich habe ein bisschen gebastelt und mache euch schon mal den Mund wässrig:
- das Kommando set <name> show line1:text line2:text duration:ss zeigt Text auf dem Display an
- der Wecker ist eingebaut und geht. Ich verwalte aber nur einen Wecker, auch wenn Player mehrer kann. Mittels delete kann man den dann wieder löschen und mittels enable|disable aktivieren
- mittels dem Kommando cliraw kann man direkte Befehle an das CLI Interface schicken. Die Antwort steht dann im lastresponse reading. Somit einfach mal die CLI Dokumentation lesen und diese Befehle absetzen
- volume ist per slider setztbar (somit auch direkt in der Raumansicht)
- state zeigt nun on oder off
- mit dem Kommando httpwrite kann man die HTTP Schnittstelle des Players direkt bedienen. Einfach die SB Doku durchschauen und diese Befehle absetzen.

Allerdings hat mir das Modul in der letzte Stunde mein FHEM mehrfach komplett in die Tiefe gerissen, weshalb ich erstmal noch debuggen möchte. Modul kommt dann im Laufe des Wochenendes.

Gute Nacht !

bugster_de

@oliv06: I did play around a little with the listen 1 today and going for that setup would have significant other benefits also. But that means a major re-work of the code so might take some time. It basically means to go for a two step module in FHEM and there is not a lot of doku. I managed to get a first setup working, but more time is needed for that ...

d0np3p3

Zitat von: bugster_de am 16 Januar 2014, 09:58:51
At the minute, my code is opening a connection to the CLI interface, sending the command and closing the connection aafterwards. I'm working on implementing also the feedback channel, that CLI supports, that means, that the connection needs to be open all the time which would block fhem. So I'm working on some major modification to handle the connection in the 'standard' FHEM way but I have to say, that there is not at all any documentation on the FHEM side available on how to implement that. In order to implement the IR commands, that would be needed.
Hallo das XBMC Modul benutzt auch cli und bekommt auch notifys wie Play usw. vielleicht bringt dir das was, weiterhin könnte man die Remote direkt in Modul übenehmen(wie bei XBMC)
ich habe sie mir ja schon manuell eingebaut
Gruß und ich freue mich schon auf das neue Release
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

#70
Hi,

Danke für die Info. Xbmc kenne ich. Bei Squeezebox ist es so, dass das CLI Interface im listen Modus alle Messages schickt. Sprich nicht nur die, die für den gewählten Player relevant sind sondern einfach alles, was da so vor sich geht. Das hat aus meiner Sicht erstmal zwei Nachteile, wenn man mehr als einen Player (also Mutli-Room) im Einsatz hat:
- das Parsen wird aufwändig, da man rausfiltern muß, welche Nachricht einen wirklich interessiert
- die Netzwerklast geht nach oben, wenn man mehrere Player hat, da jeder listener am CLI alle Nachrichten erhält.

Sprich deshalb würde ich das gerne zweistufig aufsetzen:
- einen 'Handler' für die CLI Kommunikation, um die Netzwerklast gering zu halten
- jeweils ein FHEM Modul pro Player Instanz

Mit diesem Setup sind wir aber im Bereich der zweistufigen FHEM Module (und XBMC ist kein solches) sowie im bereich der Multithreaded Ausführung (fork). Beides ist in der FHEM Development Community noch nicht sehr gut dokumentiert. Wir haben die letzten Tage einen Wiki Artikel angefangen, um die Erkenntnisse zusamme zu tragen.

Sprich momentan fahre ich zweigleisig: ich treibe das hier gepostete Modul voran, damit ihr das nutzen könnt und arbeite parallel an der neuen Architektur. Deshalb auch neulich die Änderung im define, um es kompatibel zu halten.

cutter

#71
Hallo

Schön das du den Slider-Dummy mit ins Modul aufgenommen hast.
Kannst du vielleicht noch einen zweiten Wecker mit aufnehmen. Da würde meine Frau sich bestimmt freuen wenn sie Abends am tab den Schlafmodus aktiviert und sie den Wecker (SB-Radio) stellen bzw. einschalten kann  ;D. Kann man den Wecker auch Stellen oder nur an oder aus schalten ?
Kommando Show ist natürlich auch Genial !!!

Ich freue mich schon aufs WE und dein SB-Modul
   

bugster_de

Hi,

Klar kann man den Wecker setzen (mit Fhem üblichem Zeit Format), löschen, enable/disable

oliv06

Could you please change this line so common attributes such as event-on-change-reading are available (useful to minimize number of events)

in SB_PLAYER_Initialize :
$hash->{AttrList}  = "timer volumeStep timeout loglevel:1,2,3,4,5 ".$readingFnAttributes;
instead of
$hash->{AttrList}  = "timer volumeStep timeout loglevel:1,2,3,4,5 "
Thanks

oliv06

It seems also that some variables are not initialized :
I get some warnings on the standard output, such as
Use of uninitialized value in int at ./FHEM/98_SB_PLAYER.pm line 805, <$fh> line 929.
I did not investigate this more as you are changing your code