Commit e2a8f85f7000cdd1816c5b522d01dc9eaf324fa3

Authored by mp-loki
Committed by Andrew Shvayka
1 parent bdaee28d

License Header updated

  1 +# -*- coding: utf-8 -*-
1 # 2 #
  3 +# Copyright © 2016-2017 The Thingsboard Authors
2 # 4 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License. 6 # you may not use this file except in compliance with the License.
@@ -23,22 +25,12 @@ topic_pub='v1/devices/me/telemetry' @@ -23,22 +25,12 @@ topic_pub='v1/devices/me/telemetry'
23 25
24 client = mqtt.Client() 26 client = mqtt.Client()
25 27
26 -client.username_pw_set("qyA3gP50SpGwfwyNGyi7") 28 +client.username_pw_set("TEST_TOKEN")
27 client.connect('127.0.0.1', 1883, 1) 29 client.connect('127.0.0.1', 1883, 1)
28 30
29 -for i in range(100): 31 +for i in range(5):
30 x = random.randrange(20, 100) 32 x = random.randrange(20, 100)
31 print x 33 print x
32 msg = '{"windSpeed":"'+ str(x) + '"}' 34 msg = '{"windSpeed":"'+ str(x) + '"}'
33 client.publish(topic_pub, msg) 35 client.publish(topic_pub, msg)
34 sleep(0.1) 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)