Files
        @ ce32edfd2399
    
        
              Branch filter: 
        
    Location: HydroBot/hydrobot-software/hydrobot_data_test.py - annotation
        
            
            ce32edfd2399
            873 B
            text/x-python
        
        
    
    Refactoring code to make it more object oriented, modular, and usable
    94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578 94cab616b578  | import time
import random
from influxdb import InfluxDBClient
temp = 65.5
humid = 0.50
press = 950
while True:
    
    temp = random.randint(-1, 1)/2 + temp
    humid = random.randint(-1, 1)/100 + humid
    press = random.randint(-1, 1) + press
    
    json_body = [
        {
            "measurement": "air_temp",
            "fields": {
                "value": temp
            }
        },
        {
            "measurement": "air_humidity",
            "fields": {
                "value": humid
            }
        },
        {
            "measurement": "air_pressure",
            "fields": {
                "value": press
            }
        }
    ]
    client = InfluxDBClient("www.protofusion.org", 8086, 'admin', 'admin', 'hydrobot')
    client.write_points(json_body)
    print("yes!")
    
    time.sleep(60)
 |