mqtt-sdt-sdk-template/main.py

19 lines
370 B
Python
Raw Permalink Normal View History

2024-03-05 08:41:11 +00:00
import sdtcloudpubsub
import time
import uuid
sdtcloud = sdtcloudpubsub.sdtcloudpubsub()
2024-05-21 06:18:38 +00:00
sdtcloud.setClient(f"device-app-{uuid.uuid1()}") # parameter is client ID(string)
2024-03-05 08:41:11 +00:00
def runAction():
while True:
msg = {
"message": "Hello World"
}
2024-05-21 06:18:38 +00:00
sdtcloud.pubMessage(msg)
2024-03-05 08:41:11 +00:00
time.sleep(2)
if __name__ == "__main__":
runAction()