tve/mqboard

Hello World example not working with Mosquitto broker

Opened this issue · 0 comments

The Hello World example in https://github.com/tve/mqboard/blob/master/mqtt_async/README.md is not working with Mosquitto broker. Default setting of keepalive is 0, Mosquitto however does not support such setting:

$ mosquitto_pub -p 1883 -h HOST -t 'topic/subtopic' -m elho -u USER -P PASS -k 0                               
Error: Invalid keepalive given, it must be between 5 and 65535 inclusive.

There are two ways how to fix it:

  • either set keepalive to 5 in mqtt_async.py in this section:
    if lw is None:
      keepalive = 0
    
    or
  • set keepalive and will manually in config:
from mqtt_async import MQTTClient, config, MQTTMessage
..
config['keepalive'] = 0
config['will'] = MQTTMessage('special/msg', 'bye')