Documentation
¶
Index ¶
- type Controller
- func (controller *Controller) AddEventHandler(handler EventHandler)
- func (controller *Controller) AddZone(zone *Zone)
- func (controller *Controller) ClearOverride()
- func (controller *Controller) HandleEvents()
- func (controller *Controller) Run() error
- func (controller *Controller) SetHeaterState()
- func (controller *Controller) SetOverride(override bool)
- type Event
- type EventHandler
- type Heat
- type MQTTEventHandler
- type Zone
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct { Running bool `json:"running"` Heat `json:"heat"` Zones map[string]*Zone `json:"zones"` Events chan Event `json:"-"` EventHandlers []EventHandler `json:"-"` // contains filtered or unexported fields }
Controller represents a fan in thermostat controller for multiple zones.
func NewController ¶
func NewController(pin uint32) *Controller
NewController returns an initialized controller on the supplied pin.
func (*Controller) AddEventHandler ¶
func (controller *Controller) AddEventHandler(handler EventHandler)
AddEventHandler adds an event handler to the controllers list.
func (*Controller) AddZone ¶
func (controller *Controller) AddZone(zone *Zone)
AddZone adds a zone and starts running it.
func (*Controller) ClearOverride ¶
func (controller *Controller) ClearOverride()
ClearOverride clears an existing override if one exists.
func (*Controller) HandleEvents ¶
func (controller *Controller) HandleEvents()
HandleEvents is a blocking function that pulls events off the event handler channel and pushes them to the various event handlers.
func (*Controller) Run ¶
func (controller *Controller) Run() error
Run starts the controller running and listening for zone changes.
func (*Controller) SetHeaterState ¶
func (controller *Controller) SetHeaterState()
SetHeaterState will adjust the heater pin to the correct high / low value.
func (*Controller) SetOverride ¶
func (controller *Controller) SetOverride(override bool)
SetOverride allows a controller wide override of the target state.
type EventHandler ¶
EventHandler defines an interface for handling events.
type Heat ¶
type Heat struct { Override *bool `json:"override"` Active bool `json:"active"` Pin uint32 `json:"pin"` // contains filtered or unexported fields }
Heat represents the current heat state.
type MQTTEventHandler ¶
type MQTTEventHandler struct { mqtt.Client EntityName string }
func NewMQTTEventHandler ¶
func NewMQTTEventHandler(name string, client mqtt.Client) *MQTTEventHandler
func (*MQTTEventHandler) Name ¶
func (handler *MQTTEventHandler) Name() string
func (*MQTTEventHandler) Push ¶
func (handler *MQTTEventHandler) Push(event Event) error
type Zone ¶
type Zone struct { Name string `json:"name"` Active bool `json:"active"` Reading bool `json:"reading"` Override *bool `json:"override"` CallForHeatPin uint32 `json:"call_for_heat_pin"` DamperOnPin uint32 `json:"damper_on_pin"` DamperOffPin uint32 `json:"damper_off_pin"` Interval time.Duration `json:"-"` // contains filtered or unexported fields }
Zone represents a single zone that can optionally be turned on or off.
func (*Zone) ClearOverride ¶
func (zone *Zone) ClearOverride()
ClearOverride clears any override on the zone.
func (*Zone) SetOverride ¶
SetOverride applies an override to the zone.
func (*Zone) UpdateDamperPins ¶
func (zone *Zone) UpdateDamperPins()
UpdateDamperPins ensure the damper pins represent the current active state.