{"id":19865643,"url":"https://github.com/openfaas/mqtt-connector","last_synced_at":"2025-05-02T05:31:48.704Z","repository":{"id":52978301,"uuid":"225670403","full_name":"openfaas/mqtt-connector","owner":"openfaas","description":"MQTT connector for OpenFaaS","archived":false,"fork":false,"pushed_at":"2023-10-11T23:23:31.000Z","size":245,"stargazers_count":35,"open_issues_count":2,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-06T23:06:16.453Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openfaas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-03T16:49:20.000Z","updated_at":"2025-03-28T09:08:00.000Z","dependencies_parsed_at":"2024-06-21T18:59:31.779Z","dependency_job_id":"e8f2cd5f-4de2-4f5c-a155-f163692495e5","html_url":"https://github.com/openfaas/mqtt-connector","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfaas%2Fmqtt-connector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfaas%2Fmqtt-connector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfaas%2Fmqtt-connector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfaas%2Fmqtt-connector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openfaas","download_url":"https://codeload.github.com/openfaas/mqtt-connector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251992926,"owners_count":21677022,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T15:23:33.497Z","updated_at":"2025-05-02T05:31:43.667Z","avatar_url":"https://github.com/openfaas.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## mqtt-connector\n\nThis is an MQTT connector for OpenFaaS.\n\n[![build](https://github.com/openfaas/mqtt-connector/actions/workflows/build.yaml/badge.svg)](https://github.com/openfaas/mqtt-connector/actions/workflows/build.yaml)\n\n## About\n\nOnce configured and deployed it will deliver messages from selected topics to OpenFaaS functions.\n\nThere are various other connectors available for OpenFaaS which form [\"triggers\"](https://docs.openfaas.com/reference/triggers/) for event-driven architectures.\n\nPrior work:\n\nThis is inspired by prior work by [Alex Ellis](https://www.alexellis.io): [Collect, plot and analyse sensor readings from your IoT devices with OpenFaaS](https://github.com/alexellis/iot-sensors-mqtt-openfaas)\n\nComponent parts:\n\n* [connector-sdk](https://github.com/openfaas/connector-sdk/blob/) from OpenFaaS\n* The Eclipse provides [a test broker](https://mosquitto.org)\n* Eclipse's [paho.mqtt.golang package](https://github.com/eclipse/paho.mqtt.golang) provides the connection to MQTT.\n\n## Deploy in-cluster with Kubernetes\n\nSee [helm chart](https://github.com/openfaas/faas-netes/tree/master/chart/mqtt-connector) for deployment instructions. Then continue at \"Test the connector\".\n\n```sh\nexport TAG=0.3.1\n\nmake build push\n```\n\n## Deploy out of cluster\n\n```sh\ngo build\n\nexport GATEWAY_PASSWORD=\"\"\nexport BROKER=\"tcp://test.mosquitto.org:1883\"\nexport TOPIC=\"openfaas-sensor-data\"\n\n./mqtt-connector --gateway http://127.0.0.1:8080 \\\n  --broker $BROKER \\\n  --gw-username admin \\\n  --gw-password $GATEWAY_PASSWORD \\\n  --topic $TOPIC\n```\n\nDeploy a function:\n\n```bash\nfaas-cli deploy --name echo --image ghcr.io/openfaas/alpine:latest \\\n  --fprocess=cat \\\n  --annotation topic=\"openfaas-sensor-data\"\n````\n\n## Test the connector\n\nAnnotate a function with the annotation `topic: $TOPIC` \u003c- where `$TOPIC` is the MQTT topic you care about.\n\n```sh\n2019/12/03 16:43:26 Topic: topic        Broker: tcp://test.mosquitto.org:1883\n2019/12/03 16:43:29 Invoking (http://192.168.0.35:8080) on topic: \"topic\", value: \"{\\\"sensor\\\": \\\"s1\\\", \\\"humidity\\\": \\\"52.09\\\", \\\"temp\\\": \\\"23.200\\\", \\\"ip\\\": \\\"192.168.0.40\\\", \\\"vdd33\\\": \\\"65535\\\", \\\"rssi\\\": -45}\"\n2019/12/03 16:43:29 Invoke function: print-out\nSend: \"{\\\"sensor\\\": \\\"s1\\\", \\\"humidity\\\": \\\"52.09\\\", \\\"temp\\\": \\\"23.200\\\", \\\"ip\\\": \\\"192.168.0.40\\\", \\\"vdd33\\\": \\\"65535\\\", \\\"rssi\\\": -45}\"\n2019/12/03 16:43:29 connector-sdk got result: [200] topic =\u003e print-out (24) bytes\n[200] topic =\u003e print-out\n{\"temperature\":\"23.200\"}\n2019/12/03 16:43:29 tester got result: [200] topic =\u003e print-out (24) bytes\n```\n\nThis data was generated on the topic `topic` by my NodeMCU device which publishes sensor data.\n\nA `node12` function named `print-out` returned the temperature as reported.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenfaas%2Fmqtt-connector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenfaas%2Fmqtt-connector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenfaas%2Fmqtt-connector/lists"}