Skip to content

Latest commit

 

History

History
46 lines (40 loc) · 1.43 KB

mosquitto-mqtt-testing-cheatsheet.md

File metadata and controls

46 lines (40 loc) · 1.43 KB
aliases category classification date date_modified draft id image links local_archive_links pinned print series tags title type
mosquitto-mqtt-testing-cheatsheet
mosquitto
public
2023-08-15 02:41:46 -0700
2023-08-15 02:41:46 -0700
false
20230815094146
attachments/20230815094146.html
false
false
mosquitto
mqtt
publish
subscribe
messaging
topic
home-assistant
Mosquitto/MQTT Testing Cheatsheet
tech-note
# Create a topic called test:
docker run --network home-assistant-01 -it eclipse-mosquitto:latest mosquitto_sub -h <mosquitto-hostname> -t test

# Create a topic called test whilst providing credentials:
docker run --network home-assistant-01 -it eclipse-mosquitto:latest mosquitto_sub -h <mosquitto-hostname> -t test -u admin -P "<mosquitto-password>"

# Send a message to the test topic:
docker run --network home-assistant-01 -it eclipse-mosquitto:latest mosquitto_pub -h <mosquitto-hostname> -t test -m "hello"

# Send a message to the test topic with credentials:
docker run --network home-assistant-01 -it eclipse-mosquitto:latest mosquitto_pub -h <mosquitto-hostname> -t test -m "hello" -u admin -P "<mosquitto-password>"

# Add a password for a user to the passwd file:
docker exec -it ha_mosquitto-01 mosquitto_passwd -c /mosquitto/config/mosquitto.passwd admin