# 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
```yaml
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
```yaml
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:
```yaml
returner.mqtt_return.topic_rewrite_regex: "salt/"
returner.mqtt_return.topic_rewrite_replace: ""
```
Raw data
{
"_id": null,
"home_page": "https://github.com/keslerm/mqtt_return",
"name": "saltext.mqtt-return",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "salt-extension",
"author": "Morgan Kesler",
"author_email": "keslerm@aegiszero.is",
"download_url": "https://files.pythonhosted.org/packages/e7/49/13877f175c07c26d8dcc56d6c8f6cabb94a3d95aee1d1e2a75f30e740815/saltext.mqtt_return-1.0.tar.gz",
"platform": "any",
"description": "# mqtt_return\n\nA useful Salt Event returner for publishing messages to MQTT or AWS IoT\n\n## Quickstart\n\nTo get started with your new project:\n\n # Create a new venv\n python3 -m venv env --prompt mqtt_return\n source env/bin/activate\n\n # On mac, you may need to upgrade pip\n python -m pip install --upgrade pip\n\n # On WSL or some flavors of linux you may need to install the `enchant`\n # library in order to build the docs\n sudo apt-get install -y enchant\n\n # Install extension + test/dev/doc dependencies into your environment\n python -m pip install -e .[tests,dev,docs]\n\n # Run tests!\n python -m nox -e tests-3\n\n # skip requirements install for next time\n export SKIP_REQUIREMENTS_INSTALL=1\n\n # Build the docs, serve, and view in your web browser:\n python -m nox -e docs && (cd docs/_build/html; python -m webbrowser localhost:8000; python -m http.server; cd -)\n\n # Run the example function\n salt-call --local mqtt_return.example_function text=\"Happy Hacking!\"\n\n\n## Configuration\n\nFor publishing to a standard MQTT broker\n\n```yaml\nevent_return: [mqtt_return]\n\nreturner.mqtt_return.output: mqtt\n\nreturner.mqtt_return.endpoint: mqtt\nreturner.mqtt_return.port: 1883\nreturner.mqtt_return.topic_prefix: \"example/prefix\"\n```\n\nFor publishing to AWS IoT Core MQTT broker using boto3 and the iot-data client\n\n```yaml\nevent_return: [mqtt_return]\n\nreturner.mqtt_return.output: awsiot\n\nreturner.mqtt_return.endpoint: https://example.iot.amazonaws.com\nreturner.mqtt_return.topic_prefix: \"example/prefix\"\nreturner.mqtt_return.aws_access_key_id: \"aaaaa\"\nreturner.mqtt_return.aws_secret_access_key: \"aaaaa\"\n```\n\n\n## Topic Re-writing\n\nAllows you to re-write the topics with Regex and Python Substr\n\nFor example to remove the `salt/` prefix from the topics:\n\n```yaml\nreturner.mqtt_return.topic_rewrite_regex: \"salt/\"\nreturner.mqtt_return.topic_rewrite_replace: \"\"\n```\n",
"bugtrack_url": null,
"license": "Apache Software License",
"summary": "A useful Salt Event returner for publishing messages to MQTT or AWS IoT",
"version": "1.0",
"split_keywords": [
"salt-extension"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "4efc2b3a64d4a2f72a239f0967a88134",
"sha256": "8f4153b8351423b3c912f0e8847bea96eddc4d33743558a68259c4eddf031534"
},
"downloads": -1,
"filename": "saltext.mqtt_return-1.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "4efc2b3a64d4a2f72a239f0967a88134",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.8",
"size": 9571,
"upload_time": "2022-12-14T14:49:23",
"upload_time_iso_8601": "2022-12-14T14:49:23.775472Z",
"url": "https://files.pythonhosted.org/packages/91/d8/14f9074a69f2f2030da5daac0ada8af12e8f6cf8cd526a1acda8b10ee6ef/saltext.mqtt_return-1.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "820033996484e92fee788c7107d99902",
"sha256": "66ee3b1588bbc05bf4097148eb074a1737e6fb957ad913908d3dd5818ef1a279"
},
"downloads": -1,
"filename": "saltext.mqtt_return-1.0.tar.gz",
"has_sig": false,
"md5_digest": "820033996484e92fee788c7107d99902",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 28068,
"upload_time": "2022-12-14T14:49:25",
"upload_time_iso_8601": "2022-12-14T14:49:25.562835Z",
"url": "https://files.pythonhosted.org/packages/e7/49/13877f175c07c26d8dcc56d6c8f6cabb94a3d95aee1d1e2a75f30e740815/saltext.mqtt_return-1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-14 14:49:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "keslerm",
"github_project": "mqtt_return",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "saltext.mqtt-return"
}