This commit is contained in:
xyj 2023-12-09 15:41:05 +08:00
parent 2d139a039f
commit ef268df604
2 changed files with 49 additions and 43 deletions

View File

@ -195,6 +195,7 @@ def local():
def test(): def test():
while True: while True:
try:
data = {'ambient_temperature': 1, data = {'ambient_temperature': 1,
'ambient_humidity': 1, 'ambient_humidity': 1,
'carbon_dioxide': 1, 'carbon_dioxide': 1,
@ -215,7 +216,9 @@ def test():
} }
t2 = LOT_DATA(**data) t2 = LOT_DATA(**data)
add(t2) add(t2)
time.sleep(1) time.sleep(10)
except:
pass
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -198,6 +198,7 @@ def t():
def test(): def test():
while True: while True:
try:
data = {'ambient_temperature': 1, data = {'ambient_temperature': 1,
'ambient_humidity': 1, 'ambient_humidity': 1,
'carbon_dioxide': 1, 'carbon_dioxide': 1,
@ -219,7 +220,9 @@ def test():
t2 = LOT_DATA(**data) t2 = LOT_DATA(**data)
client.publish('demo', payload=json.dumps(data, ensure_ascii=False), qos=0) client.publish('demo', payload=json.dumps(data, ensure_ascii=False), qos=0)
add(t2) add(t2)
time.sleep(1) time.sleep(10)
except:
pass
def on_connect(client, userdata, flags, rc): def on_connect(client, userdata, flags, rc):