{"id":25382580,"url":"https://github.com/deezone/hydrobytes-basestation","last_synced_at":"2026-04-29T17:06:36.959Z","repository":{"id":54732374,"uuid":"294852495","full_name":"deezone/HydroBytes-BaseStation","owner":"deezone","description":"A wifi private network access point for an automated garden. The server coordinates the connected systems to provide a managed solution that is traditionally a labour intensive process.","archived":false,"fork":false,"pushed_at":"2021-02-02T04:27:12.000Z","size":12202,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T13:17:58.145Z","etag":null,"topics":["access-point","arduino","fitlet","garden","golang","microcontroller","server"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deezone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-12T02:16:21.000Z","updated_at":"2024-10-10T08:43:56.000Z","dependencies_parsed_at":"2022-08-14T01:10:20.413Z","dependency_job_id":null,"html_url":"https://github.com/deezone/HydroBytes-BaseStation","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deezone%2FHydroBytes-BaseStation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deezone%2FHydroBytes-BaseStation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deezone%2FHydroBytes-BaseStation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deezone%2FHydroBytes-BaseStation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deezone","download_url":"https://codeload.github.com/deezone/HydroBytes-BaseStation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248045270,"owners_count":21038557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["access-point","arduino","fitlet","garden","golang","microcontroller","server"],"created_at":"2025-02-15T07:28:48.372Z","updated_at":"2026-04-29T17:06:31.919Z","avatar_url":"https://github.com/deezone.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HydroBytes-BaseStation\nThe Base Station is a part of a collection of systems called\n\"[HydroBytes](https://github.com/deezone/HydroBytes)\" that uses micro\ncontrollers to manage and monitor plant health in an automated garden.\n\n## Introduction\n\nThe \"garden\" is simply a backyard patio in Brooklyn, New York. Typically\nthere are only two seasons - cold and hot in New York City. By\nautomating an urban garden ideally the space will thrive with minimum\nsupervision. The amount of effort to automate is besides the point, everyone needs their vices.\n\n- **[Water Station](https://github.com/deezone/HydroBytes-WaterStation)**\n- **Base Station**\n- **[Plant Station](https://github.com/deezone/HydroBytes-PlantStation)**\n\n![brooklyn-20201115 garden layout](https://raw.githubusercontent.com/deezone/HydroBytes/master/resources/gardenBrooklynDiagram-20201115.jpg)\n\n![Garden](https://github.com/deezone/HydroBytes-WaterManagement/blob/master/resources/garden-01.png)\n\n### YouTube Channel\n\n[![YouTube Channel](https://github.com/deezone/HydroBytes-WaterStation/blob/master/resources/youTube-TN.png?raw=true)](https://www.youtube.com/channel/UC00A_lEJD2Hcy9bw6UuoUBA \"All of the HydroBytes videos\")\n\n### Notes\n\nDevelopment of a Go based API is based on instruction in the amazing\ncourses at **[Ardan Labs](https://education.ardanlabs.com/collections?category=courses)**.\n\n#### Starting Web Server\n```\n\u003e go run ./cmd/api\nSTATIONS API : 2021/01/30 23:34:33.625072 main.go:103: main : Started\nSTATIONS API : 2021/01/30 23:34:33.625255 main.go:110: main : Config :\n--web-address=localhost:8000\n--web-debug=localhost:6060\n--web-read-timeout=5s\n--web-write-timeout=5s\n--web-shutdown-timeout=5s\n--db-user=postgres\n--db-host=localhost\n--db-name=postgres\n--db-disable-tls=true\n--auth-key-id=1\n--auth-private-key-file=private.pem\n--auth-algorithm=RS256\n--trace-url=http://localhost:9411/api/v2/spans\n--trace-service=station-api\n--trace-probability=1\nSTATIONS API : 2021/01/30 23:34:33.628227 main.go:198: main : API listening on localhost:8000\nSTATIONS API : 2021/01/30 23:34:33.628284 main.go:163: debug service listening on localhost:6060\n\n^C\nSTATIONS API : 2021/01/30 23:35:18.575270 main.go:222: main : Start shutdown\nSTATIONS API : 2021/01/30 23:35:18.575380 main.go:245: main : Completed\n```\n\n- supported requests to `localhost:8000`:\n  - `GET /v1/account/token`\n  - `GET  /v1/station-types`\n  - `GET  /v1/station-type/{id}`\n  - `POST /v1/station-type`\n  - `DELETE /v1/station-type/{id}`\n  - `GET  /v1/station-type/{station-type-id}/stations`\n  - `POST /v1/station-type/{station-type-id}/station`\n  - `DELETE /v1/station/{id}`\n  - `GET /v1/health`\n\n- Debugging requests to `http://localhost:6060/debug/pprof/`\n\n#### Admin tools\n\n```\n\u003e go run ./cmd/admin -h migrate\nUsage: admin [options] [arguments]\n\nOPTIONS\n  --web-address/$STATIONS_WEB_ADDRESS                      \u003cstring\u003e    (default: localhost:8000)\n  --web-debug/$STATIONS_WEB_DEBUG                          \u003cstring\u003e    (default: localhost:6060)\n  --web-read-timeout/$STATIONS_WEB_READ_TIMEOUT            \u003cduration\u003e  (default: 5s)\n  --web-write-timeout/$STATIONS_WEB_WRITE_TIMEOUT          \u003cduration\u003e  (default: 5s)\n  --web-shutdown-timeout/$STATIONS_WEB_SHUTDOWN_TIMEOUT    \u003cduration\u003e  (default: 5s)\n  --db-user/$STATIONS_DB_USER                              \u003cstring\u003e    (default: postgres)\n  --db-password/$STATIONS_DB_PASSWORD                      \u003cstring\u003e    (noprint,default: postgres)\n  --db-host/$STATIONS_DB_HOST                              \u003cstring\u003e    (default: localhost)\n  --db-name/$STATIONS_DB_NAME                              \u003cstring\u003e    (default: postgres)\n  --db-disable-tls/$STATIONS_DB_DISABLE_TLS                \u003cbool\u003e      (default: false)\n  --auth-key-id/$STATIONS_AUTH_KEY_ID                      \u003cstring\u003e    (default: 1)\n  --auth-private-key-file/$STATIONS_AUTH_PRIVATE_KEY_FILE  \u003cstring\u003e    (default: private.pem)\n  --auth-algorithm/$STATIONS_AUTH_ALGORITHM                \u003cstring\u003e    (default: RS256)\n  --trace-url/$STATIONS_TRACE_URL                          \u003cstring\u003e    (default: http://localhost:9411/api/v2/spans)\n  --trace-service/$STATIONS_TRACE_SERVICE                  \u003cstring\u003e    (default: station-api)\n  --trace-probability/$STATIONS_TRACE_PROBABILITY          \u003cfloat\u003e     (default: 1)\n  --help/-h\n  display this help message\n```\n- `adminAdd` to create a new admin account from CLI\n```\n\u003e go run ./cmd/admin adminAdd Test2Admin supersecret\nAdmin account will be created with password \"supersecret\"\nContinue? (1/0) 1\nAccount created with id: bd86e286-b1fc-415b-8f80-c30dcdac10bb\n```\n\n- `keygen`\n```\n\u003e go run ./cmd/admin keygen private.pem\n\u003e cat private.pem\n-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAsdRBS6Cspo6uXKUetnEMifL7xM8pz0pSz7gDhEb/OH6eT8oO\nyXpZlMvCOpXvnHCBZwa2C1zmYCW1v0nEFxyGYCFsMbmU09+7cz4qah5q9n6bTixB\n...\nZz1gJz/yNc4n38M7SILauHLWmNBhoisb2axc1VX4X8D/oAwb+vDFlhR2QIAqTQ7N\nIkyxx1arCSpoDd1M48SS1+xkgaDqEZuEA+COyKUyZf41PtXL6MA73Q==\n-----END RSA PRIVATE KEY-----\n```\n\n- `migrate` to update database with schema defined in code.\n```\n\u003e go run ./cmd/admin migrate\nMigrations complete\n```\n\n- `seed` populate the database tables with seed data for testing and development.\n```\n\u003e go run ./cmd/admin seed\nSeeding complete\n```\n\n#### Tests\n\n- **Unit Tests**\n\n**station_type** and **station**\n```\n\u003e go test ./internal/station_type\nok  \tgithub.com/deezone/HydroBytes-BaseStation/internal/station_type\t13.515s\n```\n\nNOTE: test coverage reports:\n```\nalias gotwc='go test -coverprofile=coverage.out \u0026\u0026 go tool cover -html=coverage.out \u0026\u0026 rm coverage.out'\n```\n\n- **Functional tests**\n```\n# bust test cache\n\u003e go clean -testcache\n\n\u003e go test ./cmd/api/tests/station_tests\nok  \tgithub.com/deezone/HydroBytes-BaseStation/cmd/api/tests/station_tests\t3.248s\n\n\u003e go test ./cmd/api/tests/station_type_tests\nok  \tgithub.com/deezone/HydroBytes-BaseStation/cmd/api/tests/station_type_tests\t2.875s\n\n\u003e  go test ./cmd/api/tests/account_tests\nok  \tgithub.com/deezone/HydroBytes-BaseStation/cmd/api/tests/account_tests\t4.372s\n```\n\n#### Tracing\n- http://localhost:9411/zipkin/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeezone%2Fhydrobytes-basestation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeezone%2Fhydrobytes-basestation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeezone%2Fhydrobytes-basestation/lists"}