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.devices import SwitchDevice
def set_switch_state(state):
print("SET SWITCH STATE HERE")
return state
device = SwitchDevice(set_data_function=set_switch_state)
device.init_broker(broker_host="mosquitto.alpha.nalkins.cloud",
broker_port=8883,
broker_cert=None,
broker_tls=True,
broker_tls_skip=True)
# this client will have default 'on_connect' function, but a custom 'on_message' function
device.init_device(device_id='some_device_id', device_type='sensor', device_password='none', qos=0)
device.connect()
device.subscribe("v1/devices/me/rpc/request/+", 1)
# Start the MQTT Mosquito process loop
device.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-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: nalkinscloud_mqtt_python_client-1.0.3-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9431d8f6f05b1b3bbbe40a5e3bdd818ffa53991fda508006e5c21d1799ebab0 |
|
MD5 | d8ba24521b730d7fe5bba2f2fa5a6595 |
|
BLAKE2b-256 | e45a1b39882f57dfce74f82a54a40374e447080b7ad1cb6bfa0f9aab2a208d31 |