PowerShell/scripts/install-evcc.ps1

45 lines
1.2 KiB
PowerShell
Raw Normal View History

2023-10-31 12:20:46 +01:00
<#
2023-04-20 12:12:42 +02:00
.SYNOPSIS
Installs evcc
.DESCRIPTION
2023-04-21 12:17:33 +02:00
This PowerShell script installs evcc. Sevcc is an extensible EV Charge Controller with PV integration implemented in Go. See https://evcc.io for details.
2023-04-20 12:12:42 +02:00
.EXAMPLE
2023-08-06 21:35:36 +02:00
PS> ./install-evcc.ps1
2023-04-20 12:12:42 +02:00
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
2023-04-20 12:54:56 +02:00
if ($IsLinux) {
"⏳ (1/6) Installing necessary packets..."
& sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
2023-04-20 12:12:42 +02:00
2023-04-20 12:54:56 +02:00
"⏳ (2/6) Installing keyring for evcc..."
& curl -1sLf 'https://dl.cloudsmith.io/public/evcc/stable/setup.deb.sh' | sudo -E bash
2023-04-20 12:12:42 +02:00
2023-04-20 12:54:56 +02:00
"⏳ (3/6) Updating packet list...."
& sudo apt update
2023-04-20 12:12:42 +02:00
2023-04-20 12:54:56 +02:00
"⏳ (4/6) Installing evcc packet..."
& sudo apt install -y evcc
2023-04-20 12:12:42 +02:00
2023-04-20 12:54:56 +02:00
"⏳ (5/6) Configuring evcc..."
& evcc configure
2023-04-20 12:12:42 +02:00
2023-04-20 12:54:56 +02:00
"⏳ (6/6) Starting evcc Web server on :7070 as system service..."
& sudo systemctl start evcc
} else {
throw "Sorry, only Linux installation currently supported"
}
2023-04-20 12:12:42 +02:00
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ evcc installed successfully in $Elapsed sec"
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}