smar000 / evoGateway

Python script for listening in and responding to evohome heating control radio messages
47 stars 17 forks source link

MQTT Startup Issue #6

Closed GadgetUK closed 4 years ago

GadgetUK commented 4 years ago

Trying to get up and running, get the following

2019-11-01 21:13:53 | | | evohome Listener/Sender Gateway version 1.9.5
2019-11-01 21:13:54 | | | 1: Connected to serial port /dev/ttyUSB0
2019-11-01 21:13:54 | | |
2019-11-01 21:13:54 | | | -----------------------------------------------------------
2019-11-01 21:13:54 | | | Devices loaded from 'devices.json' file:
2019-11-01 21:13:54 | | | 01:111111 - Living Room - Zone 1 [Master]
2019-11-01 21:13:54 | | | 30:071715 - EvoGateway - Zone 240 [Master]
2019-11-01 21:13:54 | | | -----------------------------------------------------------
2019-11-01 21:13:54 | | |
2019-11-01 21:13:54 | | | Listening...
2019-11-01 21:13:54 | |
| Connecting to mqtt server 10.0.10.4
Traceback (most recent call last): File "evogateway.py", line 1362, in initialise_mqtt_client(mqtt_client) File "evogateway.py", line 370, in initialise_mqtt_client mqtt_client.connect(MQTT_SERVER, port=1883, keepalive=0, bind_address="") File "/home/pi/.local/lib/python2.7/site-packages/paho/mqtt/client.py", line 937, in connect return self.reconnect() File "/home/pi/.local/lib/python2.7/site-packages/paho/mqtt/client.py", line 1071, in reconnect sock = self._create_socket_connection() File "/home/pi/.local/lib/python2.7/site-packages/paho/mqtt/client.py", line 3522, in _create_socket_connection return socket.create_connection(addr, source_address=source, timeout=self._keepalive) File "/usr/lib/python2.7/socket.py", line 575, in create_connection raise err socket.error: [Errno 115] Operation now in progress

smar000 commented 4 years ago

Sorry, no idea. Have you got your mqtt broker correctly defined/on standard ports etc? Judging from the errors, the script seems to be having difficulties in connecting to it.

GadgetUK commented 4 years ago

Turns out that you can't have a keepalive equal to 0 in the mqtt_client.connect

smar000 commented 4 years ago

keepalive of 0 turns off the keepalive checking. Although the better solution would be to put a keepalive of say 5 minutes (as devices can take up to 4 minutes to wake up on the evohome network), and extend the code to auto-reconnect etc, the keepalive of 0 should still work. It has been working for me and others for over a year....

smar000 commented 4 years ago

If nothing further, I'll close this issue. Please do not hesitate to re-open this or a new issue if something else comes up.

inode- commented 4 years ago

Same problem here, with keepalive at 0 I got the same error and doesn't start. Modifing keepalive all is working.

smar000 commented 4 years ago

Interesting. Maybe due to version compatibilities? If and when I get some time, I may look into it further, as I recall there was a specific reason that I had set it to zero.