@@ -19,10 +19,10 @@ type InfluxConfig struct {
1919 Insecure bool `yaml:"insecure"`
2020}
2121
22- // UtilityConfig is the config for SmartHub.
22+ // SmartHubConfig is the config for SmartHub.
2323// Account is your account number, available on your bill.
2424// ServiceLocation appears to be an internal number, and must be retrieved from your browser. See README.md.
25- type UtilityConfig struct {
25+ type SmartHubConfig struct {
2626 ApiUrl string `yaml:"api_url"`
2727 Username string `yaml:"username"`
2828 Password string `yaml:"password"`
@@ -32,9 +32,9 @@ type UtilityConfig struct {
3232
3333// Config is the config format for electric-usage-downloader
3434type Config struct {
35- ExtractDays int `yaml:"extract_days"`
36- Utility UtilityConfig `yaml:"utility "`
37- InfluxDB InfluxConfig `yaml:"influxdb"`
35+ ExtractDays int `yaml:"extract_days"`
36+ SmartHub SmartHubConfig `yaml:"smarthub "`
37+ InfluxDB InfluxConfig `yaml:"influxdb"`
3838}
3939
4040// Main runs the program.
@@ -87,16 +87,16 @@ func Main() error {
8787 fmt .Printf ("Start date: %s\n " , startDate )
8888 fmt .Printf ("End date: %s\n " , endDate )
8989
90- jwt , err := Auth (config .Utility )
9190 fmt .Println ("Authenticating with SmartHub API..." )
91+ jwt , err := Auth (config .SmartHub )
9292 if err != nil {
9393 return err
9494 }
9595
9696 fmt .Println ("Fetching data from SmartHub API..." )
9797 usage , err := retry .DoWithData (
9898 func () ([]ElectricUsage , error ) {
99- r , err := FetchData (startDate , endDate , config .Utility , jwt )
99+ r , err := FetchData (startDate , endDate , config .SmartHub , jwt )
100100 if err != nil {
101101 return nil , err
102102 }
0 commit comments