Natywne wsparcie dla MQTT

User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

Da się. Wystarczy wskazać jego adres i musi być on osiągalny sieciowo dla Suplowego kontenera.
SUPLA.... Nareszcie w domu.
Jkon
Posts: 22
Joined: Thu Sep 30, 2021 5:01 am

Post

Hej, mam problem z instalacją MQTT supli w HA. Posiadam skonfigurowany broker mqtt, do tego podpięty jest zigbee2mqtt który działa i chciałem do brokera dorzucić również zamela mew-01, który wczesniej był poprawnie skonfigurowany i działał dobrze. W konfiguracji brokera mam:

logins: []
customize:
active: true
folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false

W konfiguracji pliku bridge.conf:
connection bridge-klmgfryg225ghkk

address mqtt56.supla.org:8883
topic supla/# in
topic homeassistant/# in
topic supla/+/devices/+/channels/+/execute_action out
topic supla/+/devices/+/channels/+/set/+ out
remote_username ********
remote_password *********
bridge_capath /etc/ssl/certs

Logi z brokera:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] mosquitto.sh: executing...
[08:41:25] INFO: SSL is not enabled
[cont-init.d] mosquitto.sh: exited 0.
[cont-init.d] nginx.sh: executing...
[cont-init.d] nginx.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[08:41:27] INFO: Starting NGINX for authentication handling...
[08:41:27] INFO: Starting mosquitto MQTT broker...
1637653287: Loading config file /share/mosquitto/bridge.conf
1637653338: mosquitto version 1.6.12 starting
1637653338: |-- *** auth-plug: startup
[08:42:20] INFO: Successfully send discovery information to Home Assistant.
[08:42:21] INFO: Successfully send service information to the Supervisor.
1637653338: Config loaded from /etc/mosquitto/mosquitto.conf.
1637653338: Loading plugin: /usr/share/mosquitto/auth-plug.so
1637653338: ├── Username/password checking enabled.
1637653338: ├── TLS-PSK checking enabled.
1637653338: └── Extended authentication not enabled.
1637653338: Opening ipv4 listen socket on port 1883.
1637653338: Opening ipv6 listen socket on port 1883.
1637653338: Opening websockets listen socket on port 1884.
1637653338: Warning: Mosquitto should not be run as root/administrator.
1637653338: mosquitto version 1.6.12 running
1637653338: New connection from 172.30.33.3 on port 1883.
1637653338: New client connected from 172.30.33.3 as mqttjs_ce645017 (p2, c1, k60, u'homeassistant').
1637653338: New connection from 127.0.0.1 on port 1883.
1637653338: Socket error on client <unknown>, disconnecting.
1637653346: New connection from 172.30.32.1 on port 1883.
1637653346: New client connected from 172.30.32.1 as 4lgMDtnE3SNAZkn4tBP2hp (p2, c1, k60, u'homeassistant').

W logach jest że ładuje plik bridge.conf a w urządzeniach nic się nie pojawia. Proszę o wskazówki co tutaj poprawić.
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

Sprawdź mqtt explorerem
SUPLA.... Nareszcie w domu.
Jkon
Posts: 22
Joined: Thu Sep 30, 2021 5:01 am

Post

Bez problemu można się połączyć.
You do not have the required permissions to view the files attached to this post.
User avatar
klew
Posts: 13911
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław
Has thanked: 136 times
Been thanked: 137 times

Post

Jkon wrote: Tue Nov 23, 2021 11:49 am Bez problemu można się połączyć.
Ja z Home Assistant jestem noga, ale najczęściej jak coś samo się nie wykrywa w "mqtt discovery" to znaczy, że mam za starą wersję HA. W ostatnich kilku miesiącach było w HA kilka aktualizacji związanych z pomiarem energii i Supla czasem korzysta z tych nowości. Gdy masz za starą wersję HA, wtedy urządzenie się nie pojawi.

Także:
1. Możesz sprawdzić logi HA (konfiguracja->logi)
2. Zrób aktualizację do najnowszego HA.
Najlepsze suple dla Twojego domu :mrgreen:
Jkon
Posts: 22
Joined: Thu Sep 30, 2021 5:01 am

Post

