Compare commits
No commits in common. "e6db913a206bb16a6d873933b1c80fb655eeabd8" and "fa3363e47861642cb2c37a4f980b6afc9f768471" have entirely different histories.
e6db913a20
...
fa3363e478
|
@ -1 +0,0 @@
|
|||
.idea
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8" />
|
||||
</project>
|
|
@ -18,6 +18,13 @@
|
|||
</value>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<option name="ignoredErrors">
|
||||
<list>
|
||||
<option value="N801" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="ReassignedToPlainText" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ShellCheck" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<shellcheck_settings value="SC2239" />
|
||||
|
|
|
@ -5,8 +5,4 @@
|
|||
<orderEntry type="jdk" jdkName="chatchat" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="PyDocumentationSettings">
|
||||
<option name="format" value="PLAIN" />
|
||||
<option name="myDocStringFormat" value="Plain" />
|
||||
</component>
|
||||
</module>
|
|
@ -2,7 +2,7 @@
|
|||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/data_manager.iml" filepath="$PROJECT_DIR$/.idea/data_manager.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/lot_manager2.iml" filepath="$PROJECT_DIR$/.idea/lot_manager2.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
33
ceshi.py
33
ceshi.py
|
@ -208,8 +208,8 @@ def run_with_client(client):
|
|||
t = LOT_DATA(**data)
|
||||
# TODO 判断数据是否正常
|
||||
# 发送给服务器
|
||||
client.publish('lot_data', payload=json.dumps(data, ensure_ascii=False), qos=0)
|
||||
r = add(t)
|
||||
client.publish('demo', payload=json.dumps(data, ensure_ascii=False), qos=0)
|
||||
add(t)
|
||||
|
||||
|
||||
def run_no_client():
|
||||
|
@ -394,7 +394,7 @@ class UPLOAD:
|
|||
def on_connect(self, client, userdata, flags, rc):
|
||||
from threading import Thread
|
||||
if rc == 0:
|
||||
print("连接成功,执行数据推送和本地存储")
|
||||
# print("连接成功,执行数据推送和本地存储")
|
||||
nt1 = Thread(target=self.t1)
|
||||
nt1.start()
|
||||
else:
|
||||
|
@ -402,33 +402,12 @@ class UPLOAD:
|
|||
self.times -= 1
|
||||
client.reconnect()
|
||||
else:
|
||||
print("3次失败,执行本地存储")
|
||||
# print("3次失败,执行本地存储")
|
||||
nt2 = Thread(target=self.t2)
|
||||
nt2.start()
|
||||
|
||||
def t2(self):
|
||||
print("1")
|
||||
run_no_client()
|
||||
|
||||
def t1(self):
|
||||
import time
|
||||
while (1):
|
||||
time.sleep(60)
|
||||
data = {
|
||||
"wind_speed": 1,
|
||||
"wind_direction": 6,
|
||||
"ambient_temperature": 66,
|
||||
"ambient_humidity": 78,
|
||||
"carbon_dioxide": 94,
|
||||
"ambient_air_pressure": 48,
|
||||
"rainfall": 3,
|
||||
"ambient_lighting": 59,
|
||||
"soil_temperature": 71,
|
||||
"soil_moisture": 19,
|
||||
"soil_conductivity": 62,
|
||||
"soil_PH": 49,
|
||||
"soil_potassium_phosphate_nitrogen": 5,
|
||||
"soil_potassium_phosphate_phosphorus": 5,
|
||||
"soil_potassium_phosphate_potassium": 86,
|
||||
"create_time": int(time.time())
|
||||
}
|
||||
self.client.publish('demo', payload=json.dumps(data, ensure_ascii=False), qos=0)
|
||||
run_with_client(self.client)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[program:data_upload]
|
||||
directory=/home/lihai/PycharmProjects/pythonProject/lot_manager
|
||||
command=/home/lihai/anaconda3/envs/chatchat/bin/python ceshi.py
|
||||
user=lihai
|
||||
directory=/home/pi/lot_manager
|
||||
command=/usr/bin/python ceshi.py
|
||||
user=pi
|
||||
;是否随开机自启 或者reload自启动
|
||||
autostart=true
|
||||
;失败重启
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[program:push_stream]
|
||||
directory=/home/lihai/PycharmProjects/pythonProject/lot_manager
|
||||
command=/usr/bin/ffmpeg -rtsp_transport tcp -re -i rtsp://admin:123456@192.168.0.123:554/mpeg4 -c:v copy -c:a aac -preset ultrafast -r 20 -flvflags no_duration_filesize -f rtsp -rtsp_transport tcp rstp://127.0.0.1:554/live/test
|
||||
user=lihai
|
||||
directory=/home/pi/lot_manager
|
||||
command=/usr/bin/ffmpeg -rtsp_transport tcp -re -i rtsp://admin:123456@192.168.0.226:554/mpeg4 -c:v copy -c:a aac -preset ultrafast -r 20 -flvflags no_duration_filesize -f rtsp -rtsp_transport tcp rstp://192.168.1.27:554/live/test
|
||||
user=pi
|
||||
autostart=false
|
||||
autorestart=true
|
||||
redirect_stderr=true
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[program:test]
|
||||
directory=/home/lihai/PycharmProjects/pythonProject/lot_manager
|
||||
command=/home/lihai/anaconda3/envs/chatchat/bin/python test.py
|
||||
user=lihai
|
||||
directory=/home/pi/lot_manager
|
||||
command=/usr/bin/python test.py
|
||||
user=pi
|
||||
;是否随开机自启 或者reload自启动
|
||||
autostart=false
|
||||
;失败重启
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue