Skip to content
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

Error in MQQT due to newer version? #7

Open
Tinbum1 opened this issue Oct 17, 2022 · 1 comment
Open

Error in MQQT due to newer version? #7

Tinbum1 opened this issue Oct 17, 2022 · 1 comment

Comments

@Tinbum1
Copy link

Tinbum1 commented Oct 17, 2022

Looking on the internet it seems I may be getting this rror because of the version of MQQT being newer and I'm not sure how to get round it..

2022-10-17 11:05:52,777 ERROR Failed to open account file 2022-10-17 11:05:52,777 INFO Starting MQTT client for 127.0.0. 1:1883 2022-10-17 11:05:52,779 INFO Starting alarm server on 0.0.0.0: 10500 Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run() File "/usr/lib/python3.7/threading.py", line 865, in run self._target(*self._args, **self._kwargs) File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 3 591, in _thread_main self.loop_forever(retry_first_connection=True) File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 1 756, in loop_forever rc = self._loop(timeout) File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 1 164, in _loop rc = self.loop_read() File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 1 556, in loop_read rc = self._packet_read() File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 2 439, in _packet_read rc = self._packet_handle() File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 3 039, in _packet_handle return self._handle_connack() File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 3 139, in _handle_connack self, self._userdata, flags_dict, result) TypeError: on_mqtt_connect() takes 3 positional arguments but 4 were given

@Tinbum1
Copy link
Author

Tinbum1 commented Oct 19, 2022

To answer my own question above I couldn't get this to work and found this. (I don't do much coding and am still learning but the following seems to work ok).

in alarmserver.conf

[mqtt]
port = 8883 which I think should normally be 1883

In alarmrx.py change

`def on_mqtt_connect(client, userdata, rc):
logger.info("MQTT connection established: %d" % (rc), extra={'tag': ''})

def on_mqtt_disconnect(client, userdata, rc):
`

to

`def on_mqtt_connect(client, userdata, flags, rc):
logger.info("MQTT connection established: %d" % (rc), extra={'tag': ''})

def on_mqtt_disconnect(client, userdata, flags, rc):

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant