[TUTORIEL] Connaitre la capacité restante de sa cuve eau de pluie

Disable the « Validate certificate »

Error 2 corresponds to a connection refused by the server.

So to find out more, you need the logs from the mqtt container

I just tried, same result

Yet I can connect via SSH to my Pi from my smartphone
I can also connect from my PC


Ok but that’s not the same protocol, hence the need to have the MQTT logs to know why it’s refusing the connection

docker logs eclipse-mosquitto

And to view the config

sudo cat /var/lib/gladysassistant/mosquitto/mosquitto.conf

pi@gladys:~ $ sudo cat /var/lib/gladysassistant/mosquitto/mosquitto.conf
allow_anonymous false
connection_messages false
password_file /mosquitto/config/mosquitto.passwd
listener 1883
pi@gladys:~ $ docker logs eclipse-mosquitto
1668235884: mosquitto version 2.0.15 starting
1668235884: Config loaded from /mosquitto/config/mosquitto.conf.
1668235884: Opening ipv4 listen socket on port 1883.
1668235884: Error: Address in use
1668235885: mosquitto version 2.0.15 starting
1668235885: Config loaded from /mosquitto/config/mosquitto.conf.
1668235885: Opening ipv4 listen socket on port 1883.
1668235885: Error: Address in use
1668235886: mosquitto version 2.0.15 starting
1668235886: Config loaded from /mosquitto/config/mosquitto.conf.
1668235886: Opening ipv4 listen socket on port 1883.
1668235886: Error: Address in use
1668235887: mosquitto version 2.0.15 starting
1668235887: Config loaded from /mosquitto/config/mosquitto.conf.
1668235887: Opening ipv4 listen socket on port 1883.
1668235887: Error: Address in use
1668235888: mosquitto version 2.0.15 starting
1668235888: Config loaded from /mosquitto/config/mosquitto.conf.
1668235888: Opening ipv4 listen socket on port 1883.
1668235888: Error: Address in use

There is the message: Error: Address in use
:interrobang:

Something is already running on port 1883…

What have you installed specifically on your Pi?

Can you list the containers: docker ps -a

CONTAINER ID   IMAGE                          COMMAND                  CREATED        STATUS                          PORTS      NAMES
ee8c9aef0d9a   gladysassistant/gladys:v4      "docker-entrypoint.s…"   2 days ago     Up 9 minutes                               gladys
90c1b2365611   eclipse-mosquitto:2            "/docker-entrypoint.…"   5 days ago     Up 9 minutes                               gladys-z2m-mqtt
f225bc1faad1   eclipse-mosquitto:2            "/docker-entrypoint.…"   5 days ago     Restarting (1) 21 seconds ago              eclipse-mosquitto
de219f947a06   containrrr/watchtower:latest   "/watchtower --clean…"   10 days ago    Up 9 minutes                    8080/tcp   watchtower
7c35f8eb4589   koenkk/zigbee2mqtt:latest      "docker-entrypoint.s…"   10 days ago    Up 9 minutes                               gladys-z2m-zigbee2mqtt
ebaacd05ab1c   nodered/node-red:latest        "./entrypoint.sh"        2 months ago   Up 9 minutes (healthy)                     node_red

Your container keeps rebooting in a loop, that’s the cause of your problem.

Try stopping node-red

docker stop node_red

and

Still the same result

pi@gladys:~ $ docker logs eclipse-mosquitto
1668235884: mosquitto version 2.0.15 starting
1668235884: Config loaded from /mosquitto/config/mosquitto.conf.
1668235884: Opening ipv4 listen socket on port 1883.
1668235884: Error: Address in use
1668235885: mosquitto version 2.0.15 starting
1668235885: Config loaded from /mosquitto/config/mosquitto.conf.
1668235885: Opening ipv4 listen socket on port 1883.
1668235885: Error: Address in use
1668235886: mosquitto version 2.0.15 starting
1668235886: Config loaded from /mosquitto/config/mosquitto.conf.
1668235886: Opening ipv4 listen socket on port 1883.
1668235886: Error: Address in use
1668235887: mosquitto version 2.0.15 starting
1668235887: Config loaded from /mosquitto/config/mosquitto.conf.
1668235887: Opening ipv4 listen socket on port 1883.
1668235887: Error: Address in use

pi@gladys:~ $ docker ps -a
CONTAINER ID   IMAGE                          COMMAND                  CREATED        STATUS                         PORTS      NAMES
ee8c9aef0d9a   gladysassistant/gladys:v4      "docker-entrypoint.s…"   2 days ago     Up 18 minutes                             gladys
90c1b2365611   eclipse-mosquitto:2            "/docker-entrypoint.…"   5 days ago     Up 18 minutes                             gladys-z2m-mqtt
f225bc1faad1   eclipse-mosquitto:2            "/docker-entrypoint.…"   5 days ago     Restarting (1) 8 seconds ago              eclipse-mosquitto
de219f947a06   containrrr/watchtower:latest   "/watchtower --clean…"   10 days ago    Up 18 minutes                  8080/tcp   watchtower
7c35f8eb4589   koenkk/zigbee2mqtt:latest      "docker-entrypoint.s…"   10 days ago    Up 18 minutes                             gladys-z2m-zigbee2mqtt
ebaacd05ab1c   nodered/node-red:latest        "./entrypoint.sh"        2 months ago   Exited (143) 4 minutes ago                node_red

I need to be away for 1 hour. Sorry

netstat -ltnup | grep ':1883'

pi@gladys:~ $ netstat -ltnup | grep ':1883'
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 127.0.0.1:1883          0.0.0.0:*               LISTEN      -
tcp6       0      0 ::1:1883                :::*                    LISTEN      -


And with sudo?

You wouldn’t have changed the port on the zigbee2mqtt side by any chance?

I have this :

sudo netstat -ltnup | grep ':1883'

pi@gladys:~ $ sudo netstat -ltnup | grep ':1883'
tcp        0      0 127.0.0.1:1883          0.0.0.0:*               LISTEN      540/mosquitto
tcp6       0      0 ::1:1883                :::*                    LISTEN      540/mosquitto

Restart your Pi just in case, because unless you installed mosquitto manually I don’t see what else it could be.

Already tried, with no result.
I think I’ll be able to reinstall everything!

I still have a small question.

  1. Why pins D6 and D7?

  2. Since I have two 5000L water tanks, is it possible to add a second JSN-SR04T sensor to the same Wemos by adapting the script, of course!

:wink:

MISO / MOSI

No, I don’t think so, you’re going to have voltage issues anyway.

Thanks for the info :wink:

I did it but using an Arduino (I didn’t know Wemos at the time).
In your case, it would be better to keep them independent…