dashboard

package
v0.0.0-...-62a7819 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchoolCafeEntree    = "ENTREE"
	SchoolCafeDaily     = "DAILY OFFERINGS"
	SchoolCafeGrain     = "GRAIN"
	SchoolCafeVegetable = "VEGETABLE"
	SchoolCafeFruit     = "FRUIT"
	SchoolCafeMilk      = "MILK"
)
View Source
const (
	SchoolCafeMealTypeLunch = "Lunch"
)

Variables

This section is empty.

Functions

func ToggleLock

func ToggleLock(config Config, key string) (err error)

Types

type Calendar

type Calendar struct {
	Title  string          `json:"title"`
	Key    string          `json:"key"`
	Events []CalendarEvent `json:"events"`
}

func GetCalendars

func GetCalendars(config Config) (calendars []Calendar, err error)

type CalendarConfig

type CalendarConfig struct {
	Title   string `toml:"title"`
	Key     string `toml:"key"`
	Outlook int    `toml:"outlook"`
}

type CalendarEntry

type CalendarEntry struct {
	Summary     string
	Description string
	Location    string
	Start       struct {
		Date     string
		DateTime string
	}
	End struct {
		Date     string
		DateTime string
	}
}

func (CalendarEntry) GetEnd

func (entry CalendarEntry) GetEnd(loc *time.Location) (t time.Time)

func (CalendarEntry) GetStart

func (entry CalendarEntry) GetStart(loc *time.Location) (t time.Time)

type CalendarEvent

type CalendarEvent struct {
	Summary     string    `json:"summary"`
	Description string    `json:"description"`
	Location    string    `json:"location"`
	Start       time.Time `json:"start"`
	End         time.Time `json:"end"`
	PrettyDate  string    `json:"pretty_date"`
	PrettyTime  string    `json:"pretty_time"`
}

type Config

type Config struct {
	Global        GlobalConfig        `toml:"global"`
	HomeAssistant HomeAssistantConfig `toml:"home-assistant"`
	SchoolBus     SchoolBusConfig     `toml:"school-bus"`
	SchoolLunch   SchoolLunchConfig   `toml:"school-lunch"`
	Calendars     []CalendarConfig    `toml:"calendars"`
	Locks         []LockConfig        `toml:"locks"`
	Sun           SunConfig           `toml:"sun"`
	Weather       WeatherConfig       `toml:"weather"`
	Trash         TrashConfig         `toml:"trash"`
	Travel        []TravelConfig      `toml:"travel"`
}

func ParseConfig

func ParseConfig(filename string) (config Config, err error)

func (Config) TimeZone

func (c Config) TimeZone() (tz *time.Location)

type CurrentWeather

type CurrentWeather struct {
	Condition   string `json:"condition"`
	Temperature int    `json:"temperature"`
	Humidity    int    `json:"humidity"`
}

type ForecastWeather

type ForecastWeather struct {
	Condition     string    `json:"condition"`
	Low           int       `json:"low"`
	High          int       `json:"high"`
	Date          time.Time `json:"date"`
	Precipitation float64   `json:"precipitation"`
}

type GlobalConfig

type GlobalConfig struct {
	Listen   string `toml:"listen"`
	TimeZone string `toml:"timezone"`
}

type HomeAssistant

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

func NewHomeAssistant

func NewHomeAssistant(config Config) HomeAssistant

func (HomeAssistant) CallService

func (ha HomeAssistant) CallService(domain string, service string, payload interface{}) (err error)

func (HomeAssistant) GetCalendar

func (ha HomeAssistant) GetCalendar(key string, start time.Time, end time.Time, entries interface{}) (err error)

Fetches a calendar by the provided key and decodes the array into the entries argument

func (HomeAssistant) GetState

func (ha HomeAssistant) GetState(key string, state interface{}) (err error)

Fetches a state by the provided key and decodes it into the state argument

type HomeAssistantConfig

type HomeAssistantConfig struct {
	Endpoint string `toml:"endpoint"`
	Token    string `toml:"token"`
}

type Lock

type Lock struct {
	Title  string `json:"title"`
	Key    string `json:"key"`
	Locked bool   `json:"locked"`
}

