service

package
v0.0.0-...-73c6684 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alarm

type Alarm struct {
	SchedulerManager     *scheduler.SchedulerManager `inject:""`
	ConfigurationService *Configuration              `inject:""`
	NotificationService  *Notification               `inject:""`
	CameraService        *Camera                     `inject:""`
	SlackClient          slack.Client
	AlarmStatus          bool
	Cameras              []string
	LocationStatus       map[string]LocationStatus
}

func (*Alarm) Init

func (a *Alarm) Init()

func (*Alarm) ToggleAlarm

func (a *Alarm) ToggleAlarm(configuration model.Configuration, status int) ([]string, error)

type Camera

type Camera struct {
	Db *gorm.DB `inject:""`
}

func (Camera) CreateOrUpdateCamera

func (c Camera) CreateOrUpdateCamera(configurationID string, camera *model.Camera)

func (Camera) DeleteCamera

func (c Camera) DeleteCamera(cameraID string) error

func (Camera) GetCamera

func (c Camera) GetCamera(cameraID string) (*model.Camera, error)

func (Camera) GetCameras

func (c Camera) GetCameras(configurationID string) []model.Camera

func (Camera) Init

func (c Camera) Init()

func (Camera) ToggleCameraAlarm

func (c Camera) ToggleCameraAlarm(cameraID uint, status int) error

type Configuration

type Configuration struct {
	Db *gorm.DB `inject:""`
}

func (*Configuration) CreateOrUpdateConfiguration

func (c *Configuration) CreateOrUpdateConfiguration(configuration *model.Configuration)

func (*Configuration) DeleteConfiguration

func (c *Configuration) DeleteConfiguration(configurationID string) error

func (*Configuration) GetConfiguration

func (c *Configuration) GetConfiguration(configurationID string) (*model.Configuration, error)

func (*Configuration) GetConfigurations

func (c *Configuration) GetConfigurations() []model.Configuration

func (*Configuration) GetCurrent

func (c *Configuration) GetCurrent() model.Configuration

func (*Configuration) Init

func (c *Configuration) Init()

type Gate

type Gate struct {
	ConfigurationService *Configuration `inject:""`
}

func (*Gate) Init

func (g *Gate) Init()

func (*Gate) Open

func (g *Gate) Open(configuration model.Configuration) error

type Heater

type Heater struct {
	ScheduledMeasurements map[time.Time]float64
	SchedulerManager      *scheduler.SchedulerManager `inject:""`
	ConfigurationService  *Configuration              `inject:""`
	MaxMeasurements       int
	InfluxdbClient        *influxdb.Client `inject:""`
}

func (*Heater) GetLast

func (h *Heater) GetLast(configuration model.Configuration) (time.Time, float64, error)

func (*Heater) GetScheduledMeasurements

func (h *Heater) GetScheduledMeasurements() *map[time.Time]float64

func (*Heater) Init

func (h *Heater) Init()

func (*Heater) ScheduledMeasurement

func (h *Heater) ScheduledMeasurement()

type Humidity

type Humidity struct {
	ScheduledMeasurements map[time.Time]float64
	SchedulerManager      *scheduler.SchedulerManager `inject:""`
	ConfigurationService  *Configuration              `inject:""`
	MaxMeasurements       int

	InfluxdbClient *influxdb.Client `inject:""`
	// contains filtered or unexported fields
}

func (*Humidity) GetLast

func (h *Humidity) GetLast(configuration model.Configuration) (time.Time, float64, error)

func (*Humidity) GetScheduledMeasurements

func (h *Humidity) GetScheduledMeasurements() *map[time.Time]float64

func (*Humidity) Init

func (h *Humidity) Init()

func (*Humidity) ScheduledMeasurement

func (h *Humidity) ScheduledMeasurement()

type Inverter

type Inverter struct {
	Db                   *gorm.DB                    `inject:""`
	SchedulerManager     *scheduler.SchedulerManager `inject:""`
	ConfigurationService *Configuration              `inject:""`
	NotificationService  *Notification               `inject:""`
	InfluxdbClient       *influxdb.Client            `inject:""`
	Lock                 sync.Mutex
}

func (*Inverter) CreateOrUpdateInverter

func (i *Inverter) CreateOrUpdateInverter(configurationID string, Inverter *model.Inverter)

func (*Inverter) DeleteInverter

func (i *Inverter) DeleteInverter(InverterID string) error

func (*Inverter) GetDefaultInverter

func (i *Inverter) GetDefaultInverter() (*model.Inverter, error)

func (*Inverter) GetInverter

func (i *Inverter) GetInverter(InverterID string) (*model.Inverter, error)

func (*Inverter) GetInverters

func (i *Inverter) GetInverters(configurationID string) []model.Inverter

func (*Inverter) GetMetrics

func (i *Inverter) GetMetrics(Inverter *model.Inverter) (*InverterMetrics, error)

func (*Inverter) Init

func (i *Inverter) Init()

func (*Inverter) ScheduledMeasurement

func (i *Inverter) ScheduledMeasurement()

type InverterMetrics

type InverterMetrics struct {
	PowerPin1                float32 `json:"power_pin_1"`
	PowerPin2                float32 `json:"power_pin_2"`
	GridPowerReading         float32 `json:"grid_power_reading"`
	Riso                     float32 `json:"riso"`
	InverterTemperature      float32 `json:"inverter_temperature"`
	BoosterTemperature       float32 `json:"booster_temperature"`
	DcAcConversionEfficiency float32 `json:"dc_ac_conversion_efficiency"`
	DailyEnergy              float32 `json:"daily_energy"`
	WeeklyEnergy             float32 `json:"weekly_energy"`
	MontlyEnergy             float32 `json:"monthly_energy"`
	YearlyEnergy             float32 `json:"yearly_energy"`
	PowerPeak                float32 `json:"power_peak"`
	PowerPeakToday           float32 `json:"power_peak_today"`
}

type LocationStatus

type LocationStatus string
const (
	Entered LocationStatus = "entered"
	Exited  LocationStatus = "exited"
)

type Notification

type Notification struct {
	ConfigurationService *Configuration `inject:""`
	SlackClient          slack.Client
}

func (*Notification) Init

func (n *Notification) Init()

func (*Notification) SendSlackMessage

func (n *Notification) SendSlackMessage(channel string, message string) error

type PowerMeter

type PowerMeter struct {
	ScheduledMeasurements map[time.Time]float64
	SchedulerManager      *scheduler.SchedulerManager `inject:""`
	ConfigurationService  *Configuration              `inject:""`
	InverterService       *Inverter                   `inject:""`
	MaxMeasurements       int
	InfluxdbClient        *influxdb.Client `inject:""`
	DefaultInverter       *model.Inverter
}

func (*PowerMeter) GetLast

func (p *PowerMeter) GetLast(configuration model.Configuration) (time.Time, float64, error)

func (*PowerMeter) GetScheduledMeasurements

func (p *PowerMeter) GetScheduledMeasurements() *map[time.Time]float64

func (*PowerMeter) Init

func (p *PowerMeter) Init()

func (*PowerMeter) ScheduledMeasurement

func (p *PowerMeter) ScheduledMeasurement()

type PowerMeterMetrics

type PowerMeterMetrics struct {
	Power   float64 `json:"power"`
	Current float64 `json:"current"`
}

type Profile

type Profile struct {
	Db *gorm.DB `inject:""`
}

func (Profile) Authenticate

func (p Profile) Authenticate(username string, password string) bool

func (Profile) CreateProfile

func (p Profile) CreateProfile(profile *model.Profile) error

func (Profile) GetProfile

func (p Profile) GetProfile(profileID string) (*model.Profile, error)

func (Profile) GetProfileByUsername

func (p Profile) GetProfileByUsername(username string) (*model.Profile, error)

func (Profile) GetProfiles

func (p Profile) GetProfiles() ([]model.Profile, error)

func (Profile) Init

func (p Profile) Init()

type RainGauge

type RainGauge struct {
	ScheduledMeasurements map[time.Time]float64
	SchedulerManager      *scheduler.SchedulerManager `inject:""`
	ConfigurationService  *Configuration              `inject:""`
	MaxMeasurements       int
	InfluxdbClient        *influxdb.Client `inject:""`
}

func (*RainGauge) GetLast24hTotal

func (r *RainGauge) GetLast24hTotal() (time.Time, float64)

func (*RainGauge) GetScheduledMeasurements

func (r *RainGauge) GetScheduledMeasurements() *map[time.Time]float64

func (*RainGauge) Init

func (r *RainGauge) Init()

func (*RainGauge) ScheduledMeasurement

func (r *RainGauge) ScheduledMeasurement()

type Raspsonar

type Raspsonar struct {
	ScheduledMeasurements    map[time.Time]float64
	SchedulerManager         *scheduler.SchedulerManager `inject:""`
	ConfigurationService     *Configuration              `inject:""`
	NotificationService      *Notification               `inject:""`
	MaxMeasurements          int
	RelayStatus              bool
	RelayActivationTimestamp time.Time
	// contains filtered or unexported fields
}

func (*Raspsonar) GetLast

func (r *Raspsonar) GetLast(configuration model.Configuration) (time.Time, float64, error)

func (*Raspsonar) GetScheduledMeasurements

func (r *Raspsonar) GetScheduledMeasurements() *map[time.Time]float64

func (*Raspsonar) Init

func (r *Raspsonar) Init()

func (*Raspsonar) ScheduledMeasurement

func (r *Raspsonar) ScheduledMeasurement()

func (*Raspsonar) ToggleRelay

func (r *Raspsonar) ToggleRelay(configuration model.Configuration, status bool) error

type Relay

type Relay struct {
	Db                   *gorm.DB                    `inject:""`
	SchedulerManager     *scheduler.SchedulerManager `inject:""`
	ConfigurationService *Configuration              `inject:""`
	NotificationService  *Notification               `inject:""`
}

func (*Relay) CreateOrUpdateRelay

func (r *Relay) CreateOrUpdateRelay(configurationID string, Relay *model.Relay)

func (*Relay) DeleteRelay

func (r *Relay) DeleteRelay(RelayID string) error

func (*Relay) GetRelay

func (r *Relay) GetRelay(RelayID string) (*model.Relay, error)

func (*Relay) GetRelayStatus

func (r *Relay) GetRelayStatus(Relay *model.Relay) (map[int]bool, error)

func (*Relay) GetRelays

func (r *Relay) GetRelays(configurationID string) []model.Relay

func (*Relay) Init

func (r *Relay) Init()

func (*Relay) ScheduledActivation

func (r *Relay) ScheduledActivation()

func (*Relay) ToggleAllPinsRelay

func (r *Relay) ToggleAllPinsRelay(Relay *model.Relay, status bool) error

func (*Relay) ToggleRelay

func (r *Relay) ToggleRelay(Relay *model.Relay, status map[int]bool, manuallyActivated bool) error

type Service

type Service interface {
	Init()
}

type Temperature

type Temperature struct {
	ScheduledMeasurements map[time.Time]float64
	SchedulerManager      *scheduler.SchedulerManager `inject:""`
	ConfigurationService  *Configuration              `inject:""`
	MaxMeasurements       int
	InfluxdbClient        *influxdb.Client `inject:""`
}

func (*Temperature) GetLast

func (t *Temperature) GetLast(configuration model.Configuration) (time.Time, float64, error)

func (*Temperature) GetScheduledMeasurements

func (t *Temperature) GetScheduledMeasurements() *map[time.Time]float64

func (*Temperature) Init

func (t *Temperature) Init()

func (*Temperature) ScheduledMeasurement

func (t *Temperature) ScheduledMeasurement()

type WellPump

type WellPump struct {
	Db                   *gorm.DB                    `inject:""`
	SchedulerManager     *scheduler.SchedulerManager `inject:""`
	ConfigurationService *Configuration              `inject:""`
	NotificationService  *Notification               `inject:""`
	RainGauge            *RainGauge                  `inject:""`
}

func (*WellPump) CreateOrUpdateWellPump

func (w *WellPump) CreateOrUpdateWellPump(configurationID string, wellPump *model.WellPump)

func (*WellPump) DeleteWellPump

func (w *WellPump) DeleteWellPump(wellPumpID string) error

func (*WellPump) GetRelay

func (w *WellPump) GetRelay(wellPump *model.WellPump) (int, error)

func (*WellPump) GetWellPump

func (w *WellPump) GetWellPump(wellPumpID string) (*model.WellPump, error)

func (*WellPump) GetWellPumps

func (w *WellPump) GetWellPumps(configurationID string) []model.WellPump

func (*WellPump) Init

func (w *WellPump) Init()

func (*WellPump) ScheduledActivation

func (w *WellPump) ScheduledActivation()

func (*WellPump) ToggleRelay

func (w *WellPump) ToggleRelay(wellPump *model.WellPump, status int, manuallyActivated bool) error

Jump to

Keyboard shortcuts

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