fmartinou / tydom2mqtt

Deltadore Tydom to MQTT Bridge
https://fmartinou.github.io/tydom2mqtt/
MIT License
86 stars 49 forks source link

Containerized tydom2mqtt to Mosquitto connection issue #189

Open dauveiler opened 2 months ago

dauveiler commented 2 months ago

Hi,

Here I want to test Home Assistant Container AND HAOS (VM) on my Synology NAS before setting up a clean Home Assistant. I prefer the first solution for many reasons, but I have issues with tydom2mqtt.

First, in HAOS : all is working fine. I installed the tydom2mqtt addon, even a mosquitto broker all in Home Assistant.

Then I installed a Container version of Home Assistant with a Docker Compose. Inside it runs 3 containers : tydom2mqtt, eclipse-mosquitto and home-assistant. All is working fine, except the connection between tydom2mqtt and the mqtt broker ! (Tydom2mqtt connection to Tydom is good.)

Here are the logs from tydom2mqtt container :

2024-04-23 08:04:16,848 - mqtt.MqttClient - WARNING - MQTT connection error : 'str' object has no attribute 'wrap_bio'
2024-04-23 08:02:09,599 - mqtt.MqttClient - INFO - Connecting to mqtt broker (host=mosquitto, port=1883, user=mqtt-user, ssl=false)

In Mosquitto logs, we can see the connection, but immediately disconnects :

New connection from 172.19.0.2:44460 on port 1883.
1713859316: Client <unknown> closed its connection.

I tried many configurations since 2 days, with or without anonymous access ... same problem. Tried to run another tydom2mqtt on my computer Docker : it fails (same error). Tried host or bridge network in containers, same error.

BUT

I tried to connect the HAOS tydom2mqtt on my containerized Mosquitto, and it works perfectly ! Like my Home Assistant container is configured with this Mosquitto, it can open and close X3D devices, read their positions ... with the HAOS addon ;) I tested Mosquitto with MQTT explorer : all is fine.

Here's the Docker Compose section for non functionnal tydom2mqtt :

services:
  tydom2mqtt:
    image: fmartinou/tydom2mqtt
    container_name: tydom2mqtt
    restart: always
    # network_mode: host
    environment:
      - TYDOM_MAC=001A25xxxxx
      - TYDOM_PASSWORD=xxxxxxxxx
      - TYDOM_IP=xxx.xxx.xxx.xxx
      - TYDOM_ALARM_HOME_ZONE=1
      - TYDOM_ALARM_NIGHT_ZONE=2
      - TYDOM_POLLING_INTERVAL=300
      - MQTT_HOST=mosquitto
      - MQTT_PORT=1883
      - MQTT_USER=mqtt-user
      - MQTT_PASSWORD=xxxxxxxxxxxx
      - MQTT_SSL=false
      - LOG_LEVEL=DEBUG

I'll probably give up the Container installation to go to HAOS, but maybe someone can have an idea to solve this ?

What i forgot to do ?

Thanks.

Coldness00 commented 2 weeks ago

Hello, are they in the same network?

dauveiler commented 1 week ago

Hello, Yes of course. I tested the two instances of Mosquitto (haos and containerized) from a client on the same network and both are responding correctly.