diff --git a/tariff/amber.go b/tariff/amber.go index 416e6df735..4d099ead0c 100644 --- a/tariff/amber.go +++ b/tariff/amber.go @@ -108,6 +108,9 @@ func (t *Amber) run(done chan error) { End: endTime.Local(), Price: r.PerKwh / 1e2, } + if r.AdvancedPrice != nil { + ar.Price = r.AdvancedPrice.Predicted / 1e2 + } data = append(data, ar) } } diff --git a/tariff/amber/types.go b/tariff/amber/types.go index 87e6282aa6..4ba3f1778f 100644 --- a/tariff/amber/types.go +++ b/tariff/amber/types.go @@ -2,18 +2,25 @@ package amber const URI = "https://api.amber.com.au/v1/sites/%s/prices?resolution=30" +type AdvancedPrice struct { + Low float64 `json:"low"` + Predicted float64 `json:"predicted"` + High float64 `json:"high"` +} + type PriceInfo struct { - Type string `json:"type"` - Date string `json:"date"` - Duration int `json:"duration"` - StartTime string `json:"startTime"` - EndTime string `json:"endTime"` - NemTime string `json:"nemTime"` - PerKwh float64 `json:"perKwh"` - Renewables float64 `json:"renewables"` - SpotPerKwh float64 `json:"spotPerKwh"` - ChannelType string `json:"channelType"` - SpikeStatus string `json:"spikeStatus"` - Descriptor string `json:"descriptor"` - Estimate bool `json:"estimate"` + Type string `json:"type"` + Date string `json:"date"` + Duration int `json:"duration"` + StartTime string `json:"startTime"` + EndTime string `json:"endTime"` + NemTime string `json:"nemTime"` + PerKwh float64 `json:"perKwh"` + Renewables float64 `json:"renewables"` + SpotPerKwh float64 `json:"spotPerKwh"` + ChannelType string `json:"channelType"` + SpikeStatus string `json:"spikeStatus"` + Descriptor string `json:"descriptor"` + Estimate bool `json:"estimate"` + AdvancedPrice *AdvancedPrice `json:"advancedPrice,omitempty"` }