This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Started GET "/api/sync/" for 192.168.29.167 at 2016-11-28 13:06:32 -0800 | |
Processing by Api::SyncsController#show as HTML | |
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT ? [["email", "[email protected]"], ["LIMIT", 1]] | |
(0.1ms) begin transaction | |
SQL (0.2ms) UPDATE "users" SET "current_sign_in_at" = ?, "last_sign_in_at" = ?, "sign_in_count" = ?, "updated_at" = ? WHERE "users"."id" = ? [["current_sign_in_at", 2016-11-28 21:06:32 UTC], ["last_sign_in_at", 2016-11-28 21:06:06 UTC], ["sign_in_count", 4], ["updated_at", 2016-11-28 21:06:32 UTC], ["id", 3]] | |
(10.0ms) commit transaction | |
Device Load (0.1ms) SELECT "devices".* FROM "devices" WHERE "devices"."id" = ? LIMIT ? [["id", 3], ["LIMIT", 1]] | |
(0.1ms) SELECT "regimens"."id" FROM "regimens" WHERE "regimens"."device_id" = ? [["device_id", 3]] | |
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."device_id" = ? [["device_id", 3]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Started POST "/api/users/" for 127.0.0.1 at 2016-11-28 13:10:08 -0800 | |
Processing by Api::UsersController#create as HTML | |
Parameters: {"user"=>{"name"=>"connor", "email"=>"[email protected]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}} | |
(0.1ms) begin transaction | |
User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = ? LIMIT ? [["email", "[email protected]"], ["LIMIT", 1]] | |
SQL (0.1ms) INSERT INTO "users" ("name", "email", "encrypted_password", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?) [["name", "connor"], ["email", "[email protected]"], ["encrypted_password", "$2a$10$wD37nGdM6kAfCb/eGQrLnOErnbBCmzujVA2BeXMFAjaW1zQ6duuPC"], ["created_at", 2016-11-28 21:10:08 UTC], ["updated_at", 2016-11-28 21:10:08 UTC]] | |
(10.5ms) commit transaction | |
(0.1ms) begin transaction | |
Device Exists (0.1ms) SELECT 1 AS one FROM "devices" WHERE "devices"."name" = ? LIMIT ? [["name", "deflexed-sun-858"], ["LIMIT", 1]] | |
SQL (0.1ms) INSERT INTO "devices" ("name") VALUE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RAILS_ENV=development OS_UPDATE_SERVER=https://api.github.com/repos/farmbot/farmbot_os/releases/latest \ | |
FW_UPDATE_SERVER=https://api.github.com/repos/FarmBot/farmbot-arduino-firmware/releases/latest API_HOST=192.168.29.167 \ | |
API_PORT=3000 \ | |
MQTT_HOST=192.168.29.167 \ | |
rails s -b 0.0.0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iex(1)> h Farmbot.Sync.Database.Device.validate | |
def validate(map) | |
Makes sure an object can be built given keys: ["id", "planting_area_id", | |
"name", "webcam_url"] | |
• makes sure map is not empty | |
• makes sure we have atleast: ["id", "planting_area_id", "name", | |
"webcam_url"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defdatabase Database do | |
@moduledoc """ | |
The Database that holds all the objects found on the Farmbot Web Api | |
""" | |
generate Device, [:id, :planting_area_id, :name, :webcam_url] do | |
mutation :id do | |
IO.inspect before | |
{:ok, before} | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iex(1)> Farmbot.Sync.Database.Device.validate %{} | |
{:error, Farmbot.Sync.Database.Device, | |
{:missing_keys, ["id", "planting_area_id", "name", "webcam_url"]}} | |
iex(2)> Farmbot.Sync.Database.Device.validate %{} | |
{:error, Farmbot.Sync.Database.Device, | |
{:missing_keys, ["id", "planting_area_id", "name", "webcam_url"]}} | |
iex(3)> Farmbot.Sync.Database.Device.validate %{"id" => 1} | |
{:error, Farmbot.Sync.Database.Device, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
connor@connor-mini-pc:~/farmbot/os/os⟫ cat ./blah | |
Analysis failed with error: | |
{{badarg,none_in_mand}, | |
[{erl_types,t_map,3,[]}, | |
{erl_types,from_form,5,[]}, | |
{erl_types,type_from_form1,10,[]}, | |
{erl_types,from_form,5,[]}, | |
{erl_types,list_from_form,5,[]}, | |
{erl_types,from_form,5,[]}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule TimedThing do | |
def thing_that_could_take_a_while(pid) do | |
spawn fn() -> | |
0..10_000 | |
|> Enum.random | |
|> Process.sleep | |
send pid, :hey_im_done | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RVM | |
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting | |
# Farmbot | |
export IP_ADDR=192.168.29.167 | |
export API_HOST=$IP_ADDR | |
export API_PORT=3000 | |
export MQTT_HOST=$IP_ADDR | |
export RAILS_ENV=development | |
export OS_UPDATE_SERVER=https://api.github.com/repos/farmbot/farmbot_os/releases/latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface Coordinate { | |
kind: "coordinate"; | |
args: { | |
format: "step" | "mm"; | |
x: number; | |
y: number; | |
z: number; | |
}; | |
comment?: string | undefined; | |
body?: (undefined)[] | undefined; |