Ankündigung

Einklappen
Keine Ankündigung bisher.

cvcl & pulseaudio funktioniert nicht innerhalb von SmarthomeNG aber ausserhalb

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • brunosa3
    antwortet
    Zitat von bmx Beitrag anzeigen
    Wenn Du SmartHomeNG als Dienst laufen hast, was sagt den ein Code:

    ps aux | grep smarthome
    bmx ich habe den Code erst für den manuellen Start von SmarthomeNG und dann als Dienst im Terminal laufen lassen (siehe unten). Siehst Du hier etwas verdächtiges?

    Code:
    [smarthome@merry /usr/local/smarthome]$ ps aux | grep smarthome
    root     17372  0.1  0.6  12240  6348 ?        Ss   20:31   0:00 sshd: smarthome [priv]
    root     17374  0.1  0.6  12240  6308 ?        Ss   20:31   0:00 sshd: smarthome [priv]
    smartho+ 17380  0.0  0.3  12240  3580 ?        S    20:31   0:00 sshd: smarthome@notty
    root     17382  0.0  0.6  12240  6388 ?        Ss   20:31   0:00 sshd: smarthome [priv]
    smartho+ 17388  0.0  0.5  12576  4832 ?        S    20:31   0:00 sshd: smarthome@pts/0
    smartho+ 17398  0.0  0.3  12240  3504 ?        S    20:31   0:00 sshd: smarthome@notty
    smartho+ 17484  0.0  0.0   7360   544 pts/0    S+   20:34   0:00 grep --color=auto smarthome
    smartho+ 32673  5.8  9.4 409332 89852 ?        Sl   Jan20  72:32 python3 bin/smarthome.py
     [smarthome@merry /usr/local/smarthome]$ sudo systemctl stop smarthome.service
     [smarthome@merry /usr/local/smarthome]$ ps -ef|grep smarthome|grep bin
    smartho+ 32673     1  5 Jan20 ?        01:12:35 python3 bin/smarthome.py
     [smarthome@merry /usr/local/smarthome]$ kill -9 32673
     [smarthome@merry /usr/local/smarthome]$ ps -ef|grep smarthome|grep bin
     [smarthome@merry /usr/local/smarthome]$ sudo systemctl start smarthome.service
     [smarthome@merry /usr/local/smarthome]$ sudo systemctl enable smarthome.service
     [smarthome@merry /usr/local/smarthome]$ sudo systemctl status smarthome.service
    ● smarthome.service - SmartHomeNG daemon
       Loaded: loaded (/lib/systemd/system/smarthome.service; enabled; vendor preset: enabled)
       Active: active (running) since Sat 2023-01-21 20:35:19 CET; 15s ago
     Main PID: 17524 (python3)
        Tasks: 25 (limit: 2062)
       Memory: 34.7M
       CGroup: /system.slice/smarthome.service
               └─17524 /usr/local/bin/python3 /usr/local/smarthome/bin/smarthome.py
    
    Jan 21 20:35:16 merry systemd[1]: Starting SmartHomeNG daemon...
    Jan 21 20:35:19 merry python3[17514]: Daemon PID 17524
    Jan 21 20:35:19 merry systemd[1]: smarthome.service: Supervising process 17524 which is not our child. We'll most likely not n
    Jan 21 20:35:19 merry systemd[1]: Started SmartHomeNG daemon.
    
     [smarthome@merry /usr/local/smarthome]$ ps aux | grep smarthome
    root     17372  0.0  0.6  12240  6348 ?        Ss   20:31   0:00 sshd: smarthome [priv]
    root     17374  0.0  0.6  12240  6308 ?        Ss   20:31   0:00 sshd: smarthome [priv]
    smartho+ 17380  0.0  0.3  12240  3580 ?        S    20:31   0:00 sshd: smarthome@notty
    root     17382  0.0  0.6  12240  6388 ?        Ss   20:31   0:00 sshd: smarthome [priv]
    smartho+ 17388  0.0  0.5  12576  4832 ?        S    20:31   0:00 sshd: smarthome@pts/0
    smartho+ 17398  0.0  0.3  12240  3504 ?        S    20:31   0:00 sshd: smarthome@notty
    smartho+ 17524 82.0  7.5 385636 71228 ?        S<l  20:35   0:44 /usr/local/bin/python3 /usr/local/smarthome/bin/smarthome.py
    smartho+ 17648  0.0  0.0   7360   540 pts/0    S+   20:36   0:00 grep --color=auto smarthome
    ​

    Zitat von bmx Beitrag anzeigen
    Und was steht in Deiner /etc/systemd/system/smarthome.service drin?
    ich habe in der Directory "/etc/systemd/system/​" nichts mit smarthome.service Sollte dies da sein?

    Einen Kommentar schreiben:


  • Morg
    antwortet
    Zitat von brunosa3 Beitrag anzeigen
    bmx tatsächlich es funktioniert nur, wenn ich SmarthomeNG manuell starte

    Hast Du eine Erklärung für das Phenomen?
    Zitat von Morg Beitrag anzeigen
    Das kann dir wahrscheinlich eher jemand in der vlc- bzw. cvlc​-Community beantworten. Es gibt viele Programme, die unterschiedlich reagieren, je nachdem, ob sie ein Terminal haben oder nicht.

    Einen Kommentar schreiben:


  • bmx
    antwortet
    Wenn Du SmartHomeNG als Dienst laufen hast, was sagt den ein
    Code:
    ps aux | grep smarthome
    auf der Kommandozeile?

    Und was steht in Deiner /etc/systemd/system/smarthome.service drin?
    Zuletzt geändert von bmx; 21.01.2023, 07:50.

    Einen Kommentar schreiben:


  • brunosa3
    antwortet
    bmx tatsächlich es funktioniert nur, wenn ich SmarthomeNG manuell starte

    Hast Du eine Erklärung für das Phenomen? Gibt es irgendwelche Nachteile beim manuellen starten im Vergleich zum Dienst (ausser das ich SmarthomeNG nicht mehr über die Web restarten kann)?


    Jetzt wo es funktioniert fällt mir auf, dass meine Logik nur das letzte Item in meiner for loop durchführt dh nur der letzte Raum schaltet den Lautsprecher an. Mach ich hier etwas falsch?

    Code:
    if trigger['source'] == "haus.eg.flur.tuere.klingel":
        if "ding_dong" in sh.haus.eg.flur.tuere.klingel():
            for item in sh.haus.eg.return_children():
                logger.warning("ding_dong! Its ringing on the door - turn on speakers in {}".format(item))
                try:
                    item.audio.status.turnonvolume(30)
                    item.audio.status.source(5)
                    item.audio.status(1)
                except Exception as e:
                    logger.warning("Try except error! with item {} error: {}".format(item, e))​


    der log hat alle items richtig eingetragen - das ändern der Listenreihenfolge ergibt wie erwähnt, dass nur das letze Item Sound im Raum hat .

    Code:
    2023-01-20  23:52:15 WARNING  logics.audio        ding_dong! Its ringing on the door - turn on speakers in sh.haus.eg.flur
    2023-01-20  23:52:15 WARNING  logics.audio        ding_dong! Its ringing on the door - turn on speakers in sh.haus.eg.wc
    2023-01-20  23:52:15 WARNING  logics.audio        ding_dong! Its ringing on the door - turn on speakers in sh.haus.eg.wohn_esszimmer
    2023-01-20  23:52:15 WARNING  logics.audio        ding_dong! Its ringing on the door - turn on speakers in sh.haus.eg.kueche​

    Einen Kommentar schreiben:


  • bmx
    antwortet
    Code:
    # service/daemon stoppen
    sudo systemctl stop smarthome.service
    
    #unterverzeichnis ansteuern
    cd /usr/local/smarthome
    
    # vorsichtshalber noch mal shng stoppen falls es noch läuft
    python3 bin/smarthome.py -s
    
    # und manuell starten
    python3 bin/smarthome.py

    Einen Kommentar schreiben:


  • brunosa3
    antwortet

    Zitat von Morg Beitrag anzeigen
    Das kann dir wahrscheinlich eher jemand in der vlc- bzw. cvlc​-Community beantworten

    Morg Ich glaube nicht, dass es an vlc liegt. Die Beschreibung oben gilt für mpg123 welches die Audiotreiber "alsa" und "pulse" nicht im SmarthomeNG laden kann aber ausserhalb schon. VLC funktioniert auch nicht wie anfangs beschrieben und jetzt habe ich es mit text to speach probiert - gleiches Muster - wenn ich es ausserhalb von SmarthomeNG laufen lass funktioniert alles - sobald ich es aber in der Logik von SmarthomeNG laufen lasse geht nichts.

    text_to_speech.py
    Code:
    import pyttsx3
    import random
    
    try:
        text = ["Good Mording Kyla",
            "Good Morning Caren",
            "Good Mording Zola",
            "Good Mording Sandro"]
    
    
        engine=pyttsx3.init()
        engine.setProperty('rate',100)
        voices=engine.getProperty('volume')
        engine.setProperty('volume', 1)
        voices = engine.getProperty('voices')
        engine.setProperty('voice', 'english+f3')
        engine.say(random.choice(text))
    
        engine.runAndWait()
        print("there was no error and someone should have spoken")
    except Exception as e:
        print(e)​
    Code:
     [smarthome@merry /usr/local/smarthome]$ python3 logics/text_to_speech.py
    there was no error and someone should have spoken
    ​

    Zitat von bmx Beitrag anzeigen
    Hast Du mal SHNG nicht als Dienst gestartet und dann getestet ob es geht?
    bmx Wie mache ich das genau?

    Ich bin mir nicht sicher ob das richtig ist aber ich dachte man kann es so machen und ohne enable läuft es nicht als Dienst - ist das richtig?
    Code:
    sudo systemctl stop smarthome.service
    sudo systemctl start smarthome.service

    Einen Kommentar schreiben:


  • Morg
    antwortet
    Zitat von brunosa3 Beitrag anzeigen
    Die Audio Datei gehört auch dem user smarthome und der Gruppe smarthome --> habbe die Rechte jetzt voll aufgedreht (777) hat auch nichts gebracht.
    Natürlich nicht. Wie oben ja steht, sind die Rechte auf dem audio-Device nicht das Problem.

    ich verstehe nicht warum das launchen von cvlc über den SmarthomeNG Dienst das Display module benötigt und man ausserhalb (siehe unten) direkt im terminal oder über ein python skript im Terminal vom gleichen user kein display benötig (sondern nur das Dummy modul)
    Das kann dir wahrscheinlich eher jemand in der vlc- bzw. cvlc​-Community beantworten. Es gibt viele Programme, die unterschiedlich reagieren, je nachdem, ob sie ein Terminal haben oder nicht.

    Einen Kommentar schreiben:


  • bmx
    antwortet
    Hast Du mal SHNG nicht als Dienst gestartet und dann getestet ob es geht?

    Einen Kommentar schreiben:


  • brunosa3
    antwortet
    bmx Morg also es scheint wirklich am SmarthomeNG Dienst zu liegen.

    Habe mit den audio drivern gespielt - im Terminal funktioniert das abspielen der Audio-Datei mit alsa und pulse - sobald ich es aber in SmarthomeNG laufen lasse kann er das modul vom driver nicht finden.

    2023-01-19 22:33:49 WARNING logics.audio result,errb'High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3\n\tversion 1.25.10; written and copyright by Michael Hipp and others\n\tfree software (LGPL) without any warranty but with best wishes\n[src/libout123/module.c:133] error: Failed to open module pulse.\n[src/libout123/libout123.c:455] error: Found no driver out of [ pulse] working with device <default>.\nmain: [src/mpg123.c:309] error: out123 error 3: failure loading driver module\n'
    2023-01-19 22:31:40 WARNING logics.audio result,errb'High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3\n\tversion 1.25.10; written and copyright by Michael Hipp and others\n\tfree software (LGPL) without any warranty but with best wishes\n[src/libout123/module.c:133] error: Failed to open module alsa.\n[src/libout123/libout123.c:455] error: Found no driver out of [ alsa] working with device <default>.\nmain: [src/mpg123.c:309] error: out123 error 3: failure loading driver module\n'
    Könnt Ihr Euch dieses Verhalten erklären? Ich verstehe noch zu wenig was imbackend von der SmarthomeNG passiert

    Einen Kommentar schreiben:


  • brunosa3
    antwortet
    Es gibt für den cvcl player sogar ein Argument -Vdummy welches das Dummy Interface triggert. Funktioniert im Terminal und nicht in SmarthomeNG. Ich glaube nicht, dass dies das Problem ist.

    Code:
    subprocess.Popen(["cvlc", "/usr/local/smarthome/media/audio/klingel/01_ding_dong.mp3", "-Vdummy", "--play-and-exit"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    023-01-19 21:27:07 WARNING logics.audio Logik 'audio' (filename 'audio.py') wurde getriggert at Thu Jan 19 21:27:07 2023 (WARNING)
    2023-01-19 21:27:07 WARNING logics.audio Triggered: trigger['source'] = haus.eg.flur.tuere.klingel, trigger[by] = Item, trigger[value] = ding_dong
    2023-01-19 21:27:07 WARNING logics.audio ding_dong! Its ringing on the door - tunrn on speakers in haus.eg.kueche
    2023-01-19 21:27:07 WARNING logics.audio ding_dong! Its ringing on the door - tunrn on speakers in haus.eg.wohn_esszimmer
    2023-01-19 21:27:07 WARNING logics.audio ding_dong! Its ringing on the door - tunrn on speakers in haus.eg.buero
    2023-01-19 21:27:07 WARNING logics.audio ding_dong! Its ringing on the door - tunrn on speakers in haus.eg.flur
    2023-01-19 21:27:07 WARNING logics.audio ding_dong! Its ringing on the door - tunrn on speakers in haus.eg.wc
    2023-01-19 21:27:07 WARNING logics.audio music played; time 1674160027.7270086
    2023-01-19 21:27:18 WARNING logics.audio result,errb'[014a6498] vlcpulse audio output error: PulseAudio server connection failure: Verbindung verweigert\n[014e6300] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11\n[014e6300] main interface error: no suitable interface module\n[01421b58] main libvlc error: interface "dbus,none" initialization failed\n[014e22e8] main interface error: no suitable interface module\n[01421b58] main libvlc error: interface "globalhotkeys,none" initialization failed\n[014e22e8] dummy interface: using the dummy interface module...\n[01497150] main playlist: end of playlist, exiting\n'
    2023-01-19 21:27:18 WARNING logics.audio music played next line; time 1674160038.1187634
    2023-01-19 21:27:23 WARNING logics.audio time start: 1674160043.1243355
    2023-01-19 21:27:23 WARNING logics.audio time stop: 1674160043.1703336​

    Einen Kommentar schreiben:


  • brunosa3
    antwortet
    Hey bmx & Morg

    vielen Dank für Eure schnelle Antwort.

    bmx Ich habe das SmarthomeNG als Dienst laufen.

    Der SmarthomeNG Dienst läuft unter dem user smarthome
    Code:
    [smarthome@merry /usr/local/smarthome]$ ps -ef|grep smarthome|grep bin
    smartho+ 13244     1  6 Jan16 ?        04:39:12 /usr/local/bin/python3 /usr/local/smarthome/bin/smarthome.py
    ​
    Die Audio Datei gehört auch dem user smarthome und der Gruppe smarthome --> habbe die Rechte jetzt voll aufgedreht (777) hat auch nichts gebracht.


    Morg ich verstehe nicht warum das launchen von cvlc über den SmarthomeNG Dienst das Display module benötigt und man ausserhalb (siehe unten) direkt im terminal oder über ein python skript im Terminal vom gleichen user kein display benötig (sondern nur das Dummy modul)


    bmx​ hab mir mpg123 runtergeladen und auch im Terminal läuft es mit Ton auf den Boxen - wenn ich es mit dem SmarthomeNG Dienst laufen lass funktioniert es laut log (siehe unten auch). Jedoch kommt kein Ton aus dem Lautsprecher

    Code:
    command = subprocess.Popen(["mpg123", "-z", "/usr/local/smarthome/media/audio/klingel/02_ding_dong.mp3"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    2023-01-19 21:04:37 WARNING logics.audio Logik 'audio' (filename 'audio.py') wurde getriggert at Thu Jan 19 21:04:37 2023 (WARNING)
    2023-01-19 21:04:37 WARNING logics.audio Triggered: trigger['source'] = haus.eg.flur.tuere.klingel, trigger[by] = Item, trigger[value] = ding_dong
    2023-01-19 21:04:37 WARNING logics.audio ding_dong! Its ringing on the door - tunrn on speakers in haus.eg.kueche
    2023-01-19 21:04:37 WARNING logics.audio ding_dong! Its ringing on the door - tunrn on speakers in haus.eg.wohn_esszimmer
    2023-01-19 21:04:37 WARNING logics.audio ding_dong! Its ringing on the door - tunrn on speakers in haus.eg.buero
    2023-01-19 21:04:37 WARNING logics.audio ding_dong! Its ringing on the door - tunrn on speakers in haus.eg.flur
    2023-01-19 21:04:37 WARNING logics.audio ding_dong! Its ringing on the door - tunrn on speakers in haus.eg.wc
    2023-01-19 21:04:37 WARNING logics.audio music played; time 1674158677.786157
    2023-01-19 21:04:45 WARNING logics.audio result,errb'High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3\n\tversion 1.25.10; written and copyright by Michael Hipp and others\n\tfree software (LGPL) without any warranty but with best wishes\n\nDirectory: /usr/local/smarthome/media/audio/klingel/\nPlaying MPEG stream 1 of 1: 02_ding_dong.mp3 ...\n\nMPEG 2.0 L III cbr32 24000 mono\n\n[0:07] Decoding of 02_ding_dong.mp3 finished.\n'
    2023-01-19 21:04:45 WARNING logics.audio music played next line; time 1674158685.7039442
    2023-01-19 21:04:50 WARNING logics.audio time start: 1674158690.707631
    2023-01-19 21:04:50 WARNING logics.audio time stop: 1674158690.757691​
    Morg das war der player der bei mir ohne Probleme sofort funktioniert hat

    das ganze kommt mir trotzdem recht komisch vor - warum es ausserhalb vom SmarthomeNG Dienst nicht funkt - jedoch aber ausserhalb

    Einen Kommentar schreiben:


  • Morg
    antwortet
    Wozu er das braucht, weiß ich nicht genau - VLC ist aber eigentlich als Videoplayer konzipiert, da würde sich das anbieten

    Ggf. gibt es ja auch Möglichkeiten, ihn "ohne" zu starten. Kenne aber das System nicht.

    Einen Kommentar schreiben:


  • bmx
    antwortet
    Hm. Wozu braucht ein daemon ein Display ...?

    Eventuell mal einen anderen Player testen, z.B. mpg123
    Das hat bei mir vor einiger Zeit funktioniert bis meine Hardware sich verabschiedet hatte und ich alles neu aufsetzen musste. Danach wollte der NUC mit Audio nicht mehr so wie ich und bis dato hatte ich noch keine Muße gehabt mich drum zu kümmern.

    Einen Kommentar schreiben:


  • Morg
    antwortet
    dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

    Einen Kommentar schreiben:


  • bmx
    antwortet
    Ist Dein SmartHomeNG denn von Hand gestartet oder als Dienst am Laufen?

    Ist dein User Mitglied der audio Gruppe?

    Hat dein User Lese-Zugriff auf die Audio Datei die abgespielt werden soll?
    Zuletzt geändert von bmx; 19.01.2023, 09:34.

    Einen Kommentar schreiben:

Lädt...
X