File tree 1 file changed +16
-8
lines changed
1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ def read_status(self):
32
32
33
33
status_tree = self .broker_connect .last_message
34
34
35
- return print ( json . dumps ( status_tree , indent = 4 ))
35
+ return status_tree
36
36
37
37
def read_sensor (self , id ):
38
38
peripheral_str = self .api .get_info ('peripherals' , id )
@@ -56,12 +56,7 @@ def read_sensor(self, id):
56
56
}]
57
57
}
58
58
59
- self .broker_connect .publish (read_sensor_message )
60
- self .broker_connect .listen (5 , 'status' )
61
-
62
- sensor_data = self .broker_connect .last_message
63
-
64
- return print (sensor_data )
59
+ # return ...
65
60
66
61
def message (self , message , type = None , channel = None ):
67
62
message_message = {
@@ -311,7 +306,20 @@ def detect_weeds(self):
311
306
self .broker_connect .publish (detect_weeds_message )
312
307
# return ...
313
308
314
- # get_xyz() --> requires read_status() --> LUA
309
+ def get_xyz (self ):
310
+ tree_data = self .read_status ()
311
+
312
+ position = tree_data ["position" ]
313
+
314
+ x_val = position ['x' ]
315
+ y_val = position ['y' ]
316
+ z_val = position ['z' ]
317
+
318
+ return print (f'Garden size:\n '
319
+ f'\t x = { x_val :.2f} \n '
320
+ f'\t y = { y_val :.2f} \n '
321
+ f'\t z = { z_val :.2f} ' )
322
+
315
323
# check_position() --> requires read_status() --> LUA
316
324
317
325
def move (self , x , y , z ):
You can’t perform that action at this time.
0 commit comments