-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConnectionRefusedError: [Errno 111] Connection refused #48
Comments
Your error states "Connection refused"
Can you double check your mqtt connection details?
Can you connect to your mqtt broker with the same details when using a
different app (like mqtt Explorer for example)?
…On Tue, 9 Nov 2021 at 23:53, spetter1337 ***@***.***> wrote:
*Describe the bug*
***@***.***:~ $ bash /home/pi/scaleish/wrapper.sh
------------------------------
2021-11-10 00:46:37 - Starting Xiaomi mi Scale...
2021-11-10 00:46:37 - Loading Config From Options.json...
2021-11-10 00:46:37 - Config Loaded...
Traceback (most recent call last):
File "/home/pi/scaleish/Xiaomi_Scale.py", line 298, in
main()
File "/home/pi/scaleish/Xiaomi_Scale.py", line 264, in main
discovery()
File "/home/pi/scaleish/Xiaomi_Scale.py", line 156, in discovery
tls=MQTT_TLS
File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/publish.py",
line 241, in single
protocol, transport, proxy_args)
File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/publish.py",
line 176, in multiple
client.connect(hostname, port, keepalive)
File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py",
line 914, in connect
return self.reconnect()
File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py",
line 1044, in reconnect
sock = self._create_socket_connection()
File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py",
line 3685, in _create_socket_connection
return socket.create_connection(addr, timeout=self._connect_timeout,
source_address=source)
File "/usr/lib/python3.7/socket.py", line 727, in create_connection
raise err
File "/usr/lib/python3.7/socket.py", line 716, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
*To Reproduce*
Steps to reproduce the behaviour, including error message if any.
*Expected behaviour*
A clear and concise description of what you expected to happen.
Expected the scripts to run successfully.
*Screenshots*
If applicable, add screenshots to help explain your problem.
*Scale (please complete the following information):*
- Name Xiaomi Smart Scale 2
- Model #
*Desktop/Server (please complete the following information):*
- Docker or manually ran after a Git Clone? Docker
- Device used to run the Script/Container [e.g. Raspberry Pi, NUC]
Raspberry Pi 4
- Bluetooth device used [e.g. Built-in, USB Dongle] Built-in
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#48>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABDABYX44MLYADWT2SC7I7DULGX7PANCNFSM5HWRSHVA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
For some reason, the MQTT module didnt get installed. I now completed that and also ran the bash with sudo and it worked! Only config of Home Assistant left :D 2021-11-10 21:37:32 - Starting Xiaomi mi Scale... |
When I do "docker container ls" in the terminal, it says that the container is restarting. Is that suppose to be the case? d5621dcd3f2b |
no it should not restart. You should see things in the logs if it doesn't work correctly. |
Hm... I have successfully managed to get the data streaming into Home Assistant now - i.e. when get on the scale, new data pops up in HA will the correct metrics. Did the HA MQTT integration |
Getting the following errors in the logs though: 2021-11-10 21:30:16 - Starting Xiaomi mi Scale... During handling of the above exception, another exception occurred: Traceback (most recent call last): |
My options.json path is: /home/pi/scaleish/options.json. Guess that's why the issue occurs? However, where am I suppose to do the replacement? |
So you found a bug in my code. Thanks 👍
Provided there is just options.json in that folder (just in case) |
Thank you! I had the default volume that you had in your file here at github, so that makes sense. Just one newbie question: I have now edited the docker-compose.yml file - what command do I need to write into the terminal in order for the container to be updated? Tried restarting the container but didn't change anything. |
go where the docker-compose.yml is located and type |
Thanks, much appreciated. Looooove this, gonna push everything into Splunk later. Now I get it, the container is used as a mean to execute the scripts and initiate MQTT between the scale and the raspberry. But because I used bash before - i.e "Running script directly on your host system" - I was still able to get the MQTT up and running, however, using the container seems more convenient as it won't require having the CLI open etc. |
docker is the way to go. No need to worry about dependencies or about having to install additional apps. |
A question with regards to the volume in the docker-compose file. volumes: I have tried to do some googling to understand the logic behind it, but I still don't quite get it. Is my idea of it (stated below) correct to some extent?
Also, this is (if I'm correct) classified as an "absolut path mapping", but there seems to be other ways to define volumes (e.g. named volume). In this specific case, would it be possible to define the volume in another way and achieve the same result? Or is the current definition the only way to go? Thanks! |
Hi. You're spot on
…On Thu, 11 Nov 2021 at 08:35, spetter1337 ***@***.***> wrote:
A question with regards to the volume in the docker-compose file.
volumes:
- /home/pi/scaleish:/data
I have tried to do some googling to understand the logic behind it, but I
still don't quite get it. Is my idea of it stated below correct to some
extent?
- /home/pi/scaleish = defines the path on the host where the necessary
resources are stored for the container to run (xiaomi python scripts,
options.json etc)
- /data = the directory in the container that will be mapped to the
/home/pi/scaleish, completing the resource integration enabling the
container to retrieve the resources from the host and run successfully
Thanks!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#48 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABDABYRNERRR5ABR4CYNAQTULN56JANCNFSM5HWRSHVA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Describe the bug
pi@goforit:~ $ bash /home/pi/scaleish/wrapper.sh
2021-11-10 00:46:37 - Starting Xiaomi mi Scale...
2021-11-10 00:46:37 - Loading Config From Options.json...
2021-11-10 00:46:37 - Config Loaded...
Traceback (most recent call last):
File "/home/pi/scaleish/Xiaomi_Scale.py", line 298, in
main()
File "/home/pi/scaleish/Xiaomi_Scale.py", line 264, in main
discovery()
File "/home/pi/scaleish/Xiaomi_Scale.py", line 156, in discovery
tls=MQTT_TLS
File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/publish.py", line 241, in single
protocol, transport, proxy_args)
File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/publish.py", line 176, in multiple
client.connect(hostname, port, keepalive)
File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 914, in connect
return self.reconnect()
File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 1044, in reconnect
sock = self._create_socket_connection()
File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection
return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
File "/usr/lib/python3.7/socket.py", line 727, in create_connection
raise err
File "/usr/lib/python3.7/socket.py", line 716, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
Expected behaviour
Expected the scripts to run successfully.
Scale (please complete the following information):
Desktop/Server (please complete the following information):
The text was updated successfully, but these errors were encountered: