Phillips HUE Leuchten mit Boblight verwenden

  • Hallo,


    Ich habe mein Skript überarbeitet um HUE Lichter mit Boblight zu verwenden.
    https://gist.github.com/chriszero/8b354c5165b634966dc7


    1. Skript herunterladen

    Code
    wget https://gist.githubusercontent.com/chriszero/8b354c5165b634966dc7/raw/f05f1bf2d743c77f5c935264a4f75cc43b942fe1/newbobhue.py
    chmod +x newbobhue.py


    2. Abhänigkeiten installieren
    eventuell vorher python-pip mittels Paketmanager installieren
    python2
    pip install beautifulhue
    pip install colormath


    newbobhue.py -h zeigt die verfügbaren Optionen


    3. User einrichten, und gleich mal testen, mit

    Code
    newbobhue.py -H 192.168.1.111 -i 1 --testcolor "0 128 254"


    Hinweis vom Skript beachten (Kopf auf der Bridge drücken..)


    newbobhue.py -H 192.168.1.111 -i 1 --off
    Schaltet das Licht wieder aus


    4. boblight.conf anpassen:
    Neues Device eintragen, Pfad, Ip und Id natürlich anpassen


    Code
    [device]
    name huelight
    output python /home/user/newbobhue.py -H 192.168.1.111 -i 1
    channels 3
    type popen
    interval 200000


    bei Bedarf auch die "Colors" hinzufügen


    Das "Licht" definieren

    Code
    [light]
    name HUE1
    color red huelight 1
    color green huelight 2
    color blue huelight 3
    hscan 45 55
    vscan 45 55


    5. Boblight starten / neustarten


    Christian

  • Moin,


    erst mal Danke für das script. Habe allerdings folgendes Problem

    Code
    [root@darkstar src]# ./newbobhue.py -H 192.168.1.198 -i 1 --testcolor "0 128 254"
      File "./newbobhue.py", line 50
        print 'Connected to the Hub'
                                   ^
    SyntaxError: Missing parentheses in call to 'print'


    ... und von python leider gar keinen Plan.


    Grüße, Peter

    KODI, tvh, arch x86_64, Octopus net 2 x Duoflex C/C2/T2 , NUC7i3BNH, Crucial MX300 2TB, LG LM 669S

    Linux is the best OS I have ever seen -- Albert Einstein

  • Du rufst das Skript (das für Python2 geschrieben wurde) mit einem Python3-Interpreter auf und der erwartet Klammern um die Argumente für print, weil das da als "normale" Funktion genutzt wird.
    Gibt es eventuell ein python2 auf deinem System?

    Code
    which python2

    yaVDR-Dokumentation (Ceterum censeo enchiridia esse lectitanda.)

  • seahawk1986:
    Danke für die Erläuterung, python2 ist auch installiert.


    chriszero:
    Geht jetzt schon weiter, allerdings bekomme ich jetzt eine Fehlermeldung bezüglich colormath.
    Liegt wohl daran, dass ich die libs unter / für python3 installiert habe.


    Werde mich morgen mal einlesen, wie man das auf python2 switched ...

    KODI, tvh, arch x86_64, Octopus net 2 x Duoflex C/C2/T2 , NUC7i3BNH, Crucial MX300 2TB, LG LM 669S

    Linux is the best OS I have ever seen -- Albert Einstein

  • Tach,


    ich bräuchte noch mal Nachhilfe:


    Ich habe jetzt (arch) python2-pip und dann mit python2 -m pip install ... die benötigten Module nachinstalliert.


    Mit dem Testaufruf

    Code
    ./newbobhue.py -H phue.fritz.box -i 3 --testcolor "0 128 254"


    bekomme ich jetzt mit dem angeschlossenen ledstrip plus ein cooles blau :tup :tup :tup


    boblight ist installiert, Konfiguration wie in #1 empfohlen.
    vdrboblight ist ebenfalls installiert, config ist default.


    Wenn ich jetzt boblightd und den vdr starte, bleibt die HUE leider noch dunkel.


    Konsole:


    log, vdrboblight mit loglevel 3

    Code
    an 26 21:48:40 darkstar vdr[2671]: BOBLIGHT: Softhddevice NOT detached: 910
    Jan 26 21:48:40 darkstar vdr[2671]: BOBLIGHT: Got image with 64x64 pixel; 16384 bytes
    Jan 26 21:48:40 darkstar vdr[2671]: BOBLIGHT: sleeping 55ms (15 Hz)
    Jan 26 21:48:40 darkstar vdr[2671]: BOBLIGHT: Softhddevice NOT detached: 910
    Jan 26 21:48:40 darkstar vdr[2671]: BOBLIGHT: Got image with 64x64 pixel; 16384 bytes
    Jan 26 21:48:40 darkstar vdr[2671]: BOBLIGHT: sleeping 62ms (15 Hz)


    Was fehlt noch?


    Grüße, Peter

    KODI, tvh, arch x86_64, Octopus net 2 x Duoflex C/C2/T2 , NUC7i3BNH, Crucial MX300 2TB, LG LM 669S

    Linux is the best OS I have ever seen -- Albert Einstein

  • hab jetzt mal in der boblight.conf unter [device] "debug on" gesetzt.


    Ausgabe:

    Code
    huelight: 0.840010 1.000000 0.000000
    huelight: 0.840474 1.000000 0.000000
    huelight: 0.838325 1.000000 0.000000
    huelight: 0.970904 0.705191 0.558578
    huelight: 0.994747 0.632311 0.600660
    huelight: 0.999052 0.517826 0.471868
    huelight: 0.999829 0.418914 0.314540
    huelight: 0.999969 0.366132 0.239701


    Sieht mM doch eigentlich gar nicht so schlecht aus, warum leuchtet sie nicht?

    KODI, tvh, arch x86_64, Octopus net 2 x Duoflex C/C2/T2 , NUC7i3BNH, Crucial MX300 2TB, LG LM 669S

    Linux is the best OS I have ever seen -- Albert Einstein

  • Bekommst du mit boblight-constant eine Farbe? Eventuell VDR bzw Plugin deaktivieren.
    Plugin steht auf "atmo"?


    Plugin steht auf atmo.


    Mit boblight-constant FF00FF bekomme ich auch kein Licht (die debugausgabe von boblightd zeigt aber, dass es ankommt)

    KODI, tvh, arch x86_64, Octopus net 2 x Duoflex C/C2/T2 , NUC7i3BNH, Crucial MX300 2TB, LG LM 669S

    Linux is the best OS I have ever seen -- Albert Einstein

  • Kann es sein, dass ich da irgendwo noch ein Problem in der config habe bezüglich des Wertebereichs?


    Bei Aufruf von newbobhue.py mit dem Argument --testcolor, wird die Farbe R G B 8 bit int im Wertebereich von 0 - 255 übergeben, dann funktioniert es ja.
    Die device debug-Ausgabe von boblightd gibt die Werte als float im Wertebereich von 0 - 1 aus.


    Wie bringe ich boblightd dazu, mir den Aufruf von "popen" zu loggen?

    KODI, tvh, arch x86_64, Octopus net 2 x Duoflex C/C2/T2 , NUC7i3BNH, Crucial MX300 2TB, LG LM 669S

    Linux is the best OS I have ever seen -- Albert Einstein

  • Hi,
    also was mir spontan aufgefallen ist:
    chriszero benutzt:

    Code
    output python /home/user/newbobhue.py -H 192.168.1.111 -i 1


    du aber verwendest scheinbar:

    Code
    (CDevice::Process)              huelight: starting with output "python2 /usr/local/src/newbobhue.py -H phue.fritz.box -i 3"


    also: python2


    Zeig doch mal sicherheitshalber deine boblight.conf


    [size=10]nOpacity: Icons
    [size=10]skindesigner: tryoutsglassy

  • chriszero
    So, läuft jetzt :)


    Es lag wie vermutet daran, dass boblightd bei mir float von 0 - 1 ausgibt und newbobhue.py int von 0 -255 erwartet.
    Mit folgendem üblen hack habe ich das in set_color mal angepasst:

    Code
    def set_color(self, rgb):
            if len(rgb) > 0:
    
    
                rgb = rgb.split(' ')
    
    
                r = round(float(rgb[0]) *255)
                g = round(float(rgb[1]) *255)
                b = round(float(rgb[2]) *255)


    Farbe und Helligkeit brauchen noch etwas Feintuning, aber ist definitiv ein neues Seherlebnis :tup :tup :tup
    Mich würde allerdings interessieren, warum es bei dir unmodifiziert läuft.


    Ich verwende zur Zeit folgende Version

    Code
    aur/boblight-v4l r395-1 [installed]


    Es gibt noch ein weiteres build, vielleicht sollte ich das auch mal ausprobieren.


    BooStar:
    Ich habe python2 und python3 parallel installiert, python3 ist default. Deshalb muss python2 explizit aufgerufen werden.


    Grüße, Peter

    KODI, tvh, arch x86_64, Octopus net 2 x Duoflex C/C2/T2 , NUC7i3BNH, Crucial MX300 2TB, LG LM 669S

    Linux is the best OS I have ever seen -- Albert Einstein

  • Der Grund das mein Boblight Werte von 0-255 ausgibt liegt wohl an meinem anderem 576 Kanal Amblight das noch mit dranhängt.


    Ah, das ist nachvollziehbar

    Zitat


    Wie auch immer, habe das Skript angepasst, es wird nun der Wertebereich automatisch erkannt.


    Hmm, die v0.2 funktioniert bei mir im ersten Schnelltest leider nicht (ich weiss, dass das keine besonders qualifizierte Aussage ist, kann mir das ggfs. am Wochendende mal anschauen)


    Grüße, Peter

    KODI, tvh, arch x86_64, Octopus net 2 x Duoflex C/C2/T2 , NUC7i3BNH, Crucial MX300 2TB, LG LM 669S

    Linux is the best OS I have ever seen -- Albert Einstein

  • Hallo,


    der Thread ist zwar fast 1 Jahr alt, ich versuchs trotzdem mal hier.
    Erstmal vielen Dank für das Script - bei mir tuts aber leider nicht:


    Code
    ./newbobhue.py -H 192.168.178.97 -i 7 --testcolor "0 128 254"
    Press the button on the Hue bridge
    Unhandled error creating configuration on the Hue
    [{u'error': {u'type': 6, u'description': u'parameter, username, not available', u'address': u'/username'}}]


    Egal, ob ich den Button vorher gedrückt habe - der Fehler kommt sofort. Wahrscheinlich hat sich irgendwie die API bei der HUE Bridge geändert...
    Ich habe Version 01036562 auf der Hue Bridge.


    Wenn ich einen Key mitgebe, den ich aus meinem FHEM habe, dann kommt zwar:

    Code
    ./newbobhue.py -H 192.168.178.97 -i 4 -u u8DgKzU1XXXX-XXXXYDJqHgqwKSmNEKiCSwTgzN --testcolor "0 128 254"
    Connected to the Hub


    Aber bei den Lampen ändert sich nichts - ich habe auch alle möglichen "-i" schon durchprobiert - ich gehe ja mal davon aus, dass die ID die selbe ist, wie sie auch in FHEM angezeigt wird.


    Über FHEM/Hue App etc. kann ich natürlich kommunizieren und ja, die IP stimmt.


    Kann ich noch irgendetwas tun, um zu debuggen?


    Danke!


    EDIT:
    Habe in dem anderen Thread noch gefunden, dass man mit folgendem den User registrieren soll:

    Code
    curl -H "Content-Type: application/json" -X POST -d '{"devicetype": "boblight", "username": "1234567890"}' http://192.168.178.97/api


    Die Dev Seite von Philips sagt nun aber:

    Code
    curl -H "Content-Type: application/json" -X POST -d '{"devicetype": "boblight"}' http://192.168.178.97/api


    Also ohne Username - und siehe da - das funktioniert. Ich bekomme einen Usernamen zurück.
    Vielleicht kann mir ja jemand helfen, der Python kann - bevor ich mich da durchfummeln muss ;)


    EDIT2:
    ...und das Thema ist wohl, dass das Script die beautifulhue lib verwendet, die nicht mehr gepflegt wird. Ein Philips Mitarbeiter hat sogar genau zu diesem Problem vorher ein issue aufgemacht: https://github.com/allanbunch/beautifulhue/issues/13
    Hierscheint es einen ähnlichen Ansatz zu geben (wenn auch älter) - mit einem Script, was ich einfacher durchschaue und was nicht auf die bibliothek setzt. Ich werde das mal als Startpunkt fürs weitere Basteln nehmen.

    Hardware:
    ||Board: Asus M2NPV-VM | CPU: AMD Athlon(tm) 64 X2 Dual Core Processor 4200 | RAM: 2*1GB DDR2 800
    ||Grafikkarte: POV G210 | Sat: Budget DVB-S, Mystique SaTiX-S2 V2 CI Dual
    ||Platten: Crucial M4 64GB SSD, 2,5" 80GB HITACHI Travelstar 5K250, 3,5" 2TB WD20EARS
    ||Brenner: Samsung SH-S183A | Netzteil: Seasonic SS330HB (330W) | Gehäuse: Silverstone LC-16M.

    3 Mal editiert, zuletzt von dron72 ()

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!