fancoil

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package fancoil communicates with a Heat Transfer Products (and presumably Chiltrix) fan coil unit.

The fan coil unit manual: https://htproducts.com/literature/lp-587.pdf

The Chiltrix and HTP fan coil units are manufactured by the same Chinese company. This package should work for any fan coil unit with a ZLFP10 circuit board; it will not work with the older MD1001 circuit board. HTP seems to ship units with both circuit boards, and according to one technical support representative the boards are not interchangable.

The modbus functionality is not officially supported by HTP. The documentation from the manual is incomplete but still useful.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GRPCServiceFromClient

func GRPCServiceFromClient(c *Client) pb.FanCoilServiceServer

GRPCServiceFromClient returns an implementation of FanCoilServiceServer using a *Client object.

Types

type Client

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

Client is used to communicate with the Chiltrix CX34 heat pump.

func Connect

func Connect(ctx context.Context, p *Params) (*Client, error)

Connect connects a new client to the heat pump or returns an error.

func (*Client) CheckConnection

func (c *Client) CheckConnection(ctx context.Context) error

CheckConnection attempts to connect to the heat pump and returns an error if the connection fails.

func (*Client) Close

func (c *Client) Close() error

Close closes the modbus connection and frees up resources associated with the client.

func (*Client) GetState

func (c *Client) GetState(_ context.Context, req *pb.GetStateRequest) (*pb.GetStateResponse, error)

GetState returns a snapshot of the state of a single fan coil unit.

type Mode

type Mode string

Mode indicates the protocol that should be used to communicate with the CX34.

type Params

type Params struct {
	// The /dev/ttyX device shown by dmesg for the RS-485 connection to the heat pump.
	TTYDevice string
	Mode      Mode
}

Params configures the connection to the Chiltrix.

type Register

type Register pb.RegisterName

Register is a modsbus register

func (Register) String

func (r Register) String() string

String returns a human-readable name of the modbus register.

type State

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

State is a snapshot of the heat pump's state.

func StateFromSnapshotProto

func StateFromSnapshotProto(collectionTime time.Time, msg *pb.RawRegisterSnapshot) (*State, error)

StateFromSnapshotProto converts a state proto into a State object.

func (*State) CollectionTime

func (s *State) CollectionTime() time.Time

CollectionTime returns the collection time of the heat pump state log entry.

func (*State) RegisterValues

func (s *State) RegisterValues() map[Register]uint16

RegisterValues returns a map of register values. The map should not be modified by the caller.

func (*State) Report

func (s *State) Report(omitZeros bool, interestingRegisters map[Register]bool) string

Report returns a human readable summary of the state of the heat pump.

func (*State) ResponseProto

func (s *State) ResponseProto() *pb.GetStateResponse

ResponseProto returns the protobuf form of state.

func (*State) String

func (s *State) String() string

String returns a human readable summary of the state of the heat pump.

Directories

Path Synopsis
cmd
fancoil_status
Program fancoil_status prints out the status of any connected fan coil.
Program fancoil_status prints out the status of any connected fan coil.

Jump to

Keyboard shortcuts

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