2024-03-26 06:23:59 +00:00
|
|
|
import sdtcloudnodeqmqtt
|
|
|
|
import time
|
|
|
|
import uuid
|
|
|
|
import random
|
|
|
|
|
|
|
|
sdtcloud = sdtcloudnodeqmqtt.sdtcloudnodeqmqtt()
|
2024-04-30 05:57:35 +00:00
|
|
|
sdtcloud.setClient(f"device-app-{uuid.uuid1()}") # parameter is client ID(string)
|
2024-03-26 06:23:59 +00:00
|
|
|
|
|
|
|
def runAction():
|
|
|
|
while True:
|
|
|
|
msg = [{
|
|
|
|
"house_id": "JJ58",
|
|
|
|
"device_type": "gas",
|
|
|
|
"pulse_count": random.randint(0, 1)
|
|
|
|
}]
|
2024-04-30 05:57:35 +00:00
|
|
|
sdtcloud.pubMessage(msg)
|
2024-03-26 06:23:59 +00:00
|
|
|
time.sleep(10)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
runAction()
|
|
|
|
|