automoli

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const ASCIIHeader = `` /* 1121-byte string literal not displayed */

Variables

View Source
var (
	AppName    = "AutoMoLi"
	AppIcon    = icons.LightOn
	AppVersion = "dev"
	CommitDate = "unknown"
	Commit     = "none"
)

Functions

func GenerateColorFromString

func GenerateColorFromString(seedPhrase string) lipgloss.Color

GenerateColorFromString generates a color based on the given seed.

Types

type AutoMoLi

type AutoMoLi struct {
	// Config holds the global configuration for AutoMoLi.
	*Config `mapstructure:",squash"`

	// Pr is the global (pretty) printer for AutoMoLi.
	Pr *log.Logger
	// contains filtered or unexported fields
}

func New

func New() *AutoMoLi

type Config

type Config struct {
	// DisabledBy is a map of entities that control the state of AutoMoLi
	// if any entity is in state 'off' - AutoMoLi will be treated as 'off' too (won't react to any events)
	DisabledBy map[homeassistant.EntityID][]string `mapstructure:"disabled_by,omitempty"`

	// StatsInterval is the interval in which the stats ticker will print the stats line
	StatsInterval time.Duration `mapstructure:"stats_interval,omitempty"`

	// LightConfiguration is the default light configuration for all rooms
	daytime.LightConfiguration `mapstructure:",squash"`
}

type Room

type Room struct {
	Name string `json:"name" mapstructure:"name"`

	// LightConfiguration is the default light configuration for this room
	daytime.LightConfiguration `mapstructure:",squash"`

	Lights []homeassistant.EntityID `json:"lights" mapstructure:"lights"`

	MotionSensors  []homeassistant.EntityID `json:"motion_sensors"             mapstructure:"motion_sensors"`
	MotionStateOn  string                   `json:"motion_state_on,omitempty"  mapstructure:"motion_state_on,omitempty"`
	MotionStateOff string                   `json:"motion_state_off,omitempty" mapstructure:"motion_state_off,omitempty"`

	// sensors & threshold for humidity check
	HumiditySensors   []homeassistant.EntityID `json:"humidity_sensors,omitempty"   mapstructure:"humidity_sensors,omitempty"`
	HumidityThreshold *uint8                   `json:"humidity_threshold,omitempty" mapstructure:"humidity_threshold,omitempty"`

	// daytimes
	Daytimes []*daytime.Daytime `json:"daytimes" mapstructure:"daytimes"`

	EventsChannel chan *homeassistant.EventMsg

	TriggerEvents mapset.Set[homeassistant.EventType]

	// mutex to prevent concurrent access to the room
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Room) FmtShort

func (r *Room) FmtShort() string

func (*Room) FmtString

func (r *Room) FmtString() string

func (*Room) FormatDaytimeConfiguration

func (r *Room) FormatDaytimeConfiguration(daytime *daytime.Daytime) string

func (*Room) GetActiveDaytime

func (r *Room) GetActiveDaytime() *daytime.Daytime

func (*Room) GetActiveDelay

func (r *Room) GetActiveDelay() time.Duration

func (*Room) GetFmtRoomConfig

func (r *Room) GetFmtRoomConfig() string

func (*Room) IsHumidityAboveThreshold

func (r *Room) IsHumidityAboveThreshold() bool

IsHumidityAboveThreshold checks if any humidity sensor in the room is above the threshold.

func (*Room) String

func (r *Room) String() string

Jump to

Keyboard shortcuts

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