mqboard
mqboard copied to clipboard
Hello World example not working with Mosquitto broker
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 inmqtt_async.py
in this section:
orif lw is None: keepalive = 0
- set
keepalive
andwill
manually in config:
from mqtt_async import MQTTClient, config, MQTTMessage
..
config['keepalive'] = 0
config['will'] = MQTTMessage('special/msg', 'bye')