Skip to main content

Simple MQTT client implementation that fits nalkinscloud projects

Project description

nalkinscloud-mqtt-python-client

MQTT Client package for nalkinscloud project usage

Usage

## activate package logging by:
# logging.getLogger('nalkinscloud_mqtt_python_client')

from nalkinscloud_mqtt_python_client.mqtt_handler import MQTTClient

client = MQTTClient(broker_host="mosquitto.alpha.nalkins.cloud",
                    broker_port=8883,
                    broker_cert=None,
                    broker_tls=True,
                    broker_tls_skip=True)


# This is the event handler method that receives the Mosquito messages
def on_message(client, userdata, message):
    print("message received: {}".format(message.payload.decode('UTF-8')))

# this client will have default 'on_connect' function, but a custom 'on_message' function
client.init_device(device_id='some_device_id', device_type='sensor', device_password='none',
                   qos=0, subscription_update="status", on_message_func=on_message)
client.connect()
client.subscribe("test_dht_device_id/dht/temperature", 2)
client.subscribe("test_dht_device_id/dht/humidity", 2)

# Start the MQTT Mosquito process loop
client.do_loop_forever()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

File details

Details for the file nalkinscloud_mqtt_python_client-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: nalkinscloud_mqtt_python_client-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for nalkinscloud_mqtt_python_client-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cea9375f84aba9558ce57c3c89e9124fbd1c5a95a9857ea36a7db4ad67c9fbdc
MD5 f4717cea9511d9e360996481b6fa4634
BLAKE2b-256 41851e5fbc5ba9ef04325470be3f38fa069127741f74965f3f2272da9a778c78

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page