Skip to main content

A useful Salt Event returner for publishing messages to MQTT or AWS IoT

Project description

mqtt_return

A useful Salt Event returner for publishing messages to MQTT or AWS IoT

Quickstart

To get started with your new project:

# Create a new venv
python3 -m venv env --prompt mqtt_return
source env/bin/activate

# On mac, you may need to upgrade pip
python -m pip install --upgrade pip

# On WSL or some flavors of linux you may need to install the `enchant`
# library in order to build the docs
sudo apt-get install -y enchant

# Install extension + test/dev/doc dependencies into your environment
python -m pip install -e .[tests,dev,docs]

# Run tests!
python -m nox -e tests-3

# skip requirements install for next time
export SKIP_REQUIREMENTS_INSTALL=1

# Build the docs, serve, and view in your web browser:
python -m nox -e docs && (cd docs/_build/html; python -m webbrowser localhost:8000; python -m http.server; cd -)

# Run the example function
salt-call --local mqtt_return.example_function text="Happy Hacking!"

Configuration

For publishing to a standard MQTT broker

event_return: [mqtt_return]

returner.mqtt_return.output: mqtt

returner.mqtt_return.endpoint: mqtt
returner.mqtt_return.port: 1883
returner.mqtt_return.topic_prefix: "example/prefix"

For publishing to AWS IoT Core MQTT broker using boto3 and the iot-data client

event_return: [mqtt_return]

returner.mqtt_return.output: awsiot

returner.mqtt_return.endpoint: https://example.iot.amazonaws.com
returner.mqtt_return.topic_prefix: "example/prefix"
returner.mqtt_return.aws_access_key_id: "aaaaa"
returner.mqtt_return.aws_secret_access_key: "aaaaa"

Topic Re-writing

Allows you to re-write the topics with Regex and Python Substr

For example to remove the salt/ prefix from the topics:

returner.mqtt_return.topic_rewrite_regex: "salt/"
returner.mqtt_return.topic_rewrite_replace: ""

Project details


Download files

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

Source Distribution

saltext.mqtt_return-1.0.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

saltext.mqtt_return-1.0-py2.py3-none-any.whl (9.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file saltext.mqtt_return-1.0.tar.gz.

File metadata

  • Download URL: saltext.mqtt_return-1.0.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for saltext.mqtt_return-1.0.tar.gz
Algorithm Hash digest
SHA256 66ee3b1588bbc05bf4097148eb074a1737e6fb957ad913908d3dd5818ef1a279
MD5 820033996484e92fee788c7107d99902
BLAKE2b-256 e74913877f175c07c26d8dcc56d6c8f6cabb94a3d95aee1d1e2a75f30e740815

See more details on using hashes here.

File details

Details for the file saltext.mqtt_return-1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for saltext.mqtt_return-1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8f4153b8351423b3c912f0e8847bea96eddc4d33743558a68259c4eddf031534
MD5 4efc2b3a64d4a2f72a239f0967a88134
BLAKE2b-256 91d814f9074a69f2f2030da5daac0ada8af12e8f6cf8cd526a1acda8b10ee6ef

See more details on using hashes here.

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