Skip to content

Simple examples to demo Paho and test a MQTT Broker

License

Notifications You must be signed in to change notification settings

StooC/MqttPahoExamples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MqttPahoExamples

Simple examples to demo paho.mqtt.client and test a MQTT Broker. Not that environment variables are used to have settings config/passwords in source file, see below for details.

Dependances

This code has been developed on the Python 3.8.3 and uses paho-mqtt and dotenv (this code can be removed and values set directly in code if preferred)

  • pip install paho-mqtt
  • pip install -U python-dotenv

Using .env file

If leaving the code as is you need to define values for the broker, topic, etc. in a .env file (or set OS environment variables) in the same folder as the script files. This could contain key value pairs such as:

  • MQTT_BROKER="192.168.X.X"
  • MQTT_TOPIC="test/hello"
  • CLIENT_USER="user"
  • CLIENT_PWD="password"

See dotenv on GitHub for more details.

About

Simple examples to demo Paho and test a MQTT Broker

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages