util

package
v0.1.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(configFile string)

load yaml config

Types

type Car

type Car struct {
	ID           int         `yaml:"teslamate_car_id"` // mqtt identifier for vehicle
	GarageDoor   *GarageDoor // bidirectional pointer to GarageDoor containing car
	CurLat       float64     // current latitude
	CurLng       float64     // current longitude
	CurDistance  float64     // current distance from garagedoor location
	PrevGeofence string      // geofence previously ascribed to car
	CurGeofence  string      // updated geofence ascribed to car when published to mqtt
}

type ConfigStruct

type ConfigStruct struct {
	Global struct {
		MqttHost          string `yaml:"mqtt_host"`
		MqttPort          int    `yaml:"mqtt_port"`
		MqttClientID      string `yaml:"mqtt_client_id"`
		MqttUser          string `yaml:"mqtt_user"`
		MqttPass          string `yaml:"mqtt_pass"`
		MqttUseTls        bool   `yaml:"mqtt_use_tls"`
		MqttSkipTlsVerify bool   `yaml:"mqtt_skip_tls_verify"`
		OpCooldown        int    `yaml:"cooldown"`
		MyQEmail          string `yaml:"myq_email"`
		MyQPass           string `yaml:"myq_pass"`
	} `yaml:"global"`
	GarageDoors []*GarageDoor `yaml:"garage_doors"`
	Testing     bool
}
var Config ConfigStruct

type GarageDoor

type GarageDoor struct {
	Location             Point           `yaml:"location"`
	CloseRadius          float64         `yaml:"close_radius"`           // distance when leaving to trigger close event
	OpenRadius           float64         `yaml:"open_radius"`            // distance when arriving to trigger open event
	TriggerCloseGeofence GeofenceTrigger `yaml:"trigger_close_geofence"` // geofence cross event to trigger close
	TriggerOpenGeofence  GeofenceTrigger `yaml:"trigger_open_geofence"`  // geofence cross event to trigger open
	MyQSerial            string          `yaml:"myq_serial"`
	Cars                 []*Car          `yaml:"cars"` // cars housed within this garage
	OpLock               bool            // controls if garagedoor has been operated recently to prevent flapping
	UseTeslmateGeofence  bool            //indicates whether garage door uses teslamate's geofence or not (checked during runtime)
}

defines a garage door with either a location and open/close radii, OR trigger open/close geofences {Location,CloseRadius,OpenRadius} set is mutually exclusive with {TriggerCloseGeofence,TriggerOpenGeofence} with preference for {TriggerCloseGeofence,TriggerOpenGeofence} set if both are defined

type GeofenceTrigger added in v0.1.2

type GeofenceTrigger struct {
	From string `yaml:"from"`
	To   string `yaml:"to"`
}

defines which geofence change will trigger an event, e.g. "home" to "not_home"

func (GeofenceTrigger) IsGeofenceDefined added in v0.1.2

func (g GeofenceTrigger) IsGeofenceDefined() bool

type Point

type Point struct {
	Lat float64 `yaml:"lat"`
	Lng float64 `yaml:"lng"`
}

func (Point) IsPointDefined added in v0.1.2

func (p Point) IsPointDefined() bool

Jump to

Keyboard shortcuts

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