ecodash

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Administrator

type Administrator struct {
	Username     string `json:"username"`
	PasswordHash string `json:"password_hash"`
}

type Config

type Config struct {
	HomeAssistant HomeAssistant `json:"home_assistant"`
	Sensors       Sensors       `json:"sensors"`
	Administrator Administrator `json:"administrator"`
	Dashboard     Dashboard     `json:"dashboard"`
	// contains filtered or unexported fields
}

func LoadConfig

func LoadConfig() (config *Config, isFirstRun bool, err error)

func (*Config) AdminEndpoint

func (config *Config) AdminEndpoint(c *fiber.Ctx) error

func (*Config) Equals

func (config *Config) Equals(c *Config) bool

func (*Config) IsAuthorized

func (config *Config) IsAuthorized(c *fiber.Ctx) bool

func (*Config) RenderAdminPanel

func (config *Config) RenderAdminPanel(c *fiber.Ctx, warning ...Warning) error

func (*Config) RenderIndex

func (config *Config) RenderIndex(c *fiber.Ctx) error

func (*Config) TemplateDefaultsMap

func (config *Config) TemplateDefaultsMap() fiber.Map

func (*Config) UpdateHistory

func (config *Config) UpdateHistory()

type Dashboard

type Dashboard struct {
	Name        string `json:"name"`
	Theme       string `json:"theme"`
	FooterLinks []Link `json:"footer_links"`
	HeaderLinks []Link `json:"header_links"`
}

type DayData

type DayData struct {
	DayTime      time.Time
	DayNumber    int
	Measurements int
	Value        float32
	High         float32
	Low          float32
}

type History

type History []HistoryEntry

type HistoryEntry

type HistoryEntry struct {
	Date                       int64
	GreenEnergyPercentage      float32
	PolledSmartEnergySummation float32
}

type HistoryResult

type HistoryResult []struct {
	LastUpdated time.Time `json:"last_updated"`
	State       string    `json:"state"`
}

type HomeAssistant

type HomeAssistant struct {
	InstallationDate time.Time `json:"installation_date"`
	BaseURL          string    `json:"base_url"`
	APIKey           string    `json:"api_key"`
}
type Link struct {
	Label       string `json:"label"`
	Destination string `json:"destination"`
	NewTab      bool   `json:"new_tab"`
	Primary     bool   `json:"primary"`
}

type Sensors

type Sensors struct {
	PolledSmartEnergySummation string `json:"polled_smart_energy_summation"`
	FossilPercentage           string `json:"fossil_percentage"`
}

type Warning

type Warning struct {
	Header    string
	Body      string
	BodyHTML  template.HTML
	IsSuccess bool
}

Jump to

Keyboard shortcuts

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