Documentation
¶
Overview ¶
Package ambient provides helper functions and Go types for accessing ambientweather.net's API which is documented at
https://ambientweather.docs.apiary.io/
Index ¶
Constants ¶
const APIEP = "https://api.ambientweather.net/" + APIVer
APIEP is the endpoint to be called.
const APIVer = "v1"
APIVer is the current version of the API.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIDeviceMacResponse ¶
type APIDeviceMacResponse struct {
Record []Record
RecordFields []map[string]interface{}
JSONResponse []byte
HTTPResponseCode int
ResponseTime time.Duration
}
APIDeviceMacResponse returns the data from /devices/macaddr API.
type APIDeviceResponse ¶
type APIDeviceResponse struct {
DeviceRecord []DeviceRecord
JSONResponse []byte
HTTPResponseCode int
ResponseTime time.Duration
}
APIDeviceResponse returns the data from /devices API.
type DeviceInfo ¶
DeviceInfo maps the info portion of the /devices API.
type DeviceRecord ¶
type DeviceRecord struct {
Macaddress string
Info DeviceInfo
LastData Record
LastDataFields map[string]interface{}
}
DeviceRecord maps one record of the /devices API.
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key holds the keys.
func (Key) ApplicationKey ¶
ApplicationKey returns the currently set ApplicationKey.
func (Key) SetApplicationKey ¶
SetApplicationKey sets the applicationKey
type Record ¶
type Record struct {
Date time.Time
Baromabsin float64
Baromrelin float64
Battout json.Number
Batt1 json.Number
Batt2 json.Number
Batt3 json.Number
Batt4 json.Number
Batt5 json.Number
Batt6 json.Number
Batt7 json.Number
Batt8 json.Number
Batt9 json.Number
Batt10 json.Number
Co2 float64
Dailyrainin float64
Dewpoint float64
Eventrainin float64
Feelslike float64
Hourlyrainin float64
Humidity int
Humidity1 int
Humidity2 int
Humidity3 int
Humidity4 int
Humidity5 int
Humidity6 int
Humidity7 int
Humidity8 int
Humidity9 int
Humidity10 int
Humidityin int
LastRain time.Time
Maxdailygust float64
Pm25 int
Pm25_24h float64
Relay1 int
Relay2 int
Relay3 int
Relay4 int
Relay5 int
Relay6 int
Relay7 int
Relay8 int
Relay9 int
Relay10 int
Monthlyrainin float64
Solarradiation float64
Tempf float64
Temp1f float64
Temp2f float64
Temp3f float64
Temp4f float64
Temp5f float64
Temp6f float64
Temp7f float64
Temp8f float64
Temp9f float64
Temp10f float64
Tempinf float64
Totalrainin float64
// BUG(lrosenman): Uv should be an int
// but the WS-8478 device is reporting a float.
// Per https://www.epa.gov/sunsafety/calculating-uv-index-0
// it should be an int.
// all consoles EXCEPT the WS-8478 return int, but we have to
// accommodate the WS-8478.
Uv float64
Weeklyrainin float64
Winddir int
Windgustmph float64
Windgustdir int
Windspeedmph float64
Winddir_avg2m int
Windspdmph_avg2m float64
Winddir_avg10m int
Windspdmph_avg10m float64
Yearlyrainin float64
TZ string
}
Record maps the data for a specific time as returned by the API.
Notes ¶
Bugs ¶
Uv should be an int but the WS-8478 device is reporting a float. Per https://www.epa.gov/sunsafety/calculating-uv-index-0 it should be an int. all consoles EXCEPT the WS-8478 return int, but we have to accommodate the WS-8478.