Some updates
This commit is contained in:
97
consts.go
97
consts.go
@ -1,6 +1,5 @@
|
|||||||
package mysubaru
|
package mysubaru
|
||||||
|
|
||||||
// Lastest version /g2v27
|
|
||||||
var MOBILE_API_VERSION = "/g2v30"
|
var MOBILE_API_VERSION = "/g2v30"
|
||||||
|
|
||||||
var MOBILE_API_SERVER = map[string]string{
|
var MOBILE_API_SERVER = map[string]string{
|
||||||
@ -19,59 +18,59 @@ var WEB_API_SERVER = map[string]string{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var apiURLs = map[string]string{
|
var apiURLs = map[string]string{
|
||||||
"WEB_API_LOGIN": "/login",
|
"WEB_API_LOGIN": "/login",
|
||||||
"WEB_API_LIST_DEVICES": "/listMyDevices.json", // TODO
|
"WEB_API_LIST_DEVICES": "/listMyDevices.json", // TODO
|
||||||
"WEB_API_AUTHORIZE_DEVICE": "/profile/updateDeviceEntry.json",
|
"WEB_API_AUTHORIZE_DEVICE": "/profile/updateDeviceEntry.json",
|
||||||
"WEB_API_NAME_DEVICE": "/profile/addDeviceName.json",
|
"WEB_API_NAME_DEVICE": "/profile/addDeviceName.json",
|
||||||
"WEB_API_EDIT_NAME_DEVICE": "/profile/editDeviceName.json",
|
"WEB_API_EDIT_NAME_DEVICE": "/profile/editDeviceName.json",
|
||||||
"WEB_API_VERIFY_NAME_DEVICE": "/profile/verifyDeviceName.json",
|
"WEB_API_VERIFY_NAME_DEVICE": "/profile/verifyDeviceName.json",
|
||||||
"API_LOGIN": "/login.json", // Same API for g1 and g2
|
"API_2FA_CONTACT": "/twoStepAuthContacts.json",
|
||||||
"API_REFRESH_VEHICLES": "/refreshVehicles.json",
|
"API_2FA_SEND_VERIFICATION": "/twoStepAuthSendVerification.json",
|
||||||
"API_SELECT_VEHICLE": "/selectVehicle.json",
|
"API_2FA_AUTH_VERIFY": "/twoStepAuthVerify.json",
|
||||||
"API_VALIDATE_SESSION": "/validateSession.json",
|
"API_LOGIN": "/login.json", // Same API for g1 and g2
|
||||||
"API_VEHICLE_STATUS": "/vehicleStatus.json",
|
"API_REFRESH_VEHICLES": "/refreshVehicles.json",
|
||||||
"API_AUTHORIZE_DEVICE": "/authenticateDevice.json",
|
"API_SELECT_VEHICLE": "/selectVehicle.json",
|
||||||
"API_NAME_DEVICE": "/nameThisDevice.json",
|
"API_VALIDATE_SESSION": "/validateSession.json",
|
||||||
"API_VEHICLE_HEALTH": "/vehicleHealth.json",
|
"API_VEHICLE_STATUS": "/vehicleStatus.json",
|
||||||
"API_LOCK": "/service/api_gen/lock/execute.json", // Similar API for g1 and g2 -- controller should replace 'api_gen' with either 'g1' or 'g2'
|
"API_AUTHORIZE_DEVICE": "/authenticateDevice.json",
|
||||||
"API_LOCK_CANCEL": "/service/api_gen/lock/cancel.json",
|
"API_NAME_DEVICE": "/nameThisDevice.json",
|
||||||
"API_UNLOCK": "/service/api_gen/unlock/execute.json",
|
"API_VEHICLE_HEALTH": "/vehicleHealth.json",
|
||||||
"API_UNLOCK_CANCEL": "/service/api_gen/unlock/cancel.json",
|
"API_LOCK": "/service/api_gen/lock/execute.json", // Similar API for g1 and g2 -- controller should replace 'api_gen' with either 'g1' or 'g2'
|
||||||
"API_HORN_LIGHTS": "/service/api_gen/hornLights/execute.json",
|
"API_LOCK_CANCEL": "/service/api_gen/lock/cancel.json",
|
||||||
"API_HORN_LIGHTS_CANCEL": "/service/api_gen/hornLights/cancel.json",
|
"API_UNLOCK": "/service/api_gen/unlock/execute.json",
|
||||||
"API_HORN_LIGHTS_STOP": "/service/api_gen/hornLights/stop.json",
|
"API_UNLOCK_CANCEL": "/service/api_gen/unlock/cancel.json",
|
||||||
"API_LIGHTS": "/service/api_gen/lightsOnly/execute.json",
|
"API_HORN_LIGHTS": "/service/api_gen/hornLights/execute.json",
|
||||||
"API_LIGHTS_CANCEL": "/service/api_gen/lightsOnly/cancel.json",
|
"API_HORN_LIGHTS_CANCEL": "/service/api_gen/hornLights/cancel.json",
|
||||||
"API_LIGHTS_STOP": "/service/api_gen/lightsOnly/stop.json",
|
"API_HORN_LIGHTS_STOP": "/service/api_gen/hornLights/stop.json",
|
||||||
"API_CONDITION": "/service/api_gen/condition/execute.json",
|
"API_LIGHTS": "/service/api_gen/lightsOnly/execute.json",
|
||||||
"API_LOCATE": "/service/api_gen/locate/execute.json", // Get the last location the vehicle has reported to Subaru
|
"API_LIGHTS_CANCEL": "/service/api_gen/lightsOnly/cancel.json",
|
||||||
"API_REMOTE_SVC_STATUS": "/service/g2/remoteService/status.json",
|
"API_LIGHTS_STOP": "/service/api_gen/lightsOnly/stop.json",
|
||||||
"API_G1_LOCATE_UPDATE": "/service/g1/vehicleLocate/execute.json", // Different API for g1 and g2
|
"API_CONDITION": "/service/api_gen/condition/execute.json",
|
||||||
"API_G1_LOCATE_STATUS": "/service/g1/vehicleLocate/status.json",
|
"API_LOCATE": "/service/api_gen/locate/execute.json", // Get the last location the vehicle has reported to Subaru
|
||||||
"API_G1_HORN_LIGHTS_STATUS": "/service/g1/hornLights/status.json", // g1-Only API
|
"API_REMOTE_SVC_STATUS": "/service/g2/remoteService/status.json",
|
||||||
"API_G2_LOCATE_UPDATE": "/service/g2/vehicleStatus/execute.json",
|
"API_G1_LOCATE_UPDATE": "/service/g1/vehicleLocate/execute.json", // Different API for g1 and g2
|
||||||
"API_G2_LOCATE_STATUS": "/service/g2/vehicleStatus/locationStatus.json",
|
"API_G1_LOCATE_STATUS": "/service/g1/vehicleLocate/status.json",
|
||||||
"API_G2_SEND_POI": "/service/g2/sendPoi/execute.json", // g2-Only API
|
"API_G1_HORN_LIGHTS_STATUS": "/service/g1/hornLights/status.json", // g1-Only API
|
||||||
"API_G2_SPEEDFENCE": "/service/g2/speedFence/execute.json",
|
"API_G2_LOCATE_UPDATE": "/service/g2/vehicleStatus/execute.json",
|
||||||
"API_G2_GEOFENCE": "/service/g2/geoFence/execute.json",
|
"API_G2_LOCATE_STATUS": "/service/g2/vehicleStatus/locationStatus.json",
|
||||||
"API_G2_CURFEW": "/service/g2/curfew/execute.json",
|
"API_G2_SEND_POI": "/service/g2/sendPoi/execute.json", // g2-Only API
|
||||||
"API_G2_REMOTE_ENGINE_START": "/service/g2/engineStart/execute.json",
|
"API_G2_SPEEDFENCE": "/service/g2/speedFence/execute.json",
|
||||||
"API_G2_REMOTE_ENGINE_START_CANCEL": "/service/g2/engineStart/cancel.json",
|
"API_G2_GEOFENCE": "/service/g2/geoFence/execute.json",
|
||||||
"API_G2_REMOTE_ENGINE_STOP": "/service/g2/engineStop/execute.json",
|
"API_G2_CURFEW": "/service/g2/curfew/execute.json",
|
||||||
|
"API_G2_REMOTE_ENGINE_START": "/service/g2/engineStart/execute.json",
|
||||||
"API_G2_FETCH_CLIMATE_SETTINGS": "/service/g2/remoteEngineStart/fetch.json",
|
"API_G2_REMOTE_ENGINE_START_CANCEL": "/service/g2/engineStart/cancel.json",
|
||||||
"API_G2_SAVE_CLIMATE_SETTINGS": "/service/g2/remoteEngineStart/save.json",
|
"API_G2_REMOTE_ENGINE_STOP": "/service/g2/engineStop/execute.json",
|
||||||
|
"API_G2_FETCH_CLIMATE_SETTINGS": "/service/g2/remoteEngineStart/fetch.json",
|
||||||
|
"API_G2_SAVE_CLIMATE_SETTINGS": "/service/g2/remoteEngineStart/save.json",
|
||||||
"API_G2_FETCH_RES_QUICK_START_SETTINGS": "/service/g2/remoteEngineQuickStartSettings/fetch.json",
|
"API_G2_FETCH_RES_QUICK_START_SETTINGS": "/service/g2/remoteEngineQuickStartSettings/fetch.json",
|
||||||
"API_G2_FETCH_RES_USER_PRESETS": "/service/g2/remoteEngineStartSettings/fetch.json",
|
"API_G2_FETCH_RES_USER_PRESETS": "/service/g2/remoteEngineStartSettings/fetch.json",
|
||||||
"API_G2_FETCH_RES_SUBARU_PRESETS": "/service/g2/climatePresetSettings/fetch.json",
|
"API_G2_FETCH_RES_SUBARU_PRESETS": "/service/g2/climatePresetSettings/fetch.json",
|
||||||
"API_G2_SAVE_RES_SETTINGS": "/service/g2/remoteEngineStartSettings/save.json",
|
"API_G2_SAVE_RES_SETTINGS": "/service/g2/remoteEngineStartSettings/save.json",
|
||||||
"API_G2_SAVE_RES_QUICK_START_SETTINGS": "/service/g2/remoteEngineQuickStartSettings/save.json",
|
"API_G2_SAVE_RES_QUICK_START_SETTINGS": "/service/g2/remoteEngineQuickStartSettings/save.json",
|
||||||
|
"API_EV_CHARGE_NOW": "/service/g2/phevChargeNow/execute.json", // EV-Only API
|
||||||
"API_EV_CHARGE_NOW": "/service/g2/phevChargeNow/execute.json", // EV-Only API
|
"API_EV_FETCH_CHARGE_SETTINGS": "/service/g2/phevGetTimerSettings/execute.json",
|
||||||
"API_EV_FETCH_CHARGE_SETTINGS": "/service/g2/phevGetTimerSettings/execute.json",
|
"API_EV_SAVE_CHARGE_SETTINGS": "/service/g2/phevSendTimerSetting/execute.json",
|
||||||
"API_EV_SAVE_CHARGE_SETTINGS": "/service/g2/phevSendTimerSetting/execute.json",
|
"API_EV_DELETE_CHARGE_SCHEDULE": "/service/g2/phevDeleteTimerSetting/execute.json",
|
||||||
"API_EV_DELETE_CHARGE_SCHEDULE": "/service/g2/phevDeleteTimerSetting/execute.json",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// API_VEHICLE_FEATURES items that determine available functionality
|
// API_VEHICLE_FEATURES items that determine available functionality
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
credentials:
|
|
||||||
username: user@email.com
|
|
||||||
password: "Secr#TPassW0rd"
|
|
||||||
pin: "PIN"
|
|
||||||
deviceId: GENERATE-DEVICE-ID
|
|
||||||
deviceName: Golang Integration
|
|
||||||
mysubaru:
|
mysubaru:
|
||||||
|
credentials:
|
||||||
|
username: user@email.com
|
||||||
|
password: "Secr#TPassW0rd"
|
||||||
|
pin: "PIN"
|
||||||
|
deviceid: GENERATE-DEVICE-ID
|
||||||
|
devicename: Golang Integration
|
||||||
region: USA
|
region: USA
|
||||||
mqtt:
|
auto_reconnect: true
|
||||||
client_id: mysubaru
|
timezone: "America/New_York"
|
||||||
username: mysubaru
|
logging:
|
||||||
password:
|
level: INFO
|
||||||
host: mqtt.hostname.com
|
output: json
|
||||||
port: 1883
|
source: false
|
||||||
log: info
|
|
||||||
|
@ -2,7 +2,7 @@ module example
|
|||||||
|
|
||||||
go 1.24
|
go 1.24
|
||||||
|
|
||||||
require git.savin.nyc/alex/mysubaru v0.0.0-20250520200227-71e00595ca48
|
require git.savin.nyc/alex/mysubaru v0.0.0-20250520201343-455e885a2cf3
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Jeffail/gabs/v2 v2.7.0 // indirect
|
github.com/Jeffail/gabs/v2 v2.7.0 // indirect
|
||||||
|
1
go.mod
1
go.mod
@ -3,7 +3,6 @@ module git.savin.nyc/alex/mysubaru
|
|||||||
go 1.24
|
go 1.24
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Jeffail/gabs v1.4.0
|
|
||||||
github.com/Jeffail/gabs/v2 v2.7.0
|
github.com/Jeffail/gabs/v2 v2.7.0
|
||||||
github.com/go-resty/resty/v2 v2.16.5
|
github.com/go-resty/resty/v2 v2.16.5
|
||||||
github.com/sirupsen/logrus v1.9.3
|
github.com/sirupsen/logrus v1.9.3
|
||||||
|
34
vehicle.go
34
vehicle.go
@ -12,26 +12,26 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var parts = map[string]map[string][]string{
|
var parts = map[string]map[string][]string{
|
||||||
"door": map[string][]string{
|
"door": {
|
||||||
"suffix": []string{"position", "status"},
|
"suffix": {"position", "status"},
|
||||||
"position1": []string{"front", "rear", "boot", "enginehood"},
|
"position1": {"front", "rear", "boot", "enginehood"},
|
||||||
"position2": []string{"right", "left"},
|
"position2": {"right", "left"},
|
||||||
},
|
},
|
||||||
"window": map[string][]string{
|
"window": {
|
||||||
"suffix": []string{"status"},
|
"suffix": {"status"},
|
||||||
"position1": []string{"front", "rear", "sunroof"},
|
"position1": {"front", "rear", "sunroof"},
|
||||||
"position2": []string{"right", "left"},
|
"position2": {"right", "left"},
|
||||||
},
|
},
|
||||||
"tire": map[string][]string{
|
"tire": {
|
||||||
"prefix": []string{"status"},
|
"prefix": {"status"},
|
||||||
"position1": []string{"front", "rear"},
|
"position1": {"front", "rear"},
|
||||||
"position2": []string{"right", "left"},
|
"position2": {"right", "left"},
|
||||||
},
|
},
|
||||||
"tyre": map[string][]string{
|
"tyre": {
|
||||||
"prefix": []string{"pressure"},
|
"prefix": {"pressure"},
|
||||||
"suffix": []string{"psi", "unit"},
|
"suffix": {"psi", "unit"},
|
||||||
"position1": []string{"front", "rear"},
|
"position1": {"front", "rear"},
|
||||||
"position2": []string{"right", "left"},
|
"position2": {"right", "left"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user