Dzięki za wskazówki, zrobiłem aktualizacje HA nic się nie zmieniło. W logach HA również nic nie zauważyłem. Tak się zastanawiam czy to może być problem tls? Tzn nie znam się na tym ale głośno myślę, supla łączy się przez port 8883 z zabezpieczeniem, a broker mqtt nawet nie otwera żadnego połączenia na porcie 8883 w logach, i również jest coś takiego: SSL is not enabled. Może tutaj jest jakiś problem? Tylko jak to ugryźć jeśli to jest przyczyną. Czy to raczej nie ma nic wspólnego?
User avatar
klew
Posts: 13911
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław
Has thanked: 136 times
Been thanked: 137 times

Post

Jkon wrote: Tue Nov 23, 2021 12:34 pm Dzięki za wskazówki, zrobiłem aktualizacje HA nic się nie zmieniło. W logach HA również nic nie zauważyłem. Tak się zastanawiam czy to może być problem tls? Tzn nie znam się na tym ale głośno myślę, supla łączy się przez port 8883 z zabezpieczeniem, a broker mqtt nawet nie otwera żadnego połączenia na porcie 8883 w logach, i również jest coś takiego: SSL is not enabled. Może tutaj jest jakiś problem? Tylko jak to ugryźć jeśli to jest przyczyną. Czy to raczej nie ma nic wspólnego?
Nie doczytałem co chciałeś tutaj zrobić. Myślałem, że widok z mqtt explorera jest z Twojego brokera i tam widać Suplę.
Najlepsze suple dla Twojego domu :mrgreen:
Jkon
Posts: 22
Joined: Thu Sep 30, 2021 5:01 am

Post

Do mqtt explorera zalogowałem się danymi z supla.org (chyba o to chodziło pzygmunt?). I tam pokazuje to co wkleiłem wyżej.

Logując się do mqtt explorera danymi brokera z HA nie łączy się.

Kurcze sam już nie wiem jak to ogarnąć.

Jeszcze dziwna sprawa w logach brokera:

1637672594: Client <unknown> disconnected due to protocol error.
1637672714: New connection from 172.30.32.1 on port 1883.
1637672714: Client <unknown> disconnected due to protocol error.
1637672834: New connection from 172.30.32.1 on port 1883.
1637672834: Client <unknown> disconnected due to protocol error.
1637672954: New connection from 172.30.32.1 on port 1883.
1637672954: Client <unknown> disconnected due to protocol error.
1637673074: New connection from 172.30.32.1 on port 1883.
1637673074: Client <unknown> disconnected due to protocol error.
1637673194: New connection from 172.30.32.1 on port 1883.
1637673194: Client <unknown> disconnected due to protocol error.
1637673314: New connection from 172.30.32.1 on port 1883.
1637673314: Client <unknown> disconnected due to protocol error.
1637673434: New connection from 172.30.32.1 on port 1883.
1637673434: Client <unknown> disconnected due to protocol error.
1637673554: New connection from 172.30.32.1 on port 1883.
1637673554: Client <unknown> disconnected due to protocol error.
1637673674: New connection from 172.30.32.1 on port 1883.
1637673674: Client <unknown> disconnected due to protocol error.
1637673794: New connection from 172.30.32.1 on port 1883.
1637673794: Client <unknown> disconnected due to protocol error.
1637673914: New connection from 172.30.32.1 on port 1883.
1637673914: Client <unknown> disconnected due to protocol error.
1637674034: New connection from 172.30.32.1 on port 1883.
1637674034: Client <unknown> disconnected due to protocol error.
1637674154: New connection from 172.30.32.1 on port 1883.
1637674154: Client <unknown> disconnected due to protocol error.
1637674274: New connection from 172.30.32.1 on port 1883.
1637674274: Client <unknown> disconnected due to protocol error.
1637674343: Saving in-memory database to /data/mosquitto.db.
1637674394: New connection from 172.30.32.1 on port 1883.
1637674394: Client <unknown> disconnected due to protocol error.
1637674514: New connection from 172.30.32.1 on port 1883.
1637674514: Client <unknown> disconnected due to protocol error.
1637674634: New connection from 172.30.32.1 on port 1883.
1637674634: Client <unknown> disconnected due to protocol error.
1637674754: New connection from 172.30.32.1 on port 1883.
1637674754: Client <unknown> disconnected due to protocol error.
1637674874: New connection from 172.30.32.1 on port 1883.
1637674874: Client <unknown> disconnected due to protocol error.
1637674994: New connection from 172.30.32.1 on port 1883.
1637674994: Client <unknown> disconnected due to protocol error.
1637675114: New connection from 172.30.32.1 on port 1883.
1637675114: Client <unknown> disconnected due to protocol error.
1637675234: New connection from 172.30.32.1 on port 1883.
1637675234: Client <unknown> disconnected due to protocol error.
1637675355: New connection from 172.30.32.1 on port 1883.
1637675355: Client <unknown> disconnected due to protocol error.
1637675475: New connection from 172.30.32.1 on port 1883.
1637675475: Client <unknown> disconnected due to protocol error.
1637675595: New connection from 172.30.32.1 on port 1883.
1637675595: Client <unknown> disconnected due to protocol error.
1637675715: New connection from 172.30.32.1 on port 1883.
1637675715: Client <unknown> disconnected due to protocol error.
1637675835: New connection from 172.30.32.1 on port 1883.
1637675835: Client <unknown> disconnected due to protocol error.
1637675955: New connection from 172.30.32.1 on port 1883.
1637675955: Client <unknown> disconnected due to protocol error.
1637676075: New connection from 172.30.32.1 on port 1883.
1637676075: Client <unknown> disconnected due to protocol error.
1637676144: Saving in-memory database to /data/mosquitto.db.
1637676195: New connection from 172.30.32.1 on port 1883.
1637676195: Client <unknown> disconnected due to protocol error.
1637676315: New connection from 172.30.32.1 on port 1883.
1637676315: Client <unknown> disconnected due to protocol error.
1637676435: New connection from 172.30.32.1 on port 1883.
1637676435: Client <unknown> disconnected due to protocol error.
1637676555: New connection from 172.30.32.1 on port 1883.
1637676555: Client <unknown> disconnected due to protocol error.
1637676675: New connection from 172.30.32.1 on port 1883.
1637676675: Client <unknown> disconnected due to protocol error.
You do not have the required permissions to view the files attached to this post.
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

