client

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

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

Go to latest
Published: Feb 20, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

README

reef-pi/client

An http client library for reef-pi

GoDoc License

Example

  c, err := New("http://reef-pi.local")
  if err != nil {
    panic(err)
  }
  if err := c.SignIn("reef-pi","reef-pi"); err != nil {
    panic(err)
  }
  defer c.SignOut()
  outlets, err := c.Outlets()
  if err != nil {
    panic(err)
  }
  for _, outlet := range outlets {
     fmt.Println(outlet.Name)
  }

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StepTypes = []string{
	"wait",
	"subsystem",
	"macro",
	"equipment",
	"ato",
	"tc",
	"lighting",
	"ph",
	"doser",
	"timer",
}

Functions

This section is empty.

Types

type ATO

type ATO struct {
	ID             string        `json:"id"`
	Inlet          string        `json:"inlet"`
	Pump           string        `json:"pump"`
	Period         time.Duration `json:"period"`
	Control        bool          `json:"control"`
	Enable         bool          `json:"enable"`
	Notify         Notify        `json:"notify"`
	Name           string        `json:"name"`
	DisableOnAlert bool          `json:"disable_on_alert"`
}

type AdafruitIO

type AdafruitIO struct {
	Enable bool   `json:"enable"`
	Token  string `json:"token"`
	User   string `json:"user"`
	Prefix string `json:"prefix"`
}

type AnalogInput

type AnalogInput struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Pin    int    `json:"pin"`
	Driver string `json:"driver"`
}

type AutoConfig

type AutoConfig struct {
	Values []int `json:"values"` // 12 ticks after every 2 hours
}

type CalibrationDetails

type CalibrationDetails struct {
	Speed    float64 `json:"speed"`
	Duration float64 `json:"duration"`
}

type CameraConfig

type CameraConfig struct {
	Enable         bool          `json:"enable"`
	ImageDirectory string        `json:"image_directory"`
	CaptureFlags   string        `json:"capture_flags"`
	TickInterval   time.Duration `json:"tick_interval"`
	Upload         bool          `json:"upload"`
	Motion         MotionConfig  `json:"motion"`
}

type Capabilities

type Capabilities struct {
	DevMode       bool `json:"dev_mode"`
	Dashboard     bool `json:"dashboard"`
	HealthCheck   bool `json:"health_check"`
	Equipment     bool `json:"equipment"`
	Timers        bool `json:"timers"`
	Lighting      bool `json:"lighting"`
	Temperature   bool `json:"temperature"`
	ATO           bool `json:"ato"`
	Camera        bool `json:"camera"`
	Doser         bool `json:"doser"`
	Ph            bool `json:"ph"`
	Macro         bool `json:"macro"`
	Configuration bool `json:"configuration"`
}

type Channel

type Channel struct {
	Name     string  `json:"name"`
	Min      int     `json:"min"`
	StartMin int     `json:"start_min"`
	Max      int     `json:"max"`
	Reverse  bool    `json:"reverse"`
	Pin      int     `json:"pin"`
	Color    string  `json:"color"`
	Profile  Profile `json:"profile"`
}

type Chart

