Ankündigung

Einklappen
Keine Ankündigung bisher.

keine Verbindung zum MQTT

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

    keine Verbindung zum MQTT

    Hallo zusammen ich habe mir eine zweites System als backup angelegt.
    Die konfigurationen sind bei beiden gleich.
    nur bekomme ich bei der neuen installiertem System keine Verbindung zum MQTT Brocker hin.
    im log bekomme ich diese Infos angezeigt


    Code:
    2022-05-06  06:54:17 ERROR    lib.metadata        module 'mqtt': Found invalid value '' for parameter 'broker_host' (type ip) in /etc/module.yaml, using default value '127.0.0.1' instead
    Code:
    2022-05-06 07:01:50 ERROR modules.mqtt Connection error: [Errno 111] Verbindungsaufbau abgelehnt
    ich habe im Backend und auch in der modue.yaml selbst die ip eingetragen aber alles ohne erfolg


    mit dem altem System klappt die verbindung sofort
    das ist der Status vom MQTT broker
    Code:
    smarthome@smarthome-nuc:~$ sudo service mosquitto status
    ● mosquitto.service - Mosquitto MQTT Broker
    Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
    Active: active (running) since Fri 2022-05-06 06:38:30 CEST; 29min ago
    Docs: man:mosquitto.conf(5)
    man:mosquitto(8)
    Process: 358 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 379 ExecStartPre=/bin/chown mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 381 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 385 ExecStartPre=/bin/chown mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
    Main PID: 387 (mosquitto)
    Tasks: 1 (limit: 8857)
    Memory: 2.6M
    CPU: 915ms
    CGroup: /system.slice/mosquitto.service
    └─387 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
    
    Mai 06 06:38:30 smarthome-nuc systemd[1]: Starting Mosquitto MQTT Broker...
    Mai 06 06:38:30 smarthome-nuc systemd[1]: Started Mosquitto MQTT Broker.

    #2
    muss ich dem Linuxserver noch Zugriffsberechtigungen erteilen so das man sich mit dem Broker verbinden kann?
    wenn ja wie mach ich das ?

    Kommentar


      #3
      Ne, freigeben musst du nix. Kommen die 2 Logzeilen auch NACHDEM du die IP eingetragen hast? Weil dann hat da definitiv was nicht funktioniert. Poste doch mal die Sektion aus dem module.yaml..

      Kommentar


        #4
        • Welche Version von SmartHomeNG setzt Du ein?
        • Wie sieht denn Deine etc/module.yaml aus?

          Der Log Eintrag sagt klar, dass als IP Adresse ein Leer-String erkannt wurde (was ungültig ist) und deshalb der Stanardwert verwendet wird.
        Wenn Du eine gültige IP Adresse einträgst, würde Dich das aber noch nicht zum Ziel bringen, da beide Installationen sich dann mit dem gleichen Client Namen am Broker anmelden, was dieser nicht mag. Das führt dazu, dass die Anmeldung des zweiten SmartHomeNG Servers dazu führt, dass der Broker die Verbindung mit dem ersten SmartHomeNG Server beendet. Worauf hin der erste SmartHomeNG Server ein Reconennt macht, was dazu führt, dass der Broker die Verbindung zum zweiten SmartHomeNG Server beendet, u.s.w.

        Um aus dem Problem herauszukommen gibt es in der letzen Version von SmartHomeNG einen experimentellen (und noch nicht dokumentierten Parameter).

        Aber beantworte erst mal die Fragen oben, denn die IP Verbindung zum Broker ist der erste Schritt und würde reichen, falls nicht beide Systeme gleichzeitig laufen sollen.
        Viele Grüße
        Martin

        There is no cloud. It's only someone else's computer.

        Kommentar


          #5
          Das Bild ist aus dem Backend

          das ist in der Module.yaml

          Code:
          mqtt:
          module_name: mqtt
          broker_host: 192.168.178.39
          broker_port: 1883
          ich verwende SmarthomeNG 1.9.2 master

          die Systeme laufen beide unterschiedlichen raspberry's ich habe den Client so geändert das er zur neuen version verbinden soll sprich 192.168.178.39
          das neue System läuft auch unter 192.168.178.39
          You do not have permission to view this gallery.
          This gallery has 1 photos.
          Zuletzt geändert von fedex; 06.05.2022, 09:32.

          Kommentar


            #6
            Wie ich oben schrieb, wird die ip Adresse aus der etc/module.yaml bei Dir nicht als solche erkannt, weshalb 127.0.0.1 verwendet wird und Da auf dem System kein Broker läuft, wird folgerichtig die Verbindung zu Port 1883, die das mqtt Modul aufbauen möchte, abgelehnt.

            die Frage bleibt also: wieso erkennt SmartHomeNG bei Dir die in der Konfigurationsdatei eingetragene ip Adresse nicht. Mögliche Ansätze:
            - Kommt der Konfigurationseintrag doppelt vor?
            - Werden statt normaler Leerzeichen andere Zeichen verwendet?
            Viele Grüße
            Martin

            There is no cloud. It's only someone else's computer.

            Kommentar


              #7
              das ist die ganze module.yaml
              Code:
              %YAML 1.1
              ---
              # etc/module.yaml
              # support for web server
              http:
              module_name: http
              starturl: admin
              
              # support for graphical admin interface
              admin:
              module_name: admin
              
              websocket:
              module_name: websocket
              #port: 2424
              #tls_port: 2425
              #tls_key: myprivate.key
              #tls_cert: myprivate.pem
              #use_tls: true
              #enable, if mqtt protocol is going to be used
              
              #mqtt:
              # module_name: mqtt
              mqtt:
              module_name: mqtt
              broker_host: 192.168.178.39
              broker_port: 1883
              einen doppelt Eintrag sehe ich nicht
              die Installation habe ich nach der Anleitung auf der Hompage gemacht
              mit
              Code:
              sudo apt-get install mosquitto
              ich bin davon ausgegangen das ich den Broker damit installiert habe
              laut Status (oben) läuft doch der brocker auf diesem System ohne fehler

              in Pi läuft unter der 192.168.178.2 (Mqtt funktioniert)
              der andere unter der 192.168.178.39 (Mqtt läuft aber keien verbindung)

              Kommentar


                #8
                habe den eintrag nochmal neu in die module.yaml gemacht nun erhalte ich im log diese Fehler
                Code:
                mqtt:
                module_name: mqtt
                broker_host: 192.168.178.39
                broker_port: 1883
                Code:
                2022-05-06 11:16:54 ERROR plugins.mqtt Module 'mqtt' not loaded. The plugin is not starting
                2022-05-06 11:16:54 ERROR lib.plugin Plugin 'mqtt' initialization failed, plugin not loaded
                2022-05-06 11:20:46 ERROR modules.mqtt Connection error: [Errno 111] Verbindungsaufbau abgelehnt

                Kommentar


                  #9
                  Was sagt denn das Log des Brokers?

                  Viele Grüße
                  Martin

                  There is no cloud. It's only someone else's computer.

                  Kommentar


                    #10
                    Damit die Einrückungen hier im Forum korrekt angezeigt werden, bitte hier orientieren: https://knx-user-forum.de/forum/supp...-einf%C3%BCgen

                    Kommentar


                      #11
                      Hallo das ist mein log von Mosquitto

                      PHP-Code:
                      1651754409: mosquitto version 2.0.11 starting
                      1651754409
                      : Config loaded from /etc/mosquitto/mosquitto.conf.
                      1651754409: Starting in local only mode. Connections will only be possible from clients running on this machine.
                      1651754409: Create a configuration file which defines a listener to allow remote access.
                      1651754409: For more details see https://mosquitto.org/documentation/authentication-methods/
                      1651754409: Opening ipv4 listen socket on port 1883.
                      1651754409
                      : Opening ipv6 listen socket on port 1883.
                      1651754409
                      : mosquitto version 2.0.11 running
                      1651756210
                      : Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651758011: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651759812: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651761613: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651763414: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651765215: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651767016: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651768817: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651770618: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651772419: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651774220: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651776021: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651777822: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651779623: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651781424: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651783225: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651785026: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651786654: mosquitto version 2.0.11 terminating
                      1651786654
                      : Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651786766: mosquitto version 2.0.11 starting
                      1651786766
                      : Config loaded from /etc/mosquitto/mosquitto.conf.
                      1651786766: Starting in local only mode. Connections will only be possible from clients running on this machine.
                      1651786766: Create a configuration file which defines a listener to allow remote access.
                      1651786766: For more details see https://mosquitto.org/documentation/authentication-methods/
                      1651786766: Opening ipv4 listen socket on port 1883.
                      1651786766
                      : Opening ipv6 listen socket on port 1883.
                      1651786766
                      : mosquitto version 2.0.11 running
                      1651787541
                      : New connection from 127.0.0.1:45395 on port 1883.
                      1651787541
                      : New client connected from 127.0.0.1:45395 as smarthome-nuc.MQTT-module (p2, c1, k60, u'max').
                      1651788567: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651788849: Client smarthome-nuc.MQTT-module disconnected.
                      1651788857: New connection from 127.0.0.1:52435 on port 1883.
                      1651788857
                      : New client connected from 127.0.0.1:52435 as smarthome-nuc.MQTT-module (p2, c1, k60, u'max').
                      1651789234: Client smarthome-nuc.MQTT-module closed its connection.
                      1651789234: mosquitto version 2.0.11 terminating
                      1651789234
                      : Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651789284: mosquitto version 2.0.11 starting
                      1651789284
                      : Config loaded from /etc/mosquitto/mosquitto.conf.
                      1651789284: Starting in local only mode. Connections will only be possible from clients running on this machine.
                      1651789284: Create a configuration file which defines a listener to allow remote access.
                      1651789284: For more details see https://mosquitto.org/documentation/authentication-methods/
                      1651789284: Opening ipv4 listen socket on port 1883.
                      1651789284
                      : Opening ipv6 listen socket on port 1883.
                      1651789284
                      : mosquitto version 2.0.11 running
                      1651789297
                      : New connection from 127.0.0.1:35401 on port 1883.
                      1651789297
                      : New client connected from 127.0.0.1:35401 as smarthome-nuc.MQTT-module (p2, c1, k60).
                      1651789607: Client smarthome-nuc.MQTT-module closed its connection.
                      1651789607: mosquitto version 2.0.11 terminating
                      1651789607
                      : Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651809319: mosquitto version 2.0.11 starting
                      1651809319
                      : Config loaded from /etc/mosquitto/mosquitto.conf.
                      1651809319: Starting in local only mode. Connections will only be possible from clients running on this machine.
                      1651809319: Create a configuration file which defines a listener to allow remote access.
                      1651809319: For more details see https://mosquitto.org/documentation/authentication-methods/
                      1651809319: Opening ipv4 listen socket on port 1883.
                      1651809319
                      : Opening ipv6 listen socket on port 1883.
                      1651809319
                      : mosquitto version 2.0.11 running
                      1651809327
                      : New connection from 127.0.0.1:49389 on port 1883.
                      1651809327
                      : New client connected from 127.0.0.1:49389 as smarthome-nuc.MQTT-module (p2, c1, k60).
                      1651811120: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651811165: Client smarthome-nuc.MQTT-module closed its connection.
                      1651811165: mosquitto version 2.0.11 terminating
                      1651811165
                      : Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651811574: mosquitto version 2.0.11 starting
                      1651811574
                      : Config loaded from /etc/mosquitto/mosquitto.conf.
                      1651811574: Starting in local only mode. Connections will only be possible from clients running on this machine.
                      1651811574: Create a configuration file which defines a listener to allow remote access.
                      1651811574: For more details see https://mosquitto.org/documentation/authentication-methods/
                      1651811574: Opening ipv4 listen socket on port 1883.
                      1651811574
                      : Opening ipv6 listen socket on port 1883.
                      1651811574
                      : mosquitto version 2.0.11 running
                      1651811582
                      : New connection from 127.0.0.1:51075 on port 1883.
                      1651811582
                      : New client connected from 127.0.0.1:51075 as smarthome-nuc.MQTT-module (p2, c1, k60).
                      1651811886: Client smarthome-nuc.MQTT-module closed its connection.
                      1651811886: mosquitto version 2.0.11 terminating
                      1651811886
                      : Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651811910: mosquitto version 2.0.11 starting
                      1651811910
                      : Config loaded from /etc/mosquitto/mosquitto.conf.
                      1651811910: Starting in local only mode. Connections will only be possible from clients running on this machine.
                      1651811910: Create a configuration file which defines a listener to allow remote access.
                      1651811910: For more details see https://mosquitto.org/documentation/authentication-methods/
                      1651811910: Opening ipv4 listen socket on port 1883.
                      1651811910
                      : Opening ipv6 listen socket on port 1883.
                      1651811910
                      : mosquitto version 2.0.11 running
                      1651813711
                      : Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651815512: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651817313: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651819114: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651820915: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651822716: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651823993: mosquitto version 2.0.11 terminating
                      1651823993
                      : Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651824042: mosquitto version 2.0.11 starting
                      1651824042
                      : Config loaded from /etc/mosquitto/mosquitto.conf.
                      1651824042: Starting in local only mode. Connections will only be possible from clients running on this machine.
                      1651824042: Create a configuration file which defines a listener to allow remote access.
                      1651824042: For more details see https://mosquitto.org/documentation/authentication-methods/
                      1651824042: Opening ipv4 listen socket on port 1883.
                      1651824042
                      : Opening ipv6 listen socket on port 1883.
                      1651824042
                      : mosquitto version 2.0.11 running
                      1651825843
                      : Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651827644: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651828200: mosquitto version 2.0.11 terminating
                      1651828200
                      : Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651828501: mosquitto version 2.0.11 starting
                      1651828501
                      : Config loaded from /etc/mosquitto/mosquitto.conf.
                      1651828501: Starting in local only mode. Connections will only be possible from clients running on this machine.
                      1651828501: Create a configuration file which defines a listener to allow remote access.
                      1651828501: For more details see https://mosquitto.org/documentation/authentication-methods/
                      1651828501: Opening ipv4 listen socket on port 1883.
                      1651828501
                      : Opening ipv6 listen socket on port 1883.
                      1651828501
                      : mosquitto version 2.0.11 running
                      1651828814
                      : mosquitto version 2.0.11 terminating
                      1651828814
                      : Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651828838: mosquitto version 2.0.11 starting
                      1651828838
                      : Config loaded from /etc/mosquitto/mosquitto.conf.
                      1651828838: Starting in local only mode. Connections will only be possible from clients running on this machine.
                      1651828838: Create a configuration file which defines a listener to allow remote access.
                      1651828838: For more details see https://mosquitto.org/documentation/authentication-methods/
                      1651828838: Opening ipv4 listen socket on port 1883.
                      1651828838
                      : Opening ipv6 listen socket on port 1883.
                      1651828838
                      : mosquitto version 2.0.11 running
                      1651829036
                      : mosquitto version 2.0.11 terminating
                      1651829036
                      : Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651829343: mosquitto version 2.0.11 starting
                      1651829343
                      : Config loaded from /etc/mosquitto/mosquitto.conf.
                      1651829343: Starting in local only mode. Connections will only be possible from clients running on this machine.
                      1651829343: Create a configuration file which defines a listener to allow remote access.
                      1651829343: For more details see https://mosquitto.org/documentation/authentication-methods/
                      1651829343: Opening ipv4 listen socket on port 1883.
                      1651829343
                      : Opening ipv6 listen socket on port 1883.
                      1651829343
                      : mosquitto version 2.0.11 running
                      1651831144
                      : Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651832945: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651834746: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651836547: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651838348: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651840149: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651841950: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651843751: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651845552: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651847353: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651849154: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651850955: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651852756: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651854557: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651856358: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651858159: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651859960: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651861761: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651862590: mosquitto version 2.0.11 terminating
                      1651862590
                      : Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
                      1651862645: mosquitto version 2.0.11 starting
                      1651862645
                      : Config loaded from /etc/mosquitto/mosquitto.conf.
                      1651862645: Starting in local only mode. Connections will only be possible from clients running on this machine.
                      1651862645: Create a configuration file which defines a listener to allow remote access.
                      1651862645: For more details see https://mosquitto.org/documentation/authentication-methods/
                      1651862645: Opening ipv4 listen socket on port 1883.
                      1651862645
                      : Opening ipv6 listen socket on port 1883.
                      1651862645
                      : mosquitto version 2.0.11 running 

                      Kommentar


                        #12
                        Hier liegt Dein Problem:
                        Code:
                        1651786766: Starting in local only mode. Connections will only be possible from clients running on this machine.
                        Viele Grüße
                        Martin

                        There is no cloud. It's only someone else's computer.

                        Kommentar


                          #13
                          So es läuft!
                          habe hier die diese Zeilen in der mosquitto.conf ergänzt


                          Code:
                          listener 1883
                          allow_anonymous true

                          Kommentar


                            #14
                            Ich hatte das gleiche Problem. MQTT hat keiner Verbindung hersgestellt.
                            Es konnte ebenfalls mit der Ergänzung des Listener Ports gelöst werden.

                            siehe:
                            https://knx-user-forum.de/forum/supp...ome-py/1939236

                            Danke, dass ihr es eigentlich schon hier im Forum hattet, Irgendwie habe ich es zu spät gefunden, obwohl ich gesucht hatte. Naja läuft ja nun.

                            Kommentar

                            Lädt...
                            X