poolpi

package module
v0.0.0-...-7f35048 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

README

About

This is project to simulate a remote control for the Hayward Prologic pool "automation" system.

There is a similar better supported Python project here: https://github.com/swilson/aqualogic Also inspired by some excellent wire sleuthing: http://www.desert-home.com/p/swimming-pool.html

The basic components:

Wiring Diagram

RPi Pin #4 (5V)  -> UART VCC
RPi Pin #6 (GND) -> UART GND
RPi Pin #8 (TX)  -> UART TX
RPi Pin #10 (RX) -> UART RX

RS485 (A+)  -> Prologic Remote COMM Pin 2 (BLK)
RS485 (B-)  -> Prologic Remote COMM Pin 3 (YEL)
RS485 (GND) -> Prologic Remote COMM Pin 4 (GRN)

Rasberry Pi Setup

We just need the serial port enabled. This can be done by setting enable_uart=1 in /boot/config.txt and rebooting. If setup correctly you should see something like:

$ ls -l /dev/serial0
lrwxrwxrwx 1 root root 5 Mar 21 18:17 /dev/serial0 -> ttyS0

Disclaimer

This project is not affiliated with or endorsed by Hayward Industries Inc. in any way.

Documentation

Index

Constants

View Source
const (
	FrameDLE = 0x10 // "data link escape"
	FrameESC = 0x00 // escape
	FrameSTX = 0x02 // start
	FrameETX = 0x03 // end
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryFormat

type BinaryFormat string
const (
	FormatHex    BinaryFormat = "[% x]"
	FormatBinary BinaryFormat = "%08b"
)

type CRC

type CRC uint16

func ComputeCRC

func ComputeCRC(b []byte) CRC

func NewCRC

func NewCRC(b []byte) CRC

func (CRC) ToBytes

func (crc CRC) ToBytes() []byte

type Event

type Event struct {
	Type EventType
	Data []byte
}

func EventFromPB

func EventFromPB(e *pb.Event) Event

func NewEvent

func NewEvent(b []byte) Event

func (Event) Format

func (e Event) Format(f BinaryFormat) string

func (Event) Summary

func (e Event) Summary() string

func (Event) ToBytes

func (e Event) ToBytes() []byte

func (Event) ToPB

func (e Event) ToPB() *pb.Event

type EventType

type EventType uint16
const (
	EventReady       EventType = 0x0101
	EventLEDs        EventType = 0x0102
	EventMessage     EventType = 0x0103
	EventUpdate      EventType = 0x040a
	EventPumpRequest EventType = 0x0c01
	EventPumpStatus  EventType = 0x000c
	EventLocalKey    EventType = 0x0002 // key press on main console
	EventRemoteKey   EventType = 0x0003 // key press on wired remote
	EventWirelessKey EventType = 0x0083 // key press on wireless remote
)

func NewEventType

func NewEventType(b []byte) EventType

func (EventType) ToBytes

func (et EventType) ToBytes() []byte

type Key

type Key uint32
const (
	KeyNone    Key = 0x00000
	KeyRight   Key = 0x00001
	KeyMenu    Key = 0x00002
	KeyLeft    Key = 0x00004
	KeyService Key = 0x00008
	KeyMinus   Key = 0x00010
	KeyPlus    Key = 0x00020
	KeyPoolSpa Key = 0x00040
	KeyFilter  Key = 0x00080
	KeyLights  Key = 0x00100
	KeyAux1    Key = 0x00200
	KeyAux2    Key = 0x00400
	KeyAux3    Key = 0x00800
	KeyAux4    Key = 0x01000
	KeyAux5    Key = 0x02000
	KeyAux6    Key = 0x04000
	KeyAux7    Key = 0x08000
	KeyValve3  Key = 0x10000
	KeyValve4  Key = 0x20000
	KeyHeater  Key = 0x40000
)

func KeyFromPB

func KeyFromPB(key pb.Key) Key

func NewKey

func NewKey(b []byte) Key

func (Key) String

func (kt Key) String() string

func (Key) ToBytes

func (kt Key) ToBytes() []byte

func (Key) ToEvent

func (kt Key) ToEvent(t EventType) Event

func (Key) ToPB

func (kt Key) ToPB() pb.Key

type System

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

func NewSystem

func NewSystem(serialFile string) (*System, error)

func (*System) Close

func (s *System) Close() error

func (*System) Send

func (s *System) Send(e Event)

func (*System) Start

func (s *System) Start()

func (*System) Subscribe

func (s *System) Subscribe(f func(e Event)) (unsubscribe func())

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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