Documentation ¶
Index ¶
Constants ¶
const ( ApagaLuzAPIUrl = "https://raw.githubusercontent.com/jorgeatgu/apaga-luz/main/public/data/today_price.json" ApagaLuzCanaryAPIUrl = "https://raw.githubusercontent.com/jorgeatgu/apaga-luz/main/public/data/canary_price.json" // Location of retrieved data from ApagaLuz ApagaLuzApiTimeLocation = "Europe/Madrid" ApagaLuzCanaryApiTimeLocation = "Atlantic/Canary" // ActiveHoursOutOfRangeErrorMessage = "config.device.activeHours field must be a number between 1 and 24" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HourData ¶
type HourData struct { Day string `json:"day"` Hour int `json:"hour"` Price float64 `json:"price"` Zone string `json:"zone"` }
HourData represents each of the individual items in the response retrieved from ApagaLuz API
type HourDataList ¶
type HourDataList []HourData
HourDataList represents the entire response retrieved from ApagaLuz API
func GetApiData ¶
func GetApiData(ctx *v1alpha1.Context) (response *HourDataList, err error)
GetApiData TODO
func GetApiDataByPrice ¶
func GetApiDataByPrice(ctx *v1alpha1.Context) (response *HourDataList, err error)
TODO
func GetLimitedCorrelativeHourRanges ¶
func GetLimitedCorrelativeHourRanges(ctx *v1alpha1.Context) (correlativeRanges []HourDataList, err error)
GetLimitedCorrelativeHourRanges return an array whose elements are lists of correlative hours. Those hours were previously sorted and selected by having the lowest price as criteria
type Schedule ¶
Schedule represents a time range to start and stop an external device
func GetBestSchedules ¶
GetBestSchedules return a list of schedules that meet 'active hours' config parameter Starts are delayed by 5 minutes, and stops are 5 minutes early. Done in purpose to avoid time collisions on parallel scheduling. This can be improved a lot. Are you willing to contribute?