Zigbee2MQTT - 502 Bad gateway

re,

Malgré que j’ai deja essayé un pi , pas eu de souci , mais j’avais pas autant de connecté
Mais je sais que cela peut arrivé , certain en non subi les frais … regarde a l’occasion ( recherche )

Bon la ta clé est en expérimentale sous Z2M :wink:

Je viens de désactiver HACS et ça a l’air d’etre mieux.
J’avais ça dans les logs
Je vois la nuit comment ça se passe et je te redis

inutile , hacs a rien a voir la dedans :wink:

Moi au pire , et si tu peux le faire sans etre géne , je vire tous les usb connecté
sauf mon SSD et cle Zigbee , je regarde si il y a une amélioration …

Edit:

Décidement avec les RPI regarde ceci

Re bizarrement plus de souci de déco de z2m depuis la désactivation de hacs… je referai des tests semaine prochaine

re, je viens de refaire des tests, dès que j’active HACS, le plugin zigbee2mqtt plante. (en erreur 502) et dès que je le desactive, hop tout remarche.

Voila le log :

2023-10-24 13:04:37.346 WARNING (MainThread) [homeassistant.helpers.entity] Update of camera.tapo_camera_hd_stream is taking over 10 seconds
2023-10-24 13:04:37.477 WARNING (MainThread) [homeassistant.helpers.entity] Update of camera.tapo_camera_sd_stream is taking over 10 seconds
2023-10-24 13:21:20.576 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 332, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message:
  Bad status line "Invalid method encountered:\n\n  b'HELP\\r'\n      ^"
2023-10-24 16:43:12.509 WARNING (MainThread) [homeassistant.components.androidtv_remote] Disconnected from Freebox Player POP at 192.168.1.147
2023-10-24 18:37:51.100 WARNING (Thread-9) [pychromecast.socket_client] [Freebox Player POP(192.168.1.147):8009] Error communicating with socket, resetting connection
2023-10-24 18:38:13.826 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.smoke }}'
2023-10-24 18:38:14.156 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: 'value_json' is undefined (value: , template: {{ value_json.smoke }})
2023-10-24 18:38:14.164 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.battery }}'
2023-10-24 18:38:14.177 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.test }}'
2023-10-24 18:38:14.182 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: 'value_json' is undefined (value: , template: {{ value_json.test }})
2023-10-24 18:38:14.189 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.smoke_concentration }}'
2023-10-24 18:38:14.195 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.device_fault }}'
2023-10-24 18:38:14.202 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: 'value_json' is undefined (value: , template: {{ value_json.device_fault }})
2023-10-24 19:19:25.519 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Freebox Player POP' for androidtv_remote integration not ready yet: Couldn't connect to 192.168.1.47:6466; Retrying in background
2023-10-24 19:19:25.715 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Freebox Player POP' for androidtv_remote integration not ready yet: Couldn't connect to 192.168.1.47:6466; Retrying in background
2023-10-24 19:24:53.082 WARNING (Thread-9) [pychromecast.socket_client] [Freebox Player POP(192.168.1.147):8009] Heartbeat timeout, resetting connection
2023-10-24 19:25:23.165 ERROR (Thread-9) [pychromecast.socket_client] [Freebox Player POP(192.168.1.147):8009] Failed to connect to service ServiceInfo(type='host', data=('192.168.1.147', 8009)), retrying in 5.0s
2023-10-24 22:00:02.416 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 332, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message:
  Bad status line "Invalid method encountered:\n\n  b''\n    ^"
2023-10-24 22:24:20.840 WARNING (MainThread) [homeassistant.helpers.entity] Update of camera.tapo_camera_hd_stream is taking over 10 seconds
2023-10-24 22:24:20.994 WARNING (MainThread) [homeassistant.helpers.entity] Update of camera.tapo_camera_sd_stream is taking over 10 seconds
2023-10-25 02:31:08.252 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 332, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message:
  Bad status line "Invalid method encountered:\n\n  b''\n    ^"
2023-10-25 06:03:32.686 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 332, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message:
  Bad status line "Invalid method encountered:\n\n  b''\n    ^"
2023-10-25 11:00:58.294 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 332, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message:
  Bad status line "Invalid method encountered:\n\n  b''\n    ^"
2023-10-25 14:16:09.322 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 332, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message:
  Bad status line "Invalid method encountered:\n\n  b''\n    ^"
2023-10-25 14:32:16.291 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 332, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message:
  Bad status line "Invalid method encountered:\n\n  b'SSTP_DUPLEX_POST /sra_{BA195980-CD49-458b-9E23-C84EE0ADCD75}/ HTTP/1.1\\r'\n     ^"
