poller

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IsHome added in v0.14.2

type IsHome bool

func (IsHome) String added in v0.14.2

func (i IsHome) String() string

type MobileDevices

type MobileDevices map[int]tado.MobileDevice

func (MobileDevices) LogValue

func (m MobileDevices) LogValue() slog.Value

type Poller

type Poller interface {
	Subscribe() chan Update
	Unsubscribe(ch chan Update)
	Refresh()
}

type TadoGetter

type TadoGetter interface {
	GetWeatherInfo(context.Context) (tado.WeatherInfo, error)
	GetMobileDevices(context.Context) ([]tado.MobileDevice, error)
	GetZones(context.Context) (tado.Zones, error)
	GetZoneInfo(context.Context, int) (tado.ZoneInfo, error)
	GetHomeState(ctx context.Context) (homeState tado.HomeState, err error)
}

type TadoPoller

type TadoPoller struct {
	TadoClient TadoGetter
	*pubsub.Publisher[Update]
	// contains filtered or unexported fields
}

func New

func New(tadoClient TadoGetter, interval time.Duration, logger *slog.Logger) *TadoPoller

func (*TadoPoller) Refresh

func (p *TadoPoller) Refresh()

func (*TadoPoller) Run

func (p *TadoPoller) Run(ctx context.Context) error

type Update

type Update struct {
	WeatherInfo tado.WeatherInfo
	Zones       map[int]tado.Zone
	ZoneInfo    map[int]tado.ZoneInfo
	UserInfo    MobileDevices
	Home        IsHome
}

func (Update) GetDeviceStatus added in v0.15.0

func (update Update) GetDeviceStatus(ids ...int) ([]string, []string)

func (Update) GetUserID

func (update Update) GetUserID(name string) (int, bool)

func (Update) GetZoneID

func (update Update) GetZoneID(name string) (int, bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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