type Chart struct {
	Type string `json:"type"`
	ID   string `json:"id"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(u string) (*Client, error)

func (*Client) ATO

func (c *Client) ATO(id string) (ATO, error)

func (*Client) ATOUsage

func (c *Client) ATOUsage(id string) (StatsResponse, error)

func (*Client) ATOs

func (c *Client) ATOs() ([]ATO, error)

func (*Client) AnalogInput

func (c *Client) AnalogInput(id string) (AnalogInput, error)

func (*Client) AnalogInputs

func (c *Client) AnalogInputs() ([]AnalogInput, error)

func (*Client) CalibrateDoser

func (c *Client) CalibrateDoser(id string, cal CalibrationDetails) error

func (*Client) CalibratePhProbe

func (c *Client) CalibratePhProbe(id string, cal CalibrationDetails) error

func (*Client) CameraConfig

func (c *Client) CameraConfig() (CameraConfig, error)

func (*Client) Capabilities

func (c *Client) Capabilities() (Capabilities, error)

func (*Client) ClearErrors

func (c *Client) ClearErrors() error

func (*Client) ControlEquipment

func (c *Client) ControlEquipment(id string, on bool) error

func (*Client) ControlJack

func (c *Client) ControlJack(id string, p PinValues) error

func (*Client) CreateATO

func (c *Client) CreateATO(o ATO) error

func (*Client) CreateAnalogInput

func (c *Client) CreateAnalogInput(o AnalogInput) error

func (*Client) CreateDoser

func (c *Client) CreateDoser(o Pump) error

func (*Client) CreateDriver

func (c *Client) CreateDriver(o Driver) error

func (*Client) CreateEquipment

func (c *Client) CreateEquipment(o Equipment) error

func (*Client) CreateInlet

func (c *Client) CreateInlet(o Inlet) error

func (*Client) CreateJack

func (c *Client) CreateJack(o Jack) error

func (*Client) CreateLight

func (c *Client) CreateLight(o Light) error

func (*Client) CreateMacro

func (c *Client) CreateMacro(o Macro) error

func (*Client) CreateOutlet

func (c *Client) CreateOutlet(o Outlet) error

func (*Client) CreatePhProbe

func (c *Client) CreatePhProbe(o Probe) error

func (*Client) CreateTC

func (c *Client) CreateTC(o TC) error

func (*Client) CreateTimer

func (c *Client) CreateTimer(o Job) error

func (*Client) Dashboard

func (c *Client) Dashboard() (Dashboard, error)

func (*Client) DeleteATO

func (c *Client) DeleteATO(id string) error

func (*Client) DeleteAnalogInput

func (c *Client) DeleteAnalogInput(id string) error

func (*Client) DeleteDoser

func (c *Client) DeleteDoser(id string) error

func (*Client) DeleteDriver

func (c *Client) DeleteDriver(id string) error

func (*Client) DeleteEquipment

func (c *Client) DeleteEquipment(id string) error

func (*Client) DeleteError

func (c *Client) DeleteError(id string) error

func (*Client) DeleteInlet

func (c *Client) DeleteInlet(id string) error

func (*Client) DeleteJack

func (c *Client) DeleteJack(id string) error

func (*Client) DeleteLight

func (c *Client) DeleteLight(id string) error

func (*Client) DeleteMacro

func (c *Client) DeleteMacro(id string) error

func (*Client) DeleteOutlet

func (c *Client) DeleteOutlet(id string) error

func (*Client) DeletePhProbe

func (c *Client) DeletePhProbe(id string) error

func (*Client) DeleteTC

func (c *Client) DeleteTC(id string) error

func (*Client) DeleteTimer

func (c *Client) DeleteTimer(id string) error

func (*Client) Display

func (c *Client) Display() (DisplayState, error)

func (*Client) DisplayOff

func (c *Client) DisplayOff() error

func (*Client) DisplayOn

func (c *Client) DisplayOn() error

func (*Client) Doser

func (c *Client) Doser(id string) (Pump, error)

func (*Client) DoserUsage

func (c *Client) DoserUsage(id string) (StatsResponse, error)

func (*Client) Dosers

func (c *Client) Dosers() ([]Pump, error)

func (*Client) Driver

func (c *Client) Driver(id string) (Driver, error)

func (*Client) Drivers

func (c *Client) Drivers() ([]Driver, error)

func (*Client) Equipment

func (c *Client) Equipment(id string) (Equipment, error)

func (*Client) Error

func (c *Client) Error(id string) (Error, error)

func (*Client) Errors

func (c *Client) Errors() ([]Error, error)

func (*Client) HealthStats

func (c *Client) HealthStats() (StatsResponse, error)

func (*Client) Info

func (c *Client) Info() (Info, error)

func (*Client) Inlet

func (c *Client) Inlet(id string) (Inlet, error)

func (*Client) Inlets

func (c *Client) Inlets() ([]Inlet, error)

func (*Client) Jack

func (c *Client) Jack(id string) (Jack, error)

func (*Client) Jacks

func (c *Client) Jacks() ([]Jack, error)

func (*Client) LatestPhoto

func (c *Client) LatestPhoto() (map[string]string, error)

func (*Client) Light

func (c *Client) Light(id string) (Light, error)

func (*Client) Lights

func (c *Client) Lights() ([]Light, error)

func (*Client) ListEquipment

func (c *Client) ListEquipment() ([]Equipment, error)

func (*Client) ListPhotos

func (c *Client) ListPhotos() ([]ImageItem, error)

func (*Client) Macro

func (c *Client) Macro(id string) (Macro, error)

func (*Client) Macros

func (c *Client) Macros() ([]Macro, error)

func (*Client) Outlet

func (c *Client) Outlet(id string) (Outlet, error)

func (*Client) Outlets

func (c *Client) Outlets() ([]Outlet, error)

func (*Client) PhProbe

func (c *Client) PhProbe(id string) (Probe, error)

func (*Client) PhProbeReadings

func (c *Client) PhProbeReadings(id string) (StatsResponse, error)

func (*Client) PhProbes

func (c *Client) PhProbes() ([]Probe, error)

func (*Client) PowerOff

func (c *Client) PowerOff() error

func (*Client) ReadAnalogInput

func (c *Client) ReadAnalogInput(id string) (float64, error)

func (*Client) ReadInlet

func (c *Client) ReadInlet(id string) (int, error)

func (*Client) Reboot

func (c *Client) Reboot() error

func (*Client) Reload

func (c *Client) Reload() error

func (*Client) RunMacro

func (c *Client) RunMacro(id string) error

func (*Client) ScheduleDoser

func (c *Client) ScheduleDoser(id string, s DosingRegiment) error

func (*Client) SendTestMessage

func (c *Client) SendTestMessage() error

func (*Client) Settings

func (c *Client) Settings() (Settings, error)

func (*Client) SignIn

func (c *Client) SignIn(u, p string) error

func (*Client) SignOut

func (c *Client) SignOut() error

func (*Client) TC

func (c *Client) TC(id string) (TC, error)

func (*Client) TCUsage

func (c *Client) TCUsage(id string) (StatsResponse, error)

func (*Client) TCs

func (c *Client) TCs() ([]TC, error)

func (*Client) TakePhoto

func (c *Client) TakePhoto() error

func (*Client) Telemetry

func (c *Client) Telemetry() (TelemetryConfig, error)

func (*Client) TempSensors

func (c *Client) TempSensors() ([]string, error)

func (*Client) Timer

func (c *Client) Timer(id string) (Job, error)

func (*Client) Timers

func (c *Client) Timers() ([]Job, error)

func (*Client) UpdateATO

func (c *Client) UpdateATO(id string, o ATO) error

func (*Client) UpdateAnalogInput

func (c *Client) UpdateAnalogInput(id string, o AnalogInput) error

func (*Client) UpdateCameraConfig

func (c *Client) UpdateCameraConfig(conf CameraConfig) error

func (*Client) UpdateCredentials

func (c *Client) UpdateCredentials(cr Credentials) error

func (*Client) UpdateDashboard

func (c *Client) UpdateDashboard(ds Dashboard) error

func (*Client) UpdateDisplay

func (c *Client) UpdateDisplay(ds DisplayConfig) error

func (*Client) UpdateDoser

func (c *Client) UpdateDoser(id string, o Pump) error

func (*Client) UpdateDriver

func (c *Client) UpdateDriver(id string, o Driver) error

func (*Client) UpdateEquipment

func (c *Client) UpdateEquipment(id string, o Equipment) error

func (*Client) UpdateInlet

func (c *Client) UpdateInlet(id string, o Inlet) error

func (*Client) UpdateJack

func (c *Client) UpdateJack(id string, o Jack) error

func (*Client) UpdateLight

func (c *Client) UpdateLight(id string, o Light) error

func (*Client) UpdateMacro

func (c *Client) UpdateMacro(id string, o Macro) error

func (*Client) UpdateOutlet

func (c *Client) UpdateOutlet(id string, o Outlet) error

func (*Client) UpdatePhProbe

func (c *Client) UpdatePhProbe(id string, o Probe) error

func (*Client) UpdateSettings

func (c *Client) UpdateSettings(s Settings) error

func (*Client) UpdateTC

func (c *Client) UpdateTC(id string, o TC) error

func (*Client) UpdateTelemetry

func (c *Client) UpdateTelemetry(t TelemetryConfig) error

func (*Client) UpdateTimer

func (c *Client) UpdateTimer(id string, o Job) error

type Credentials

type Credentials struct {
	User     string `json:"user"`
	Password string `json:"password"`
}

type Dashboard

type Dashboard struct {
	Column      int       `json:"column"`
	Row         int       `json:"row"`
	Width       int       `json:"width"`
	Height      int       `json:"height"`
	GridDetails [][]Chart `json:"grid_details"`
}

type DisplayConfig

type DisplayConfig struct {
	Enable     bool `json:"enable"`
	Brightness int  `json:"brightness"`
}

type DisplayState

type DisplayState struct {
	On         bool `json:"on"`
	Brightness int  `json:"brightness"`
}

type DiurnalConfig

type DiurnalConfig struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

type DosingRegiment

type DosingRegiment struct {
	Enable   bool     `json:"enable"`
	Schedule Schedule `json:"schedule"`
	Duration float64  `json:"duration"`
	Speed    float64  `json:"speed"`
}

type Driver

type Driver struct {
	ID     string          `json:"id"`
	Name   string          `json:"name"`
	Type   string          `json:"type"`
	Config json.RawMessage `json:"config"`
}

type Equipment

type Equipment struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Outlet string `json:"outlet"`
	On     bool   `json:"on"`
}

type Error

type Error struct {
	Message string `json:"message"`
	Time    string `json:"time"`
	Count   int    `json:"count"`
	ID      string `json:"id"`
}

type FixedConfig

type FixedConfig struct {
	Value int `json:"value"`
}

type GenericStep

type GenericStep struct {
	ID string `json:"id"`
	On bool   `json:"on"`
}

type HealthCheckNotify

type HealthCheckNotify struct {
	Enable    bool    `json:"enable"`
	MaxMemory float64 `json:"max_memory"`
	MaxCPU    float64 `json:"max_cpu"`
}

type ImageItem

type ImageItem struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Info

type Info struct {
	Name           string `json:"name"`
	IP             string `json:"ip"`
	CurrentTime    string `json:"current_time"`
	Uptime         string `json:"uptime"`
	CPUTemperature string `json:"cpu_temperature"`
	Version        string `json:"version"`
}

type Inlet

type Inlet struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Pin       int    `json:"pin"`
	Equipment string `json:"equipment"`
	Reverse   bool   `json:"reverse"`
	Driver    string `json:"driver"`
}

type Jack

type Jack struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Pins   []int  `json:"pins"`
	Driver string `json:"driver"` // can be either hal or pca9685
}

type Job

type Job struct {
	ID        string          `json:"id"`
	Minute    string          `json:"minute"`
	Day       string          `json:"day"`
	Hour      string          `json:"hour"`
	Second    string          `json:"second"`
	Name      string          `json:"name"`
	Type      string          `json:"type"`
	Reminder  Reminder        `json:"reminder"`
	Equipment UpdateEquipment `json:"equipment"`
	Enable    bool            `json:"enable"`
}

type Light

type Light struct {
	ID       string          `json:"id"`
	Name     string          `json:"name"`
	Channels map[int]Channel `json:"channels"`
	Jack     string          `json:"jack"`
}

type Macro

type Macro struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Steps  []Step `json:"steps"`
	Enable bool   `json:"enable"`
}

type MailerConfig

type MailerConfig struct {
	Server   string `json:"server"`
	Port     int    `json:"port"`
	From     string `json:"from"`
	Password string `json:"password"`
	To       string `json:"to"`
}

type MotionConfig

type MotionConfig struct {
	Enable bool   `json:"enable"`
	URL    string `json:"url"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
}

type Notify

type Notify struct {
	Enable bool    `json:"enable"`
	Max    float64 `json:"max"`
	Min    float64 `json:"min"`
}

type Outlet

type Outlet struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Pin       int    `json:"pin"`
	Equipment string `json:"equipment"`
	Reverse   bool   `json:"reverse"`
	Driver    string `json:"driver"`
}

type PinValues

type PinValues map[int]float64

type Probe

type Probe struct {
	ID          string        `json:"id"`
	Name        string        `json:"name"`
	Enable      bool          `json:"enable"`
	Period      time.Duration `json:"period"`
	AnalogInput string        `json:"analog_input"`
	Control     bool          `json:"control"`
	Notify      Notify        `json:"notify"`
}

type Profile

type Profile struct {
	Type   string          `json:"type"`
	Config json.RawMessage `json:"config"`
}

type Pump

type Pump struct {
	ID       string         `json:"id"`
	Name     string         `json:"name"`
	Jack     string         `json:"jack"`
	Pin      int            `json:"pin"`
	Regiment DosingRegiment `json:"regiment"`
}

type Reminder

type Reminder struct {
	Title   string `json:"title"`
	Message string `json:"message"`
}

type Schedule

type Schedule struct {
	Day    string `json:"day"`
	Hour   string `json:"hour"`
	Minute string `json:"minute"`
	Second string `json:"second"`
}

