import socket
import json
import time
from distancemeter import get_distance,cleanup

# Logstash TCP/JSON Host
JSON_PORT = 5959
JSON_HOST = '127.0.0.1'

if __name__ == '__main__':
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.connect((JSON_HOST, JSON_PORT))

        while True:
            distance = get_distance()
            data = {'message': 'distance %.1f cm' % distance, 'distance': distance, 'hostname': socket.gethostname()}

            s.send(json.dumps(data))
            s.send('\n')
            print ("Received distance = %.1f cm" % distance)
            time.sleep(0.2)

    # interrupt
    except KeyboardInterrupt:
        print("Program interrupted")

@@ -35,54 +35,21 @@
 ime%0A
-from distancemeter import get_distance,cleanup
+import random
 %0A%0A# 
@@ -290,33 +290,48 @@
     
-distance = get_distance()
+temperature = random.uniform(0.0, 35.0) 
 %0A   
@@ -363,57 +363,39 @@
 ': '
-distanc
+temperatur
 e %25
-.
 1f 
-cm
+C
 ' %25 
-distance, 'distance': distanc
+temperatur
 e, '
@@ -519,23 +519,26 @@
 eceived 
-distanc
+temperatur
 e = %25.1f
@@ -542,21 +542,23 @@
 .1f 
-cm
+C
 %22 %25 
-distanc
+temperatur
 e)%0A 

Update jsonSender.py