update
This commit is contained in:
parent
2d139a039f
commit
ef268df604
|
@ -195,27 +195,30 @@ def local():
|
|||
|
||||
def test():
|
||||
while True:
|
||||
data = {'ambient_temperature': 1,
|
||||
'ambient_humidity': 1,
|
||||
'carbon_dioxide': 1,
|
||||
'ambient_air_pressure': 1,
|
||||
'ambient_lighting': 1,
|
||||
'soil_moisture': 1,
|
||||
'soil_temperature': 1,
|
||||
'soil_conductivity': 1,
|
||||
'soil_PH': 1,
|
||||
'soil_potassium_phosphate_nitrogen': 1,
|
||||
'soil_potassium_phosphate_phosphorus': 1,
|
||||
'soil_potassium_phosphate_potassium': 1,
|
||||
'rainfall': 1,
|
||||
'wind_speed': 1,
|
||||
'wind_direction': 1,
|
||||
'create_time': int(time.time()),
|
||||
'device_name': device_name
|
||||
}
|
||||
t2 = LOT_DATA(**data)
|
||||
add(t2)
|
||||
time.sleep(1)
|
||||
try:
|
||||
data = {'ambient_temperature': 1,
|
||||
'ambient_humidity': 1,
|
||||
'carbon_dioxide': 1,
|
||||
'ambient_air_pressure': 1,
|
||||
'ambient_lighting': 1,
|
||||
'soil_moisture': 1,
|
||||
'soil_temperature': 1,
|
||||
'soil_conductivity': 1,
|
||||
'soil_PH': 1,
|
||||
'soil_potassium_phosphate_nitrogen': 1,
|
||||
'soil_potassium_phosphate_phosphorus': 1,
|
||||
'soil_potassium_phosphate_potassium': 1,
|
||||
'rainfall': 1,
|
||||
'wind_speed': 1,
|
||||
'wind_direction': 1,
|
||||
'create_time': int(time.time()),
|
||||
'device_name': device_name
|
||||
}
|
||||
t2 = LOT_DATA(**data)
|
||||
add(t2)
|
||||
time.sleep(10)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -198,28 +198,31 @@ def t():
|
|||
|
||||
def test():
|
||||
while True:
|
||||
data = {'ambient_temperature': 1,
|
||||
'ambient_humidity': 1,
|
||||
'carbon_dioxide': 1,
|
||||
'ambient_air_pressure': 1,
|
||||
'ambient_lighting': 1,
|
||||
'soil_moisture': 1,
|
||||
'soil_temperature': 1,
|
||||
'soil_conductivity': 1,
|
||||
'soil_PH': 1,
|
||||
'soil_potassium_phosphate_nitrogen': 1,
|
||||
'soil_potassium_phosphate_phosphorus': 1,
|
||||
'soil_potassium_phosphate_potassium': 1,
|
||||
'rainfall': 1,
|
||||
'wind_speed': 1,
|
||||
'wind_direction': 1,
|
||||
'create_time': int(time.time()),
|
||||
'device_name': device_name
|
||||
}
|
||||
t2 = LOT_DATA(**data)
|
||||
client.publish('demo', payload=json.dumps(data, ensure_ascii=False), qos=0)
|
||||
add(t2)
|
||||
time.sleep(1)
|
||||
try:
|
||||
data = {'ambient_temperature': 1,
|
||||
'ambient_humidity': 1,
|
||||
'carbon_dioxide': 1,
|
||||
'ambient_air_pressure': 1,
|
||||
'ambient_lighting': 1,
|
||||
'soil_moisture': 1,
|
||||
'soil_temperature': 1,
|
||||
'soil_conductivity': 1,
|
||||
'soil_PH': 1,
|
||||
'soil_potassium_phosphate_nitrogen': 1,
|
||||
'soil_potassium_phosphate_phosphorus': 1,
|
||||
'soil_potassium_phosphate_potassium': 1,
|
||||
'rainfall': 1,
|
||||
'wind_speed': 1,
|
||||
'wind_direction': 1,
|
||||
'create_time': int(time.time()),
|
||||
'device_name': device_name
|
||||
}
|
||||
t2 = LOT_DATA(**data)
|
||||
client.publish('demo', payload=json.dumps(data, ensure_ascii=False), qos=0)
|
||||
add(t2)
|
||||
time.sleep(10)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def on_connect(client, userdata, flags, rc):
|
||||
|
|
Loading…
Reference in New Issue