Closed bgewehr closed 9 years ago
Is your MQTT broker running on the Pi?
yes, i have a valid connection to mosquitto from fhem and the service is running on the pi.
Can you try using 127.0.0.1 as the host address instead of localhost?
On 5/06/2015 8:43 a.m., Bernd Gewehr wrote:
yes, i have a valid connection to mosquitto from fhem and the service is running on the pi.
— Reply to this email directly or view it on GitHub https://github.com/sumnerboy12/mqtt-gpio-monitor/issues/3#issuecomment-109044044.
2015-06-04 22:44:43,059 ERROR Error connecting to 127.0.0.1:1833: [Errno 111] Connection refused
Can you connect using mosquitto_sub with the same connection properties?
Do you have authentication enabled/TLS?
On 5/06/2015 8:45 a.m., Bernd Gewehr wrote:
2015-06-04 22:44:43,059 ERROR Error connecting to 127.0.0.1:1833: [Errno 111] Connection refused
— Reply to this email directly or view it on GitHub https://github.com/sumnerboy12/mqtt-gpio-monitor/issues/3#issuecomment-109044505.
no auth is enabled as far as i know. Sorry, don't know what mosquitto_sub is.
It is the mosquitto subscription client - very useful for debugging these sorts of things. Google around and give it a try. Will hopefully shed some light as to why you cannot connect. I don't think this is anything to do with mqtt-gpio-monitor but I could be wrong!
On 5/06/2015 8:49 a.m., Bernd Gewehr wrote:
no auth is enabled as far as i know. Sorry, don't know what mosquitto_sub is.
— Reply to this email directly or view it on GitHub https://github.com/sumnerboy12/mqtt-gpio-monitor/issues/3#issuecomment-109045502.
i'll try that. Thank you!
pi@raspberrypi /usr/local/mqtt-gpio-monitor $ mosquitto_sub -d -h localhost -p 1883 -t Gartenwasser/IO/+ Received CONNACK Received SUBACK Subscribed (mid: 1): 0 is that good?
Yep - that looks ok I think. I am not sure I ever tried running my MQTT broker on the same Pi. Can you try using tcp://127.0.0.1
as the host address?
Now not better: 2015-06-05 09:17:25,950 ERROR Error connecting to tcp://127.0.0.1:1833: [Errno -2] Name or service not known
Maybe the idea is to place mosquitto on the other pi where fhem is running?
Not really: 2015-06-05 09:22:59,190 ERROR Error connecting to fhem:1833: [Errno 111] Connection refused pi@
I can connect to test.mosquitto.org without errors. Damned!
I used the Debian package for mosquitto, it tells to be V 0.15-2. Is this the right one?
Now installed latest stable version 1.4.2 from mosquitto.org. No change. May it be a problem of which user it is mosquitto runs on?
Now look at this: @raspberrypi ~/mqtt-gpio-monitor $ sudo mosquitto 1433490835: mosquitto version 1.4.2 (build date Mon, 18 May 2015 15:25:19 +0100) starting 1433490835: Using default config. 1433490835: Opening ipv4 listen socket on port 1883. 1433490835: Opening ipv6 listen socket on port 1883. 1433490835: Warning: Address family not supported by protocol
Turns out to be a mosquitto issue so if you have any suggestions you're welcome but otherwise we better close here!
On the other hand fhem connects without problems: 1433490884: New connection from 192.168.178.48 on port 1883. 1433490884: New client connected from 192.168.178.48 as NetMQTTpm11731 (c1, k60).
Maybe an IPV6 issue?
Sorry Bernd, been out all evening and just returned home. Can you post your mosquitto config file?
On 05/06/2015 8:22 p.m., Bernd Gewehr wrote:
Maybe an IPV6 issue?
— Reply to this email directly or view it on GitHub https://github.com/sumnerboy12/mqtt-gpio-monitor/issues/3#issuecomment-109201266.
oot@raspberrypi:/etc/mosquitto# cat mosquitto.conf
#
pid_file /var/run/mosquitto.pid
persistence true persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d root@raspberrypi:/etc/mosquitto#
conf.d is empty, just a readme in there!
I wonder why nobody else has reported this issue because i used a clean actual raspian and just put those few packages onto it. Schould be pretty new and clean...
Missing dependencies? How could i investigate?
Try adding
# Security
allow_anonymous true
# Default listener
listener 1883
protocol mqtt
and restarting mosquitto
Sorry, no change: 2015-06-06 20:36:33,044 INFO Starting mqtt-gpio-monitor 2015-06-06 20:36:33,049 INFO INFO MODE 2015-06-06 20:36:33,051 DEBUG DEBUG MODE 2015-06-06 20:36:33,053 DEBUG INIFILE = mqtt-gpio-monitor.ini 2015-06-06 20:36:33,055 DEBUG LOGFILE = mqtt-gpio-monitor.log 2015-06-06 20:36:33,073 INFO RPi.GPIO module detected... 2015-06-06 20:36:33,076 DEBUG Monitoring pins [21, 22, 23, 24] 2015-06-06 20:36:33,088 DEBUG Initialising GPIO input pin 21... 2015-06-06 20:36:33,091 DEBUG Initialising GPIO input pin 22... 2015-06-06 20:36:33,093 DEBUG Initialising GPIO input pin 23... 2015-06-06 20:36:33,096 DEBUG Initialising GPIO input pin 24... 2015-06-06 20:36:33,099 DEBUG Connecting to 127.0.0.1:1833... 2015-06-06 20:36:33,104 ERROR Error connecting to 127.0.0.1:1833: [Errno 111] Connection refused
What about using the ipv6 loopback address?
2015-06-06 20:38:56,913 INFO Starting mqtt-gpio-monitor 2015-06-06 20:38:56,916 INFO INFO MODE 2015-06-06 20:38:56,919 DEBUG DEBUG MODE 2015-06-06 20:38:56,921 DEBUG INIFILE = mqtt-gpio-monitor.ini 2015-06-06 20:38:56,923 DEBUG LOGFILE = mqtt-gpio-monitor.log 2015-06-06 20:38:56,931 INFO RPi.GPIO module detected... 2015-06-06 20:38:56,934 DEBUG Monitoring pins [21, 22, 23, 24] 2015-06-06 20:38:56,946 DEBUG Initialising GPIO input pin 21... 2015-06-06 20:38:56,949 DEBUG Initialising GPIO input pin 22... 2015-06-06 20:38:56,952 DEBUG Initialising GPIO input pin 23... 2015-06-06 20:38:56,954 DEBUG Initialising GPIO input pin 24... 2015-06-06 20:38:56,957 DEBUG Connecting to ::1:1833... 2015-06-06 20:38:56,977 ERROR Error connecting to ::1:1833: [Errno 97] Address family not supported by protocol
Not better...
Now I have IPv6 successfully enabled. The address family failures are gone but connection refused stays the result!
Can you retry mosquitto_sub on the Pi and confirm it is connecting ok and able to receive messages?
Running out of ideas here... On 7/06/2015 8:07 am, "Bernd Gewehr" notifications@github.com wrote:
Now I have IPv6 successfully enabled. The address family failures are gone but connection refused stays the result!
— Reply to this email directly or view it on GitHub https://github.com/sumnerboy12/mqtt-gpio-monitor/issues/3#issuecomment-109644234 .
Now no longer: root@raspberrypi:/home/pi/mqtt-gpio-monitor# mosquitto_sub -d -t + Received CONNACK Connection Refused: not authorised
Thank you for your time!
Ok - so you seem to have some sort of authentication configured - this is not an issue with mqtt-gpio-monitor but your mosquitto install. Do you definitely have allow_anonymous true
in your mosquito.conf? You should focus on getting mosquitto_sub
to work with your broker before worrying about mqtt-gpio-monitor
.
Found that now:
1433622796: New connection from 127.0.0.1 on port 1883.
1433622796: Sending CONNACK to 127.0.0.1 (0, 5)
1433622796: Socket error on client
So the socket seems to be the issue. do you agree?
I have never seen a mosquitto broker die like that - must be something to do with your broker install/config - sorry a bit beyond my level of expertise! Might be worth a question in the mosquitto forums?
here again my mosquitto.conf: allow_anonymous true autosave_interval 1800 connection_messages true log_dest file /var/log/mosquitto/mosquitto.log log_dest stderr log_dest topic log_type error log_type warning log_type notice log_type information log_type all log_type debug log_timestamp true
persistence true persistence_location /tmp/ persistence_file mosquitto.db persistent_client_expiration 1m
retained_persistence true listener 1883 listener 8883 tls_version tlsv1 cafile /etc/mosquitto/ca_certificates/ca.crt certfile /etc/mosquitto/certs/server.crt keyfile /etc/mosquitto/certs/server.key require_certificate false
I'll go over to the mosquitto mailing list. Thank you again for your help!
I am also having this issue. Everything is on the single pi.
I am also having the same issue. It works for the first time. But afterward, I am this error.
This issue has been closed as it is not related to mqqt-gpio-monitor
but a broker config/connection issue.
Hi Sumnerboy,
i am trying to use your code for my idea of garden water management with a pi and some stuff like magnetic valves and flow meters connected to the gpio.
That error message appears in the logfile and doesn't mean anything to me, can you tell something about it?
2015-06-04 21:41:07,980 INFO Starting mqtt-gpio-monitor 2015-06-04 21:41:07,983 INFO INFO MODE 2015-06-04 21:41:07,985 DEBUG DEBUG MODE 2015-06-04 21:41:07,987 DEBUG INIFILE = mqtt-gpio-monitor.ini 2015-06-04 21:41:07,989 DEBUG LOGFILE = mqtt-gpio-monitor.log 2015-06-04 21:41:08,007 INFO RPi.GPIO module detected... 2015-06-04 21:41:08,010 DEBUG Monitoring pins [21, 22, 23, 24] 2015-06-04 21:41:08,021 DEBUG Initialising GPIO input pin 21... 2015-06-04 21:41:08,025 DEBUG Initialising GPIO input pin 22... 2015-06-04 21:41:08,028 DEBUG Initialising GPIO input pin 23... 2015-06-04 21:41:08,030 DEBUG Initialising GPIO input pin 24... 2015-06-04 21:41:08,032 DEBUG Connecting to localhost:1833... 2015-06-04 21:41:08,072 ERROR Error connecting to localhost:1833: [Errno 97] Address family not supported by protocol
Thank you very much!