sprinkler

package module
v0.0.0-...-1877415 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

README

sprinkler

https://app.viam.com/module/erh/sprinkler

instructions

  • setup a raspberry pi with viam
  • connect relays to gpio pins, 1 relay per sprinker zone
  • add the board to your viam config
  • add the sprinkler as a component and a config like this
{
  "lat": "40.5",
  "long": "-73.5",
  "zones": {
    "z1-front-garden": {
      "minutes": 10,
      "pin": "io16"
    },
    "z2-front-lawn-near-house": {
      "minutes": 10,
      "pin": "io17"
    },
    "z3-front-lawn-middle": {
      "pin": "io18",
      "minutes": 20
    },
    "z4-house-south-side": {
      "minutes": 20,
      "pin": "io25"
    }
  },
  "board": "local",
  "start_hour": 1,
  "data_dir": "/root/sprinkler_data/",
  "max_time_slice_minutes": 15
}

Documentation

Index

Constants

View Source
const FlatCelsius = 22.0

returns 0 -> some number

Variables

View Source
var SprinklerModel = resource.ModelNamespace("erh").WithFamily("sprinkler").WithModel("sprinkler")

Functions

func RunServer

func RunServer(ctx context.Context, logger logging.Logger, bind string, sprinkler sensor.Sensor) error

Types

type DataAPI

type DataAPI interface {
	AmountWatered(z string, now time.Time) (time.Duration, error)

	// returns the total amount watered today
	AddWatered(z string, now time.Time, amountToMark time.Duration) (time.Duration, error)
}

func NewLocalJSONStore

func NewLocalJSONStore(root string) (DataAPI, error)

type ZoneConfig

type ZoneConfig struct {
	Pin      string
	Minutes  int
	Priority int
}

Directories

Path Synopsis
cmd
web

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL