Commit e2a8f85f7000cdd1816c5b522d01dc9eaf324fa3
Committed by
Andrew Shvayka
1 parent
bdaee28d
License Header updated
Showing
1 changed file
with
4 additions
and
12 deletions
1 | +# -*- coding: utf-8 -*- | |
1 | 2 | # |
3 | +# Copyright © 2016-2017 The Thingsboard Authors | |
2 | 4 | # |
3 | 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
4 | 6 | # you may not use this file except in compliance with the License. |
... | ... | @@ -23,22 +25,12 @@ topic_pub='v1/devices/me/telemetry' |
23 | 25 | |
24 | 26 | client = mqtt.Client() |
25 | 27 | |
26 | -client.username_pw_set("qyA3gP50SpGwfwyNGyi7") | |
28 | +client.username_pw_set("TEST_TOKEN") | |
27 | 29 | client.connect('127.0.0.1', 1883, 1) |
28 | 30 | |
29 | -for i in range(100): | |
31 | +for i in range(5): | |
30 | 32 | x = random.randrange(20, 100) |
31 | 33 | print x |
32 | 34 | msg = '{"windSpeed":"'+ str(x) + '"}' |
33 | 35 | client.publish(topic_pub, msg) |
34 | 36 | sleep(0.1) |
35 | -#while True: | |
36 | -# val3 = random.uniform(0, 5) | |
37 | -# val4 = random.uniform(-3, 3)# | |
38 | -# | |
39 | -# msg = '{"key3": '+ str(val3) +', "key4": ' + str(val4) + '}' | |
40 | -# | |
41 | -# print('Message: ' + msg) | |
42 | -# client.publish(topic_pub, msg) | |
43 | -# | |
44 | -# sleep(0.5) | ... | ... |