func GetLocks

func GetLocks(config Config) (locks []Lock, err error)

type LockConfig

type LockConfig struct {
	Title string `toml:"title"`
	Key   string `toml:"key"`
}

type LockPayload

type LockPayload struct {
	EntityId string `json:"entity_id"`
}

type LockState

type LockState struct {
	State string
}

type SchoolBusConfig

type SchoolBusConfig struct {
	Endpoint string `toml:"endpoint"`
	Username string `toml:"username"`
	Password string `toml:"password"`
}

type SchoolCafe

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

func NewSchoolCafe

func NewSchoolCafe(config Config) SchoolCafe

func (SchoolCafe) GetMenuItems

func (sc SchoolCafe) GetMenuItems(date time.Time, mealType string) (items map[string][]SchoolCafeItem, err error)

type SchoolCafeItem

type SchoolCafeItem struct {
	Description string `json:"MenuItemDescription"`
}

type SchoolLunchConfig

type SchoolLunchConfig struct {
	Endpoint string `toml:"endpoint"`
	SchoolId string `toml:"id"`
	Grade    int    `toml:"grade"`
}

type SchoolMenu

type SchoolMenu struct {
	Entrees []SchoolMenuItem `json:"entrees"`
}

func GetSchoolLunch

func GetSchoolLunch(config Config, date time.Time) (menu SchoolMenu, err error)

type SchoolMenuItem

type SchoolMenuItem struct {
	Description string `json:"description"`
}

type Sun

type Sun struct {
	Dawn          time.Time `json:"dawn"`
	Dusk          time.Time `json:"dusk"`
	Midnight      time.Time `json:"midnight"`
	Noon          time.Time `json:"noon"`
	Sunrise       time.Time `json:"sunrise"`
	Sunset        time.Time `json:"sunset"`
	PrettySunrise string    `json:"pretty_sunrise"`
	PrettySunset  string    `json:"pretty_sunset"`
}

func GetSun

func GetSun(config Config) (sun Sun, err error)

type SunConfig

type SunConfig struct {
	Key string `toml:"key"`
}

type SunState

type SunState struct {
	State      string
	Attributes struct {
		NextDawn     time.Time `json:"next_dawn"`
		NextDusk     time.Time `json:"next_dusk"`
		NextMidnight time.Time `json:"next_midnight"`
		NextNoon     time.Time `json:"next_noon"`
		NextRising   time.Time `json:"next_rising"`
		NextSetting  time.Time `json:"next_setting"`
		Rising       bool      `json:"rising"`
	}
}

type Trash

type Trash struct {
	PutCansOut bool `json:"putCansOut"`
}

func GetTrash

func GetTrash(config Config) (trash Trash)

type TrashConfig

type TrashConfig struct {
	Day time.Weekday `toml:"day"`
}

type TravelConfig

type TravelConfig struct {
	Key string `toml:"key"`
}

type TravelState

type TravelState struct {
	State      string `json:"state"`
	Attributes struct {
		Duration float64 `json:"duration"`
		Distance float64 `json:"distance"`
		Unit     string  `json:"unit_of_measurement"`
		Name     string  `json:"friendly_name"`
	} `json:"attributes"`
}

type TravelTime

type TravelTime struct {
	Name     string `json:"name"`
	Duration string `json:"duration"`
}

func GetTravelTimes

func GetTravelTimes(config Config) (travelTimes []TravelTime, err error)

type Weather

type Weather struct {
	Current  CurrentWeather    `json:"current"`
	Forecast []ForecastWeather `json:"forecast"`
}

func GetWeather

func GetWeather(config Config) (weather Weather, err error)

type WeatherConfig

type WeatherConfig struct {
	Key string `toml:"key"`
}

type WeatherState

type WeatherState struct {
	State      string
	Attributes struct {
		Temperature int
		Humidity    int
		Forecast    []struct {
			Condition     string
			Low           int `json:"templow"`
			High          int `json:"temperature"`
			Precipitation float64
			Date          time.Time `json:"datetime"`
		}
	}
}

Jump to

Keyboard shortcuts

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