2023-10-25 15:20:22.120 WARNING (MainThread) [homeassistant.components.androidtv_remote] Disconnected from Freebox Player POP at 192.168.1.147
2023-10-25 15:20:25.558 WARNING (Thread-9) [pychromecast.socket_client] [Freebox Player POP(192.168.1.147):8009] Heartbeat timeout, resetting connection
2023-10-25 15:20:55.624 ERROR (Thread-9) [pychromecast.socket_client] [Freebox Player POP(192.168.1.147):8009] Failed to connect to service ServiceInfo(type='host', data=('192.168.1.147', 8009)), retrying in 5.0s
2023-10-25 17:02:12.610 WARNING (SyncWorker_10) [homeassistant.loader] We found a custom integration blitzortung which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-10-25 17:02:12.776 WARNING (SyncWorker_10) [homeassistant.loader] We found a custom integration tapo_control which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-10-25 17:02:12.786 WARNING (SyncWorker_10) [homeassistant.loader] We found a custom integration myEnedis which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-10-25 17:02:12.792 WARNING (SyncWorker_10) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-10-25 17:05:12.104 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547614036544] Error handling message: Unknown error (unknown_error) olybop from 92.184.99.38 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
    await func(hass, connection, msg)
  File "/config/custom_components/hacs/websocket/repositories.py", line 68, in hacs_repositories_list
    for repo in hacs.repositories.list_all
                ^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'repositories'
2023-10-25 17:06:12.688 WARNING (MainThread) [homeassistant.components.sensor.recorder] Entity sensor.0x00158d0005d29bf7_hchp from integration mqtt has state class total_increasing, but its state is not strictly increasing. Triggered by state 11628.961 (11628.961) with last_updated set to 2023-10-25T15:06:11.477842+00:00. Please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integ

Hello

Je ne connais pas ta config, mais ç’est possible que ce soit le soucis.

Je crois aussi :slight_smile:

tu penses que le PI3 est pas assez puissant, je viens de check et le proc est à 16/20% et la ram à 0,7 sur 1go.

Vu les symptomes, oui, mais ça dépend de ta config et de ton usage

Ca ne laisse pas beaucoup de marge. Avec HACS actif ?

Bonjour,
Pour un Rpi3 vaut mieux ce tourné vers ZHA qui est moins gourmand que mosquitto broker et Z2M.
J’ai tourner sur rpi3 avec ZHA , HACS sans soucis.

avec hacs actif, pareil en ram, c’est curieux.
Personne d’autre à un pi3 avec hacs et zigbee2mqtt ? :smiley:

pour info après mise à jour de HA sur sa dernière version 2023.11.1. tout refonctionne bien.

1 « J'aime »

bon, en fait j’avais toujours des soucis,
je viens de passer sur un mini pc avec proxmox… une dinguerie ce truc. c’est tellement plus rapide.

Salut a tous

Je me tournes vers vous car je suis dans cette même situation de blocage sur ce 502: Bad Gateway

Je me retrouve avec ce blocage après une installation et configuration réussie
J’ai pu appairer 4 devices différents qui ont fonctionné quelques heures
J’ai commencé par perdre 2 de ces devices pour ensuite tout perdre et me retrouver avec cette erreur 502
Je n’est pourtant rien changé pendant le temps ou ça a fonctionné

Alors je tournes avec HAOS installé sur un RPi4 4g, SSD 120G Kingston, alim officiel pi4, clé zigbee Sonoff 3.0 Plus (P), flashé avec le dernier firmware branché sur une rallonge usb de 30cm pour éloigner la clé du pi, le broker mqtt est installé et opérationnel, testé avec mqtt explorer et l’installation est de cette nuit avec un démarrage de 0

Donc je comprends pas trop le soucis
Voici les log du journal de zigbee2mqtt quand j’essaye de lancer le module

