Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
ticket_consumer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mohammed.shibili
ticket_consumer
Commits
35351caf
Commit
35351caf
authored
Feb 13, 2023
by
mohammed.shibili
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test producer
parent
9bc6a85a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
producer_test
+28
-0
No files found.
producer_test
0 → 100644
View file @
35351caf
import paho.mqtt.client as mqtt
import json
# Define the dictionary you want to publish
data = {
"silver": [4, 5, 6]
}
# Convert the dictionary to a JSON string
payload = json.dumps(data)
# Define the MQTT topic you want to publish to
topic = "ticket2/silver"
# Define the MQTT broker address
broker_address = "192.168.0.220"
# Create a new MQTT client instance
client = mqtt.Client("dict_publisher")
# Connect to the MQTT broker
client.connect(broker_address)
# Publish the JSON string to the MQTT topic
client.publish(topic, payload)
# Disconnect from the MQTT broker
client.disconnect()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment