Skip to content

Commit

Permalink
Fix up Tesla arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
elffjs committed Jul 21, 2023
1 parent 36fa129 commit e5f12b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions internal/controllers/synthetic_devices_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,11 +712,16 @@ func (sdc *SyntheticDevicesController) ReAuthenticate(c *fiber.Ctx) error {
switch i.Vendor {
case constants.SmartCarVendor:
sdc.smartcarTask.StopPoll(oldUDAI)

sdc.smartcarTask.StartPoll(newUDAI)
newUDAI.Update(c.Context(), sdc.DBS().Writer, boil.Infer())
case constants.TeslaVendor:
id, _ := strconv.Atoi(newUDAI.ExternalID.String)
mp := struct {
TeslaVehicleID int `json:"teslaVehicleId"`
}{}
newUDAI.Metadata.Unmarshal(&mp)
sdc.teslaTask.StopPoll(oldUDAI)

Check failure on line 723 in internal/controllers/synthetic_devices_controller.go

View workflow job for this annotation

GitHub Actions / lint

Error return value of `sdc.smartcarTask.StopPoll` is not checked (errcheck)
sdc.teslaTask.StartPoll(newUDAI)
sdc.teslaTask.StartPoll(&services.TeslaVehicle{ID: id, VehicleID: mp.TeslaVehicleID}, newUDAI)

Check failure on line 724 in internal/controllers/synthetic_devices_controller.go

View workflow job for this annotation

GitHub Actions / lint

Error return value of `sdc.smartcarTask.StartPoll` is not checked (errcheck)
newUDAI.Update(c.Context(), sdc.DBS().Writer, boil.Infer())

Check failure on line 725 in internal/controllers/synthetic_devices_controller.go

View workflow job for this annotation

GitHub Actions / lint

Error return value of `newUDAI.Update` is not checked (errcheck)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/services/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ type UserDeviceAPIIntegrationsMetadata struct {
Commands *UserDeviceAPIIntegrationsMetadataCommands `json:"commands,omitempty"`
// CANProtocol is the protocol that was detected by edge-network from the autopi.
CANProtocol *string `json:"canProtocol,omitempty"`
TeslaVehicleID int `json:"teslaVehicleID,omitempty"`
TeslaVehicleID int `json:"teslaVehicleId,omitempty"`
}

type UserDeviceAPIIntegrationsMetadataCommands struct {
Expand Down

0 comments on commit e5f12b9

Please sign in to comment.