File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,17 @@ def get_serial():
36
36
return cpuserial
37
37
38
38
@cached (cache = TTLCache (maxsize = 1 , ttl = 10 ))
39
- def get_internet_status ():
40
- return subprocess .check_output (["./scripts/check_conn.sh" ]).decode ('utf-8' ).replace ('\n ' , '' )
39
+ def get_status ():
40
+ try :
41
+ temp = os .popen ("vcgencmd measure_temp" ).readline ().replace ("temp=" ,"" )
42
+ except :
43
+ temp = "undefined"
44
+
45
+ uptime = subprocess .check_output (["uptime" ]).decode ('utf-8' ).replace ('\n ' , '' )
46
+ internet_status = subprocess .check_output (["./scripts/check_conn.sh" ]).decode ('utf-8' ).replace ('\n ' , '' )
47
+ return {'internet_status' : internet_status ,
48
+ 'temp' : temp ,
49
+ 'uptime' : uptime }
41
50
42
51
@cached (cache = TTLCache (maxsize = 1 , ttl = 60 ))
43
52
def get_info ():
@@ -90,18 +99,16 @@ def turn(data):
90
99
bot .turn (speed = data ["speed" ], elapse = data ["elapse" ])
91
100
return 200
92
101
93
- # Bot status (STUB)
94
102
def status ():
95
- internet_status = get_internet_status ()
103
+ status = get_status ()
96
104
97
105
return {
98
106
"status" : "ok" ,
99
- "internetConnectivity" : internet_status ,
100
- "temp" : "40" ,
101
- "uptime" : "5h" ,
107
+ "internetConnectivity" : status [ " internet_status" ] ,
108
+ "temp" : status [ "temp" ] ,
109
+ "uptime" : status [ "uptime" ] ,
102
110
}
103
111
104
- # Hardware and software information (STUB)
105
112
def info ():
106
113
info = get_info ()
107
114
return {
You can’t perform that action at this time.
0 commit comments