Vehicle: add cloud switch
This commit is contained in:
parent
dd668c3007
commit
33fc5d612e
3 changed files with 18 additions and 9 deletions
|
|
@ -26,8 +26,7 @@ func init() {
|
|||
chargerCmd.Flags().BoolP(flagEnable, "e", false, strings.Title(flagEnable))
|
||||
//lint:ignore SA1019 as Title is safe on ascii
|
||||
chargerCmd.Flags().BoolP(flagDisable, "d", false, strings.Title(flagDisable))
|
||||
//lint:ignore SA1019 as Title is safe on ascii
|
||||
chargerCmd.Flags().Bool(flagDiagnose, false, strings.Title(flagDiagnose))
|
||||
chargerCmd.Flags().Bool(flagDiagnose, false, flagDiagnoseDescription)
|
||||
chargerCmd.Flags().BoolP(flagWakeup, "w", false, flagWakeupDescription)
|
||||
chargerCmd.Flags().IntP(flagPhases, "p", 0, flagPhasesDescription)
|
||||
}
|
||||
|
|
|
|||
11
cmd/flags.go
11
cmd/flags.go
|
|
@ -18,9 +18,14 @@ const (
|
|||
flagPhases = "phases"
|
||||
flagPhasesDescription = "Set usable phases (1 or 3)"
|
||||
|
||||
flagEnable = "enable"
|
||||
flagDisable = "disable"
|
||||
flagDiagnose = "diagnose"
|
||||
flagCloud = "cloud"
|
||||
flagCloudDescription = "Use cloud service (requires sponsor token)"
|
||||
|
||||
flagEnable = "enable"
|
||||
flagDisable = "disable"
|
||||
|
||||
flagDiagnose = "diagnose"
|
||||
flagDiagnoseDescription = "Diagnose"
|
||||
|
||||
flagWakeup = "wakeup"
|
||||
flagWakeupDescription = "Wake up"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/evcc-io/evcc/api"
|
||||
"github.com/evcc-io/evcc/util/config"
|
||||
"github.com/spf13/cobra"
|
||||
|
|
@ -21,8 +19,8 @@ func init() {
|
|||
vehicleCmd.Flags().BoolP(flagStart, "a", false, flagStartDescription)
|
||||
vehicleCmd.Flags().BoolP(flagStop, "o", false, flagStopDescription)
|
||||
vehicleCmd.Flags().BoolP(flagWakeup, "w", false, flagWakeupDescription)
|
||||
//lint:ignore SA1019 as Title is safe on ascii
|
||||
vehicleCmd.Flags().Bool(flagDiagnose, false, strings.Title(flagDiagnose))
|
||||
vehicleCmd.Flags().Bool(flagDiagnose, false, flagDiagnoseDescription)
|
||||
vehicleCmd.Flags().Bool(flagCloud, false, flagCloudDescription)
|
||||
}
|
||||
|
||||
func runVehicle(cmd *cobra.Command, args []string) {
|
||||
|
|
@ -41,6 +39,13 @@ func runVehicle(cmd *cobra.Command, args []string) {
|
|||
fatal(err)
|
||||
}
|
||||
|
||||
// use cloud
|
||||
if cmd.Flags().Lookup(flagCloud).Changed {
|
||||
for _, conf := range conf.Vehicles {
|
||||
conf.Other["cloud"] = "true"
|
||||
}
|
||||
}
|
||||
|
||||
if err := configureVehicles(conf.Vehicles); err != nil {
|
||||
fatal(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue