garage

package
v0.0.0-...-c0c0658 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2017 License: MIT Imports: 15 Imported by: 0

README

Garage

This thing is really simple - connect a pot's wiper to A0, and some sort of relay to 13, and this can control something like a retarded servo. It even comes with a nice help file.

License

The MIT License (MIT)

Copyright (c) 2016-2017 Nick Potts

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Todo:

  • Wire this into my garage and take photos

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Daemon

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

Daemon monitors the garage door, and stabs mice that run around

func NewDaemon

func NewDaemon(closeAfter, closeBefore, device string, baud, webport int) *Daemon

NewDaemon returns an intialized daemon instance, or panics

func (*Daemon) Run

func (d *Daemon) Run() error

Run starts the server

type Parser

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

Parser wraps around the arduino and provides a simple way to get status and perform limited control on a garage door opener

func NewParser

func NewParser(ctx context.Context, dial string) (*Parser, error)

NewParser returns a new parsers after openening the agnoio

func (*Parser) Button

func (p *Parser) Button(w http.ResponseWriter, r *http.Request)

Button punches the button

func (*Parser) CloseDoor

func (p *Parser) CloseDoor(w http.ResponseWriter, r *http.Request)

CloseDoor closes the door

func (*Parser) Next

func (p *Parser) Next() (rtn *Status)

Next polls the device for another status message

func (*Parser) OpenDoor

func (p *Parser) OpenDoor(w http.ResponseWriter, r *http.Request)

OpenDoor Opens the doore

func (*Parser) Recal

func (p *Parser) Recal(w http.ResponseWriter, r *http.Request)

Recal issues a recal

func (*Parser) Start

func (p *Parser) Start()

Start initializes the background sampling routine

func (*Parser) Status

func (p *Parser) Status(w http.ResponseWriter, r *http.Request)

Status polls for the next status message and returns the JSON equivalent of it

type Status

type Status struct {
	Millis      uint64 `json:"millis"`       //64 bits
	Pos         uint64 `json:"pos"`          //16 bits
	FloorADC    uint64 `json:"floor_adc"`    //16bits
	CeilingADC  uint64 `json:"ceiling_adc"`  //16bits
	PercentOpen uint64 `json:"percent_open"` //8bits
	Closed      bool   `json:"closed"`
	FullyOpen   bool   `json:"fully_open"`
}

Status is the message the garage door emits

func (*Status) Parse

func (s *Status) Parse(parsed []string) (err error)

Parse takes a split list of string slices for values

func (*Status) ParseRaw

func (s *Status) ParseRaw(raw []byte) error

ParseRaw parses some raw bytes for a valid status message

func (*Status) ParseString

func (s *Status) ParseString(parseString string) error

ParseString parses the passed string for status bits

func (Status) String

func (s Status) String() string

String conforms to the Stringer interface

Jump to

Keyboard shortcuts

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