You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-2Lines changed: 28 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,6 +84,32 @@ bot.set_verbosity(2)
84
84
|`1` The name of the function will be output. |`e_stop called`|
85
85
|`2` The name of the function will be output with additional information about the return value. |`Triggered device emergency stop at: 2024-08-21 11:16:18.547813`|
86
86
87
+
### Test 1: Add a new plant to your garden
88
+
89
+
This test will help familiarize you with sending commands via the [API](https://developer.farm.bot/docs/rest-api).
90
+
```
91
+
new_cabbage = {
92
+
"name": "Cabbage", # Point name
93
+
"pointer_type": "Plant", # Point type
94
+
"x": 400, # x-coordinate
95
+
"y": 300, # y-coordinate
96
+
"z": 0, # z-coordinate
97
+
"openfarm_slug": "cabbage", # Plant type
98
+
"plant_stage": "planned", # Point status
99
+
}
100
+
101
+
bot.add_info("points", new_cabbage) # Add plant to endpoint
102
+
```
103
+
104
+
### Test 2: Turn your LED strip on and off
105
+
106
+
This test will help familiarize you with sending commands via the [Message Broker](https://developer.farm.bot/docs/message-broker).
107
+
```
108
+
bot.on(7) # Turn ON pin 7 (LED strip)
109
+
bot.wait(2000) # Wait 2000 milliseconds
110
+
bot.off(7) # Turn OFF pin 7 (LED strip)
111
+
```
112
+
87
113
## :compass: Functions
88
114
89
115
```
@@ -159,7 +185,7 @@ sidecar-starter-pack/
159
185
> Making requests other than `GET` to the API will permanently alter the data in your account. `DELETE` and `POST` requests may destroy data that cannot be recovered. Altering data through the API may cause account instability.
160
186
161
187
> [!NOTE]
162
-
> Not sure which endpoint to access? [Find the list here](https://developer.farm.bot/v15/docs/web-app/api-docs).
188
+
> Not sure which endpoint to access? [Find the list here](https://developer.farm.bot/docs/api-docs).
163
189
164
190
| class `Information()`| Description |
165
191
| :--- | :--- |
@@ -239,7 +265,7 @@ sidecar-starter-pack/
239
265
### Formatting message broker messages
240
266
241
267
> [!NOTE]
242
-
> Messages sent via the message broker contain [CeleryScript nodes](https://developer.farm.bot/v15/docs/celery-script/nodes.html) which require special formatting.
268
+
> Messages sent via the message broker contain [CeleryScript nodes](https://developer.farm.bot/docs/celery-script/nodes.html) which require special formatting.
"""Ensure the token persists throughout sidecar."""
51
53
52
54
ifself.state.tokenisNone:
53
-
print("ERROR: You have no token, please call `get_token` using your login credentials and the server you wish to connect to.")
55
+
self.state.print_status("check_token()", description="ERROR: You have no token, please call `get_token` using your login credentials and the server you wish to connect to.")
54
56
sys.exit(1)
55
57
56
58
return
57
59
58
60
defrequest_handling(self, response):
59
61
"""Handle errors associated with different endpoint errors."""
62
+
60
63
error_messages= {
61
64
404: "The specified endpoint does not exist.",
62
65
400: "The specified ID is invalid or you do not have access to it.",
0 commit comments