Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple cars simpler beta #33

Merged
merged 4 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Volvo4evcc.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
RootModule = 'Volvo4evcc.psm1'

# Version number of this module.
ModuleVersion = '1.9.1'
ModuleVersion = '1.10.1'

# ID used to uniquely identify this module
GUID = '50047ffd-8482-4a42-94f3-52bbf7515d93'
Expand Down
7 changes: 7 additions & 0 deletions functions/functions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ Function Set-VolvoAuthentication
$Global:Config.'Car.Vin' = (Read-Host -Prompt 'VIN as comma seperated list no qoutes - example: YJHKDGSTS65G,YHFGS45FJDT').split(",") | ForEach-Object -Process {$_ | ConvertTo-SecureString -AsPlainText}
}

$TempVin = @()
Foreach ($Vin in ($Global:Config."car.vin" | ConvertFrom-SecureString -AsPlainText))
{
$TempVin += Read-Host -Prompt "(no special chars or spaces as we use this in the api)`n Car name for $Vin - Example EX30"
}
$Global:Config.'Car.Names' = $TempVin

$Global:Config.'Url.Evcc' = Read-Host -Prompt 'EVCC URL eg: http://192.168.178.201:7070'
#Reset OTP on every export
$Global:Config.'Credentials.Otp' = '111111'
Expand Down
10 changes: 3 additions & 7 deletions internal/internal.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -511,23 +511,19 @@ Function Watch-VolvoCar

$CarDataJson.data| add-member -Name "EvccStatus" -value ([PSCustomObject]@{'value'='A'}) -MemberType NoteProperty

}

If ($CarDataJson.data.chargingConnectionStatus.Value -eq 'CONNECTION_STATUS_CONNECTED_AC' -or $CarDataJson.data.ChargingConnectionStatus.Value -eq 'CONNECTION_STATUS_CONNECTED_DC'){
}elseif ($CarDataJson.data.chargingConnectionStatus.Value -eq 'CONNECTION_STATUS_CONNECTED_AC' -or $CarDataJson.data.ChargingConnectionStatus.Value -eq 'CONNECTION_STATUS_CONNECTED_DC'){
If ($CarDataJson.data.chargingSystemStatus.Value -eq 'CHARGING_SYSTEM_CHARGING'){
$CarDataJson.data| add-member -Name "EvccStatus" -value ([PSCustomObject]@{'value'='C'}) -MemberType NoteProperty

}else{
$CarDataJson.data| add-member -Name "EvccStatus" -value ([PSCustomObject]@{'value'='B'}) -MemberType NoteProperty
}
}

If ($CarDataJson.Data.ChargingSystemStatus.Value -eq 'CHARGING_SYSTEM_IDLE'){
}elseif ($CarDataJson.Data.ChargingSystemStatus.Value -eq 'CHARGING_SYSTEM_IDLE'){

$CarDataJson.data| add-member -Name "EvccStatus" -value ([PSCustomObject]@{'value'='B'}) -MemberType NoteProperty
}

$JsonResultTable | add-member -Name "Car$itteration" -value $CarDataJson.data -MemberType NoteProperty
$JsonResultTable | add-member -Name "$($Global:Config.'Car.Names'[$itteration])" -value $CarDataJson.data -MemberType NoteProperty

}

Expand Down
1 change: 1 addition & 0 deletions variables/variables.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ $Global:Config = @{
'Credentials.VccApiKey' = ''
'Credentials.Otp' = '111111'
'Car.Vin' = ''
'Car.Names' = ''
'Url.Oauth_Token' = 'https://volvoid.eu.volvocars.com/as/token.oauth2'
'Url.Oauth_Authorise' = 'https://volvoid.eu.volvocars.com/as/authorization.oauth2'
'Url.Oauth_Claims' = '?client_id=h4Yf0b&response_type=code&acr_values=urn:volvoid:aal:bronze:2sv&response_mode=pi.flow&scope=openid energy:battery_charge_level energy:charging_connection_status energy:charging_system_status energy:electric_range energy:estimated_charging_time energy:recharge_status'
Expand Down