Hi guys, I’m attempting to setup the dahuavto2mqtt service with mosquitto and home assistant using docker-compse on a ubuntu machine. I’ve already got various shelly devices connected to the mosquitto MQTT broker and home-assistant and I can pub and sub to mosquitto with the following from my windows machine succesfully:
sub: mosquitto_sub.exe -h <mosquitto-ip> -u <myusername> -P <mypassword> -t DahuaVTO/# -F %j
pub mosquitto_pub.exe -h <mosquitto-ip> -u <myusername> -P <mypassword> -t DahuaVTO/test -m "{'message': 'test1'}"
When attaching to the running dahuavto2mqtt container I can see the following debug output repeating:
2022-05-30 18:19:22,502 INFO __main__ Connecting
2022-05-30 18:19:22,502 DEBUG asyncio Using selector: EpollSelector
2022-05-30 18:19:22,504 DEBUG __main__ Connection established
2022-05-30 18:19:22,504 INFO __main__ Initializing MQTT Broker
2022-05-30 18:19:22,505 INFO __main__ MQTT Broker is trying to connect...
2022-05-30 18:19:22,506 DEBUG __main__ Prepare pre-login message
2022-05-30 18:19:22,506 INFO __main__ MQTT Broker connected with result code 0
2022-05-30 18:19:22,519 DEBUG __main__ Data received: {'error': {'code': 268632079, 'message': 'Component error: login challenge!'}, 'id': 2, 'params': {'authorization': '36f94ca7<..etc..>f56f8d49f', 'encryption': 'Default', 'mac': '<mac address>', 'random': '1853980012', 'realm': 'Login to f9b3bdac<..etc..>c6731dec049'}, 'result': False, 'session': 2147483588}
2022-05-30 18:19:22,519 DEBUG __main__ Prepare login message
2022-05-30 18:19:22,538 DEBUG __main__ Data received: {'error': {'code': 268632085, 'message': 'Component error: User or password not valid!'}, 'id': 3, 'params': {'remainLockSecond': 0, 'remainLoginTimes': 0}, 'result': False, 'session': 2147483588}
2022-05-30 18:19:22,748 INFO __main__ Server sent EOF message
2022-05-30 18:19:22,748 WARNING __main__ Disconnected, will try to connect in 5 seconds
The relevant parts from docker-compose.yml:
version: '3.7'
services:
homeassistant:
container_name: homeassistant
image: homeassistant/home-assistant:stable
volumes:
- /home/myusername/HA/config:/config
- /etc/localtime:/etc/localtime:ro
restart: unless-stopped
network_mode: host
mosquitto:
image: eclipse-mosquitto:latest
depends_on:
- homeassistant
ports:
- 1883:1883
- 9001:9001
volumes:
- /home/myusername/HA/mosquitto/config:/mosquitto/config
- mosquitto_data:/mosquitto/data
- mosquitto_logs:/mosquitto/logs
restart: unless-stopped
network_mode: host
dahuavto2mqtt:
image: "eladbar/dahuavto2mqtt:latest"
container_name: "dahuavto2mqtt"
network_mode: host
depends_on:
- mosquitto
restart: unless-stopped
# relies on .env file
environment:
- DAHUA_VTO_HOST=${DAHUA_VTO_HOST}
- DAHUA_VTO_USERNAME=${DAHUA_VTO_USERNAME}
- DAHUA_VTO_PASSWORD=${DAHUA_VTO_PASSWORD}
- MQTT_BROKER_HOST=${MQTT_BROKER_HOST}
- MQTT_BROKER_PORT=${MQTT_BROKER_PORT}
- MQTT_BROKER_USERNAME=${MQTT_BROKER_USERNAME}
- MQTT_BROKER_PASSWORD=${MQTT_BROKER_PASSWORD}
- MQTT_BROKER_TOPIC_PREFIX=DahuaVTO
- MQTT_BROKER_CLIENT_ID=DahuaVTO2MQTT
- DEBUG=true
volumes:
mosquitto_data: {}
mosquitto_logs: {}
when I run docker-compose config
I can see that the env-vars from the .env
file are filled in succesfully. Any idea to what this could cause? I have the feeling I’m missing something obvious here (besides that the broker somehow thinks the credentials are wrong)