John-H
(John Hansen)
November 11, 2023, 12:53pm
21
Yes i can connect with MQTT Explore
when i do a
sudo netstat -tuln | grep 1883
[sudo] password for nuc:
tcp 0 0 0.0.0.0:1883 0.0.0.0:* LISTEN
tcp6 0 0 :::1883 :::* LISTEN
I have a Intel Nuc with ubuntu on on this i installed Docker + Docker-Compose + Portainer
My mosquitto.conf file is
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
listener 1883
log_timestamp_format %Y-%m-%dT%H:%M:%S
connection_messages true
log_type subscribe
log_type unsubscribe
log_type websockets
log_type error
log_type warning
log_type notice
log_type information
## Authentication ##
allow_anonymous true
password_file /mosquitto/config/password.txt
But i used to be
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
listener 1883
## Authentication ##
allow_anonymous false
password_file /mosquitto/config/password.txt
But i set it to allow anonymous true just to rule out the user and password
docker container port 4d0a9d742a3c
1883/tcp -> 0.0.0.0:1883
1883/tcp -> [::]:1883
9001/tcp -> 0.0.0.0:9001
9001/tcp -> [::]:9001
and my zigbee2mqtt.conf file looks like this
# Home Assistant integration (MQTT discovery)
homeassistant: true
# allow new devices to join
permit_join: true
# MQTT settings
mqtt:
# MQTT base topic for zigbee2mqtt MQTT messages
base_topic: zigbee2mqtt
# MQTT server URL
server: 'mqtt://192.168.50.131:1883'
# MQTT server authentication, uncomment if required:
user: mqttuser
password: *********
# Serial settings
serial:
# Location of CC2531 USB sniffer
port: /dev/ttyACM0
John-H
(John Hansen)
November 11, 2023, 1:04pm
22
Here is what MQTT Explore looks like
malosaa
(Hector)
November 11, 2023, 1:05pm
23
What happens if u go into terminal, using the add-on from home assistant and then ping the ip of the mqtt server.
malosaa
(Hector)
November 11, 2023, 1:09pm
24
I found your issue
change this:
server: 'mqtt://192.168.50.131:1883'
to this
server: http://192.168.50.131
this is my yaml, using Z2M addon in home-assistant
external_converters:
- ext_converter.js
devices:
- devices.yaml
groups:
- groups.yaml
homeassistant: true
permit_join: true
mqtt:
base_topic: zigbee2mqtt
server: http://10.10.11.12
user: ''
password: ''
serial:
port: /dev/ttyUSB0
advanced:
log_level: info
pan_id: 704
channel: 20
network_key:
- 1
- 3
- 5
- 7
- 9
- 11
- 13
- 15
- 0
- 2
- 4
- 6
- 8
- 10
- 12
- 13
availability_blocklist: []
availability_passlist: []
homeassistant_legacy_entity_attributes: false
legacy_api: false
legacy_availability_payload: false
log_syslog:
app_name: Zigbee2MQTT
eol: /n
host: localhost
localhost: localhost
path: /dev/log
pid: process.pid
port: 123
protocol: tcp4
type: '5424'
transmit_power: 20
device_options:
legacy: false
blocklist: []
passlist: []
queue: {}
frontend:
port: 8099
experimental: {}
availability:
active:
timeout: 10
passive:
timeout: 1500
1 Like
John-H
(John Hansen)
November 11, 2023, 1:19pm
25
I changed
server: 'mqtt://192.168.50.131:1883'
to
server: http://192.168.50.131
But i still get this
MQTT error: connect ECONNREFUSED 127.0.0.1:1883
I will spend some time to try to understand your yaml file and what Z2M is
Tnx for helping me out
John-H
(John Hansen)
November 11, 2023, 1:41pm
26
When i connect with MQTT explore i connect to
and MQTT look at
MQTT error: connect ECONNREFUSED 127.0.0.1:1883
I will figure out how to ping in home ass ( i am new to this )
malosaa
(Hector)
November 11, 2023, 2:27pm
28
Thats a bit weird, why would it say
MQTT error: connect ECONNREFUSED 127.0.0.1:1883
instead of
MQTT error: connect ECONNREFUSED 192.168.50.131:1883
Are you using the correct configuration file from Zigbee2Mqtt ?
its located here if u use the file editor add-on
no worries, i’m glad i can help out.
Lets try to solve your problem
John-H
(John Hansen)
November 11, 2023, 3:14pm
29
the zigbee2mqtt file is located
nuc@nucbox:/opt/zigbee2mqtt/data/data$ ls
configuration.yaml
and i docker-compose
zigbee2mqtt:
container_name: zigbee2mqtt
image: koenkk/zigbee2mqtt
restart: unless-stopped
volumes:
- /opt/zigbee2mqtt/data/data:/app/data
- /run/udev:/run/udev:ro
ports:
# Frontend port
- 8080:8080
environment:
- TZ=Europe/Copenhagen
devices:
- /dev/ttyACM0:/dev/ttyACM0
malosaa
(Hector)
November 11, 2023, 3:30pm
30
According to Zigbee2Mqtt it stores the data here:
* `-v $(pwd)/data:/app/data`: Directory where Zigbee2MQTT stores it configuration (pwd maps to the current working directory)
i’m not 100% sure if it can work in n other location, but try to see if there is an configuration.yaml in that directory.
because whatever IP u enter it still gives the same error, that’s why its odd it gives this error:
MQTT error: connect ECONNREFUSED 127.0.0.1:1883
John-H
(John Hansen)
November 11, 2023, 3:50pm
31
Ok now u got me
Can u tell me how to find that dir ?
Here is where i got all dir
John-H
(John Hansen)
November 11, 2023, 3:55pm
32
And 100 % agree don’t understand why i look for
MQTT error: connect ECONNREFUSED 127.0.0.1:1883
instead of
MQTT error: connect ECONNREFUSED 192.168.50.131:1883
but worse where to edit it
malosaa
(Hector)
November 11, 2023, 5:17pm
33
haha no worries,
well i’m not a linux or docker specialist but i think its located in the container itself.
when checking in the container of zigbee2mqtt and look for the folder app/data it should be in there.
The configuration.yaml
file for Zigbee2MQTT would typically be located in the ./data
directory on your host machine, based on this volume mount.
and i’m 100% sure if u edit the file in there it would work.
but i also found this article, check the top part.
https://www.libe.net/en-zigbee2mqtt#start-docker-container-with-zigbee2mqtt
malosaa
(Hector)
November 11, 2023, 5:28pm
34
this is the correct url, it won’t let me edit my post…
half way trough u see this:
Running Zigbee2Mqtt As A Docker Container.
correct url:
1 Like
John-H
(John Hansen)
November 11, 2023, 7:31pm
35
A cording to the guide you linked to. Where is ./data located ?
volumes:
- ./data:/app/data
- /run/udev:/run/udev:ro
In the guide he says :
For this create the a data
folder in the same directory where your docker-compose.yaml
file is present and then create a configuration.yaml
file inside the data
folder with the following content
This gets me confused does the data folder need to bee in the /opt
folder like docker-compose.yaml
?
mine is currently in
/opt/zigbee2mqtt/data/data
John-H
(John Hansen)
November 11, 2023, 8:05pm
36
I tried with the configuration.yaml
from the guide
permit_join: true
mqtt:
server: mqtt://192.168.50.131:1883
serial:
port: /dev/ttyACM0
frontend: true
advanced:
homeassistant_legacy_entity_attributes: false
legacy_api: false
legacy_availability_payload: false
device_options:
legacy: false
devices: {}
homeassistant:
legacy_entity_attributes: true
legacy_triggers: true
and i still get
MQTT error: connect ECONNREFUSED 127.0.0.1:1883
malosaa
(Hector)
November 12, 2023, 11:14am
37
Thats relly weird, i think that guide from that youtuber has an actual step-by-step video.
Maybe it can help you a bit better.
I really don’t know why it doesnt work, but i’m 100% use you are editing the wrong config file.
Let me see if i find some more info.
1 Like
malosaa
(Hector)
November 12, 2023, 11:16am
38
For some weird reasons i can’t edit my posts.
here is the video, its from last month so UpToDate.
never seen this guy before but the tutorial is good.
here it is
1 Like
malosaa
(Hector)
November 12, 2023, 12:01pm
39
Ok, i was thinking something crazy.
What if u gonna test it with the Z2M add-on store in home assistant itself ?
If it works than its 100% an issue with editing the wrong config / or setting Z2M up wrong in docker.
Go to Addons → click addons store > 3 dots
Add this repository
https://github.com/zigbee2mqtt/hassio-zigbee2mqtt
And download the first one not Proxy and EDGE = beta
1 Like
John-H
(John Hansen)
November 12, 2023, 1:31pm
40
I solved it or got it working i guess is the properly term
I nuked the box installed proxmox and now its all working all happy days
Thank you for your time and effort to try to resolve this