[13:35:36] INFO: Preparing to start...
[13:35:36] INFO: Socat not enabled
[13:35:38] INFO: Starting Zigbee2MQTT...
Zigbee2MQTT:info  2023-12-02 13:35:44: Logging to console and directory: '/config/zigbee2mqtt/log/2023-12-02.13-35-44' filename: log.txt
Zigbee2MQTT:info  2023-12-02 13:35:44: Starting Zigbee2MQTT version 1.34.0 (commit #unknown)
Zigbee2MQTT:info  2023-12-02 13:35:44: Starting zigbee-herdsman (0.25.0)
Zigbee2MQTT:error 2023-12-02 13:35:45: Configuration is not consistent with adapter state/backup!
Zigbee2MQTT:error 2023-12-02 13:35:45: - PAN ID: configured=14881, adapter=14881
Zigbee2MQTT:error 2023-12-02 13:35:45: - Extended PAN ID: configured=3b54f3f5470d50d5, adapter=3b54f3f5470d50d5
Zigbee2MQTT:error 2023-12-02 13:35:45: - Network Key: configured=45bb1e7a321c9131958483c38d5c27c6, adapter=45bb1e7a321c9131958483c38d5c27c6
Zigbee2MQTT:error 2023-12-02 13:35:45: - Channel List: configured=20, adapter=11
Zigbee2MQTT:error 2023-12-02 13:35:45: Please update configuration to prevent further issues.
Zigbee2MQTT:error 2023-12-02 13:35:45: If you wish to re-commission your network, please remove coordinator backup at /config/zigbee2mqtt/coordinator_backup.json.
Zigbee2MQTT:error 2023-12-02 13:35:45: Re-commissioning your network will require re-pairing of all devices!
Zigbee2MQTT:error 2023-12-02 13:35:45: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2023-12-02 13:35:45: Failed to start zigbee
Zigbee2MQTT:error 2023-12-02 13:35:45: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error 2023-12-02 13:35:45: Exiting...
Zigbee2MQTT:error 2023-12-02 13:35:45: Error: startup failed - configuration-adapter mismatch - see logs above for more information
    at ZnpAdapterManager.determineStrategy (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/manager.ts:229:35)
    at ZnpAdapterManager.start (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/manager.ts:63:26)
    at Controller.start (/app/node_modules/zigbee-herdsman/src/controller/controller.ts:132:29)
    at Zigbee.start (/app/lib/zigbee.ts:60:27)
    at Controller.start (/app/lib/controller.ts:101:27)
    at start (/app/index.js:107:5)

Bonjour,

C’est quelle version de clé Sonoff que tu as ?

C’est la sonoff 3.0 Plus ( Plus = P ), celle basé sur le cc2652P

Sur la type P et la type E, il est indiqué « Zigbee 3.0 USB Dongle Plus », la seule différence visuelle est la taille des deux clés. En revanche, sur HA, la type E est indiquée comme ça : ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2

Le journal indique de refaire la configuration :

Please update configuration to prevent further issues

Apparemment, le dernier firmware pour la version P est buggé et il faudrait flasher la clé avec un firmware antérieur (20221226).

il y a une intermédiaire entre la version que tu m’annonce et la dernière
cette intermédiaire serais buggée aussi ?

Je ne sais pas si l’avant dernière version est buggée elle aussi. J’ai pris une type P récemment et un membre du forum m’a conseillé de la flasher avec le firmware 20221226 qui serait selon lui le plus stable.
Mais je l’ai pour l’instant flashée en tant que routeur et gardé la type E en coordinateur.

Tu peux tester après l’avoir flashée avec l’avant dernier firmware si tu veux, tu verras bien si ça résoud ton problème.

Bj
@karim_taz ,

Pour commencé débranche ta cle , attend une bonne minute et relance Z2M …

Quand tu as eu ton erreur , cela c’est fait soudain ou lors d’un redémarage de ton HA ?

As d’autre cle sur ton HA , si oui il se peux que ton port USB c’est inversé avec l’autre cle.

Verifié dans les parametre de de HA , si le port que tu déclare et toujours le même.

Tu ne dis pas comment dans ton fichier confif.yaml de Z2M le chemin de ta cle
si:

tty/USB0
ou 
port: >-
  /dev/serial/by-id/usb-Silicon_Labs_Sonoff_Zigbee_3.0_USB_Dongle_Plus_0001-if00-port0

regarde ici pour t’aider .

Bon je viens de repasser ma clé a la 20221226
Le problème persiste

Pour te répondre Nothing,
je pourrais plus te dire si c’est en redémarrant ou comme ça que le problème est venu,
zha c’est installé direct au premier démarrage mais je l’ai tout de suite supprimé
je n’est pas d’autre clé a pars un ssd mais le port reste toujours le même de ce coté la pas de soucis, ma clé était déclarer avec tty\USB0, j’ai essayer
port: >-
/dev/serial/by-id/usb-Silicon_Labs_Sonoff_Zigbee_3.0_USB_Dongle_Plus_0001-if00-port0
, même combat

J’ai donc essayé une réinstallation et réglage de zigbee2mqtt, je l’arrête et le désinstalle au par avant, j’ai débranché la clé, supprimé le backup du coordinateur comme préconisé, redémarrer le système complet pas juste HA, rebranché la clé, réinstallé zigbee2mqtt sans le lancer, régler les champs nécessaire, puis démarré le module

par contre le journal retourne une erreur un peu différente, ici le herdsman debug n’est pas activé

[04:49:58] INFO: Preparing to start...
[04:49:58] INFO: Socat not enabled
[04:50:00] INFO: Starting Zigbee2MQTT...
Zigbee2MQTT:info  2023-12-03 04:50:06: Logging to console and directory: '/config/zigbee2mqtt/log/2023-12-03.04-50-06' filename: log.txt
Zigbee2MQTT:info  2023-12-03 04:50:06: Starting Zigbee2MQTT version 1.34.0 (commit #unknown)
Zigbee2MQTT:info  2023-12-03 04:50:06: Starting zigbee-herdsman (0.25.0)
Zigbee2MQTT:error 2023-12-03 04:50:06: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2023-12-03 04:50:06: Failed to start zigbee
Zigbee2MQTT:error 2023-12-03 04:50:06: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error 2023-12-03 04:50:06: Exiting...
Zigbee2MQTT:error 2023-12-03 04:50:06: Error: Error while opening serialport 'Error: Error: No such file or directory, cannot open tty\USB0'
    at SerialPort.<anonymous> (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:146:28)
    at SerialPort._error (/app/node_modules/@serialport/stream/dist/index.js:82:22)
    at /app/node_modules/@serialport/stream/dist/index.js:118:18

voici un autre rapport quand je coche herdsman debug

Zigbee2MQTT
[05:02:52] INFO: Preparing to start...
[05:02:52] INFO: Socat not enabled
[05:02:52] INFO: Zigbee Herdsman debug logging enabled
[05:02:54] INFO: Starting Zigbee2MQTT...
Zigbee2MQTT:debug 2023-12-03 05:03:00: Loaded state from file /config/zigbee2mqtt/state.json
Zigbee2MQTT:info  2023-12-03 05:03:00: Logging to console and directory: '/config/zigbee2mqtt/log/2023-12-03.05-03-00' filename: log.txt
Zigbee2MQTT:debug 2023-12-03 05:03:00: Removing old log directory '/config/zigbee2mqtt/log/2023-12-03.04-47-19'
Zigbee2MQTT:info  2023-12-03 05:03:00: Starting Zigbee2MQTT version 1.34.0 (commit #unknown)
Zigbee2MQTT:info  2023-12-03 05:03:00: Starting zigbee-herdsman (0.25.0)
Zigbee2MQTT:debug 2023-12-03 05:03:00: Using zigbee-herdsman with settings: '{"adapter":{"concurrent":null,"delay":null,"disableLED":false},"backupPath":"/config/zigbee2mqtt/coordinator_backup.json","databaseBackupPath":"/config/zigbee2mqtt/database.db.backup","databasePath":"/config/zigbee2mqtt/database.db","network":{"channelList":[20],"extendedPanID":[59,84,243,245,71,13,80,213],"networkKey":"HIDDEN","panID":14881},"serialPort":{"adapter":"zstack","baudRate":115200,"path":"tty\\USB0"}}'
2023-12-03T04:03:00.876Z zigbee-herdsman:adapter:zStack:znp:error Failed to determine if path is valid: 'Error: ENOENT: no such file or directory, lstat '/app/tty\USB0''
2023-12-03T04:03:00.879Z zigbee-herdsman:controller:log Starting with options '{"network":{"networkKeyDistribute":false,"networkKey":[69,187,30,122,50,28,145,49,149,132,131,195,141,92,39,198],"panID":14881,"extendedPanID":[59,84,243,245,71,13,80,213],"channelList":[20]},"serialPort":{"baudRate":115200,"path":"tty\\USB0","adapter":"zstack"},"databasePath":"/config/zigbee2mqtt/database.db","databaseBackupPath":"/config/zigbee2mqtt/database.db.backup","backupPath":"/config/zigbee2mqtt/coordinator_backup.json","adapter":{"disableLED":false,"concurrent":null,"delay":null}}'
2023-12-03T04:03:00.880Z zigbee-herdsman:adapter:zStack:znp:log Opening SerialPort with {"path":"tty\\USB0","baudRate":115200,"rtscts":false,"autoOpen":false}
Zigbee2MQTT:error 2023-12-03 05:03:00: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2023-12-03 05:03:00: Failed to start zigbee
Zigbee2MQTT:error 2023-12-03 05:03:00: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error 2023-12-03 05:03:00: Exiting...
Zigbee2MQTT:error 2023-12-03 05:03:00: Error: Error while opening serialport 'Error: Error: No such file or directory, cannot open tty\USB0'
    at SerialPort.<anonymous> (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:146:28)
    at SerialPort._error (/app/node_modules/@serialport/stream/dist/index.js:82:22)
    at /app/node_modules/@serialport/stream/dist/index.js:118:18