From ebb4fda0ff0338572ec35f88cd2b71436f9a8441 Mon Sep 17 00:00:00 2001 From: Mike Hwa Date: Sun, 22 Sep 2024 13:19:05 -0700 Subject: [PATCH] Updates to support scheduled charging /~https://github.com/teslamotors/vehicle-command/pull/305 --- pkg/vehicle/state.go | 17 +++++++++++++++++ run_tesla_command_proxy.sh | 5 +++++ 2 files changed, 22 insertions(+) create mode 100644 pkg/vehicle/state.go create mode 100755 run_tesla_command_proxy.sh diff --git a/pkg/vehicle/state.go b/pkg/vehicle/state.go new file mode 100644 index 0000000..e70d0ba --- /dev/null +++ b/pkg/vehicle/state.go @@ -0,0 +1,17 @@ +package vehicle + +import ( + "context" + + "github.com/teslamotors/vehicle-command/pkg/protocol/protobuf/vcsec" +) + +// BodyControllerState returns information about closures, locks, and infotainment sleep status. +// This method works over BLE even when infotainment is asleep. +func (v *Vehicle) BodyControllerState(ctx context.Context) (*vcsec.VehicleStatus, error) { + reply, err := v.getVCSECInfo(ctx, vcsec.InformationRequestType_INFORMATION_REQUEST_TYPE_GET_STATUS, slotNone) + if err != nil { + return nil, err + } + return reply.GetVehicleStatus(), nil +} diff --git a/run_tesla_command_proxy.sh b/run_tesla_command_proxy.sh new file mode 100755 index 0000000..464e090 --- /dev/null +++ b/run_tesla_command_proxy.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +cd /home/pi/tesla-command-proxy + +/usr/local/go/bin/go run /home/pi/tesla-command-proxy/cmd/tesla-http-proxy -tls-key /home/pi/tesla/python/key.pem -cert /home/pi/tesla/python/cert.pem -port 4443 -key-file /home/pi/tesla/python/tesla_private_key.pem -mode owner $1 > tesla-command-proxy.log 2>&1 &