type Settings

type Settings struct {
	Name         string            `json:"name"`
	Interface    string            `json:"interface"`
	Address      string            `json:"address"`
	Display      bool              `json:"display"`
	Notification bool              `json:"notification"`
	Capabilities Capabilities      `json:"capabilities"`
	HealthCheck  HealthCheckNotify `json:"health_check"`
	HTTPS        bool              `json:"https"`
	Pprof        bool              `json:"pprof"`
	RPI_PWMFreq  int               `json:"rpi_pwm_freq"`
}

type StatsResponse

type StatsResponse struct {
	Current    []interface{} `json:"current"`
	Historical []interface{} `json:"historical"`
}

type Step

type Step struct {
	Type   string          `json:"type"`
	Config json.RawMessage `json:"config"`
}

type TC

type TC struct {
	ID         string        `json:"id"`
	Name       string        `json:"name"`
	Max        float64       `json:"max"`
	Min        float64       `json:"min"`
	Heater     string        `json:"heater"`
	Cooler     string        `json:"cooler"`
	Period     time.Duration `json:"period"`
	Control    bool          `json:"control"`
	Enable     bool          `json:"enable"`
	Notify     Notify        `json:"notify"`
	Sensor     string        `json:"sensor"`
	Fahrenheit bool          `json:"fahrenheit"`
	ChartMin   float64       `json:"chart_min"`
	ChartMax   float64       `json:"chart_max"`
}

type TelemetryConfig

type TelemetryConfig struct {
	AdafruitIO      AdafruitIO   `json:"adafruitio"`
	Mailer          MailerConfig `json:"mailer"`
	Notify          bool         `json:"notify"`
	Throttle        int          `json:"throttle"`
	HistoricalLimit int          `json:"historical_limit"`
	CurrentLimit    int          `json:"current_limit"`
}

type UpdateEquipment

type UpdateEquipment struct {
	Revert   bool          `json:"revert"`
	ID       string        `json:"id"`
	On       bool          `json:"on"`
	Duration time.Duration `json:"duration"`
}

type WaitStep

type WaitStep struct {
	Duration time.Duration `json:"duration"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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