Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bot_commands.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export declare namespace Params {
}
}
/** Acceptable "method" names for JSON RPC messages to the bot. */
export declare type Method = "emergency_stop" | "exec_sequence" | "home_all" | "home_x" | "home_y" | "home_z" | "move_absolute" | "move_relative" | "write_pin" | "read_status" | "sync" | "update_calibration" | "status_update" | "check_updates" | "power_off" | "reboot";
export declare type Method = "emergency_stop" | "exec_sequence" | "home_all" | "home_x" | "home_y" | "home_z" | "move_absolute" | "move_relative" | "write_pin" | "read_status" | "sync" | "update_calibration" | "status_update" | "check_updates" | "check_arduino_updates" | "power_off" | "reboot";
/** A JSON RPC method invocation for one of the allowed FarmBot methods. */
export interface Request<T extends any[]> extends JSONRPC.Request<T> {
method: Method;
Expand Down Expand Up @@ -86,3 +86,6 @@ export interface RebootRequest extends Request<any> {
export interface CheckUpdatesRequest extends Request<any> {
method: "check_updates";
}
export interface CheckArduinoUpdatesRequest extends Request<any> {
method: "check_arduino_updates";
}
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

./clean.sh
tsc
tsc
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export declare class Farmbot {
powerOff(): FB.Thenable<{}>;
reboot(): FB.Thenable<{}>;
checkUpdates(): FB.Thenable<{}>;
checkArduinoUpdates(): FB.Thenable<{}>;
emergencyStop(): FB.Thenable<{}>;
execSequence(sequence: FB.Sequence): FB.Thenable<{}>;
homeAll(i: BotCommand.Params.Speed): FB.Thenable<{}>;
Expand Down
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ var Farmbot = (function () {
};
return this.send(p);
};
Farmbot.prototype.checkArduinoUpdates = function () {
var p = {
method: "check_arduino_updates",
params: [],
id: util_1.uuid()
};
return this.send(p);
};
Farmbot.prototype.emergencyStop = function () {
var p = {
method: "emergency_stop",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "farmbot",
"version": "2.0.1",
"version": "2.0.2",
"description": "Farmbot Javascript client.",
"scripts": {
"build": "./build.sh"
Expand All @@ -25,4 +25,4 @@
"url": "git+https://github.com/FarmBot/farmbot-js.git"
},
"keywords": ["farming", "agriculture", "iot", "arduino", "typescript"]
}
}
5 changes: 5 additions & 0 deletions src/bot_commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { HardwareState } from "./interfaces";
| "update_calibration"
| "status_update" // notification only.;
| "check_updates"
| "check_arduino_updates"
| "power_off"
| "reboot"

Expand Down Expand Up @@ -97,3 +98,7 @@ import { HardwareState } from "./interfaces";
export interface CheckUpdatesRequest extends Request<any> {
method: "check_updates";
}

export interface CheckArduinoUpdatesRequest extends Request<any> {
method: "check_arduino_updates";
}
9 changes: 9 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ export class Farmbot {
return this.send(p);
}

checkArduinoUpdates() {
let p: BotCommand.CheckArduinoUpdatesRequest = {
method: "check_arduino_updates",
params: [],
id: uuid()
};
return this.send(p);
}

emergencyStop() {
let p: BotCommand.EmergencyStopRequest = {
method: "emergency_stop",
Expand Down