Musisz sprawdzić ustawienia swojego mosquitto.
SUPLA.... Nareszcie w domu.
Jkon
Posts: 22
Joined: Thu Sep 30, 2021 5:01 am

Post

Wszystko po kolei zrobiłem jeszcze raz. Konfiguruje mosquitto tak jak w instrukcji addona:

Stworzyłem w HA usera:
Nazwa użytkownika: mqttkuba
Hasło użytkownika: ***

Następnie zainstalowałem addon Mosquitto i w konfiguracji jest:
logins:
customize:
active: true
folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false

Następnie Integracje - konfiguracja Mosquitto broker, nazwa użytkownika: mqttkuba oraz hasło *** takie jak nowy user w HA - pomyślnie skonfigurowano.

Restart brokera i HA.

Aktualnie w logach brokera:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] mosquitto.sh: executing...
[16:37:25] INFO: SSL is not enabled
[cont-init.d] mosquitto.sh: exited 0.
[cont-init.d] nginx.sh: executing...
[cont-init.d] nginx.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[16:37:26] INFO: Starting NGINX for authentication handling...
[16:37:26] INFO: Starting mosquitto MQTT broker...
1637681846: Loading config file /share/mosquitto/bridge.conf
1637681866: mosquitto version 1.6.12 starting
1637681866: |-- *** auth-plug: startup
[16:37:48] INFO: Successfully send discovery information to Home Assistant.
[16:37:49] INFO: Successfully send service information to the Supervisor.
1637681866: Config loaded from /etc/mosquitto/mosquitto.conf.
1637681866: Loading plugin: /usr/share/mosquitto/auth-plug.so
1637681866: ├── Username/password checking enabled.
1637681866: ├── TLS-PSK checking enabled.
1637681866: └── Extended authentication not enabled.
1637681866: Opening ipv4 listen socket on port 1883.
1637681866: Opening ipv6 listen socket on port 1883.
1637681866: Opening websockets listen socket on port 1884.
1637681867: Warning: Mosquitto should not be run as root/administrator.
1637681867: mosquitto version 1.6.12 running
1637681867: New connection from 127.0.0.1 on port 1883.
1637681867: Socket error on client <unknown>, disconnecting.
1637681867: New connection from 172.30.33.3 on port 1883.
{"result": "ok", "data": {}}1637681867: New client connected from 172.30.33.3 as mqttjs_a6661d0b (p2, c1, k60, u'mqttkuba').
1637681873: New connection from 172.30.32.1 on port 1883.

Próbuje zalogować się tymi danymi przez mqtt explorera i wyskakuje cały czas disconnected from server. Zamela w urządzeniach nadal nie widać. Gdzieś popełniam błąd?
You do not have the required permissions to view the files attached to this post.

Return to “MQTT”